Reverse Depth Buffer

104 views
Skip to first unread message

DC

unread,
May 9, 2022, 6:43:26 PM5/9/22
to OpenSceneGraph Users
Hello,

Has anyone here been successful in creating a reverse z buffer for OSG?

I have done the following:
  • Created osg::Depth global state attribute to be GREATER and 1.0 to 0.0.
  • Created osg::ClipControl  global state attribute to be LOWER_LEFT,  ZER0_TO_ONE
  • Set camera's clear depth to be 0.
I can render a scene and view the depth buffer and it's "reversed". That is, close objects are white and distance objects are black. But I'm also supposed to modify the projection matrix, which is where I'm stuck. The result is either nothing rendering or some very circus mirror looking objects.

Thanks,
DC


Glenn Waldron

unread,
May 10, 2022, 8:53:09 PM5/10/22
to OpenSceneGraph Users
DC,
Check out the ProjectionMatrix functions in osgEarth, they might be of some help.

DC

unread,
May 11, 2022, 10:15:37 AM5/11/22
to OpenSceneGraph Users
Thank you.
Reply all
Reply to author
Forward
0 new messages