Hi Sergey
> 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) This puts a completely different spin on things. I've been fiddling around with OSG depth buffers, textures, cameras etc. to extract the depth data. But presumably I can do all this in the shaders straight from the normal scene view. Is this what you're saying? John ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35844#35844 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

