On Mon, Jan 9, 2012 at 10:00 AM, <thorsten.i.renk 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?
Correct (hence my reference to the Model matrix, rather than ModelViewProjection matrix). > 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 didn't know that. >> What do you need it for? sunrise/sunset lighting? > > Yes, the earthShade factor should affect objects dependent on their > altitude, basically I want glowing high-altitude clouds whereas the lower > clouds are still dark. Thought so. That would be yet another nice effect to add :) On Mon, Jan 9, 2012 at 10:08 AM, Emilian Huminiuc wrote: > In the transition shader (and the other terrain shaders), using gl_Vertex.z > works as a good aproximation (it's used to determine if there should be snow > painted, sometimes it behaves funny, but it's generally reliable enough), > but for clouds maybe using the final value of gl_Position.z might give you > what you want? The gl_Vertex of the terrain has a different coordinate system (presumably based on (0,0,0) being the center of the tile at sealevel?) than the clouds (where (0,0,0) is the center of the sprite). -Stuart ------------------------------------------------------------------------------ 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

