2
\$\begingroup\$

https://www.youtube.com/watch?v=QuvAEqgHrMY&feature=youtu.be

https://www.youtube.com/watch?v=5ob1JsPIGAs&feature=youtu.be

gluPerspective(60, (float)CONTEXT_WIDTH / CONTEXT_HEIGHT, 0.1f, 1.f); //values used for first video
gluPerspective(60, (float)CONTEXT_WIDTH / CONTEXT_HEIGHT, 0.1f, 2000.f);//values used for second video, the further z clip value seems to improve the depth rendered, but far from example images below.

I set my projection matrix with gluPerspective.

This seems to happen when I try gluPerspective; when I set my projection matrix to first person.

The type of image I would like to get is

enter image description here

enter image description here

Is the visual result I am getting correct? Then are the listed examples of depth buffer images are merely a result of refining post rendering process, that are simply added in order for humans to see it better?

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

Your depth buffer seems fine to me. The images you posted most likely have been normalized to make details more easily seen. This process consists of finding the maximum and minimum value of the depth buffer and remapping the color range onto that range. It is also linearized. Graphics debuggers have usually such an option to render the depth buffer (or even the stencil) like this.

\$\endgroup\$
4
\$\begingroup\$

The depth is stored from 0 to 1 (0 - closest, 1 - farthest) by default. Addition to that, depth in perspective projection is not linear, it looked something like this:

So it makes sense to me if it fades to white faster. Unless, you normalize it (see János Turánszki's answer).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .