-
Notifications
You must be signed in to change notification settings - Fork 240
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
Add matrix functions for generating infinite reversed-z perspective projection matrix #158
Comments
Thanks for the feedback. It turns out you can trivially use the existing functions for reverse-z: swap the far/near values:
Be sure to clear the depth-buffer with 0.0 instead of 1.1, and use the reverse depth comparison operator for the Depth/Stencil state (i.e.
|
Hey @walbourn, thank you for replying! To be clear I was specifically referring to the "infinite" variant of a reversed-z projection, which cannot be done with the existing perspective matrix functions (finite reversed projections can be done as you suggested). The infinite reversed matrix has this form for the LH variant:
|
Thanks for the clarification. |
Thank you for the suggestion. I definitely see the value in this, but I'll need a bit more time to do the full validation/verification this warrants. In the meantime, you can of course easily create your own projection matrix with existing constructors and functions. |
Hello, I think it would be really great if DirectXMath added support for generating perspective projection matrices with infinite reversed-z clip planes. This style of projection matrix has become increasing popular in recent years since they result in excellent distribution of depth precision when used with floating-point depth buffers, and they effectively remove the need for having a maximum view distance. This blog post gives a good overview of why it's good and how it works, and this article has some great visualizations of why reversed-z is beneficial.
The text was updated successfully, but these errors were encountered: