Hi, John Instead of relying on matrix that you get from osg camera, you can use gl_ProjectionMatrix in shaders which is guaranteed to be current projection matrix, this uniform contains all values you need to get linear depth from 0..1 postperspective depth which i belive can be calculated as:
float linear_depth = post_perspective_depth * (-gl_ProjectionMatrix[3].z/(post_perspective_depth * (-2.0) + 1.0 - gl_ProjectionMatrix[2].z)) where post_perspective_depth is depth in 0..1 range (i think you can use there gl_FragCoord.z) Cheers, Sergey ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35842#35842 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

