Thanks GMan for the reply and the source code, much appreciated. I was able to tweak your shaders for my needs and I think I am off to a good start. However I'm still not sure exactly what coordinate system I'm dealing with. In my case, I have an osg terrain loaded in in geocentric coordinates with various trees and other objects placed on the terrain. I will then set my camera position. When I visualize he scene, I have to apply a shader that is able to tell me, in meters, the distance between the camera and whatever object is being viewed in each pixel. For example, for a given camera angle, I may have a leaf of a tree in the upper left pixel of the frame. I need to be able to get the distance in meters from the camera to that leaf so that I can apply some scientific equations and recolor that pixel. This is important because I have a modified osg viewer that reads in the red channel of the pixels from the framebuffer and does further calculations based on the value of that red channel. Most GLSL examples are geared at creating visual effects, whereas I am encoding real scientific data in the color bands and then decoding them at various steps so I can't just scale values according to what looks best. Any advice on how I might get the distance in meters (assuming that every osg object in my scene has been loaded in already in meters)?
------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=44591#44591 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

