[osg-users] How to render depth texture

Mihai Radu radu at cm-labs.com
Wed Sep 12 14:45:54 PDT 2007

Hi Marcus,

If you use shaders, you can render the depth texture to a quad using
texture access function in place of shadow2D().

The trouble is that the values are not suitable for rendering, if you
looks through the archives, someone posted how to map the values to some
useful gray scale ( all I remember of it is subtracting 128 from the
color value from the texture op. ).

I hope this will set you on the right path, and if you manage to do it,
please post the solution.


Marcus Fritzen wrote:
> Hello,
> is there an easy and fast way how I can render the depth values from the 
> depth texture to screen so that the scene is in grayscale? If i do a 
> shadow2D(...) in the shader, it is directly compared with the actual 
> depth value or am I wrong? So I am unsure how I can reach the actual 
> depth value stored in the depth texture.
> Thx.
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 542 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20070912/841c7e91/attachment-0003.pgp>

More information about the osg-users mailing list