how is the depth range changed between NDC and depth buffer

Started by
1 comment, last by jerrycao_1985 10 years, 10 months ago

hi everyone

It occurred to me that the depth value in NDC is between -1 and 1 , while the depth value in depth buffer is between 0 and 1.

So where did the change happened ?

And most importantly , why does OpenGL bother to make the range between -1 and 1, then change it to 0 and 1.

DX does it in a simpler way , range of depth is always between 0 and 1 after perspective divide by default.

Advertisement

So where did the change happened ?

When the fragment processing (and sorting with depth test enabled) happens. see glDepthRange().

according to the document of glDepthRange

It's during transformation between NDC and window coordinate , much earlier than fragment processing.

This topic is closed to new replies.

Advertisement