Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 5, couldn't grasp the paragraph #128

Open
zzxoto opened this issue Feb 5, 2021 · 0 comments
Open

Chapter 5, couldn't grasp the paragraph #128

zzxoto opened this issue Feb 5, 2021 · 0 comments

Comments

@zzxoto
Copy link

zzxoto commented Feb 5, 2021

Here is the paragraph from Chapter 5 in the book:

"Earlier, it was said that the window-space Z value of 0 is closest and 1 is farthest. However, if our clip-space Z values were negated, the depth of 1 would be closest to the view and the depth of 0 would be farthest. Yet, if we flip the direction of the depth test (GL_LESS to GL_GREATER, etc), we get the exact same result. Similarly, if we reverse the glDepthRange so that 1 is the depth zNear and 0 is the depth zFar, we get the same result if we use GL_GREATER. So it's really just a convention."

The first sentence, "Earlier, ... 1 is farthest. " is crisp. The second however, "However, if our clip-space Z .. 0 would be farthest" throws me completely. Due this, other sentence couldn't be grasped as well, because they refer to this sentence.

I understand that [-1, 1] NDC Z coordinate is mapped to [0, 1] Screen space Z coordinate with 0 being closest to the screen. And thus, GL_LESS or GL_LEQUAL is favorable depth testing function to prioritize geometries closer to near plane to draw over far plane. All that is understood and even then I couldn't make sense of the sentence that I have marked out above. I am just worried if there is more to depth buffer testing, that the confusing sentence above is trying to convey.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant