The depth buffer is reversed when get depth buffer using osgearth #2469
Replies: 2 comments
-
Hard to say. OSG automatically calculates near and far planes as you move the camera, so they will be different in your two screenshots. Just going by the coloration of the image can be misleading. A better test would be to manually set your near and far clipping planes, turn off the automatic calculating in OSG, and see if you get the same result. camera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR); |
Beta Was this translation helpful? Give feedback.
-
My target is that get the depth image when render the 3DTiles model, so I changed the code as follows:
Now I can get the depth image, please the following image. I have tried |
Beta Was this translation helpful? Give feedback.
-
I try to capture a depth image when render the 3dtiles model. I write a demo code that load a obj model and render the depth image. I can render a scene and view the depth buffer, but it's "reversed". That is, close objects are white and distance objects are black.
The following is my code:
The distance object is black:
The closed object is white:
So I guess there is no depth content in the following picture because the tree is very close.
How to fix this issue, could anyone give me some advice? Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions