Hi,

On Monday, January 09, 2012 12:00:29 [email protected] wrote:
> > I don't think the Model matrix will help you much either, as IIRC
> > (0,0,0) is the center of the earth spheroid.
> 
> Hm, the line is
> 
>   gl_Position = gl_ModelViewProjectionMatrix * gl_Position;
> 
> Doesn't gl_ModelViewProjectionMatrix transform things into 2d screen
> coordinates?
Yes.

> Would it work if I use a different matrix instead? Apparently
> 
>     vec4 groundPoint = gl_ModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);
> 
> can be used to generate the zero altitude point just below the current
> view, so then the length of the difference vector dotted with an 'up'
> normal would represent altitude (?)

I have lost track of what you want to do. But transforming the 0 vector by the 
modelview does not give any altitude. It is just the point of the current 
models origin on eye coordinates. Also the modelview matrix contains the 
orientation of the view which makes all the coordinate directions hard to 
interpret.

If you want to know the altitude, you need to have the matrix that transforms 
from the current view position/orientation to the earths center. And you need 
to transform from cartesian space into the earth ellipsoid. The best you can 
do is to do this per vertex. And even that is way too much computation for 
that single altitude that you can just set when you set up the geometry.
The most efficient method is probably to set up a 4 vector plane equation that 
represents the sea level altitude horizontal plane in object coordinates. This 
plane needs to be updated when the cloud object moves significantly by the cpu 
code. In the shader you can then compute the distance to the plane in the 
usual way. That would give an altitude per vertex which would be even exact 
per fragment by correct interpolation.

If you only need the altitude per cloud, put that scalar value in a uniform 
...

Mathias

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to