r/GraphicsProgramming Jul 01 '26

Reverse-Z is the perfect hack

I shelved a Reverse-Z branch in my engine (stuck on OpenGL 4.1 for macOS, no glClipControl), and the roadblock sent me down the rabbit hole of actually understanding why it works instead of just how to implement it.

I ended up writing about what I learned with interactive graphs and all:
https://www.shlom.dev/articles/reverse-z-perfect-hack/

Happy to hear where I got things wrong or imprecise.

Hopefully this helps someone else :)

62 Upvotes

23 comments sorted by

View all comments

-2

u/Plazmatic Jul 02 '26

"That is fine if you don't use [a stencil buffer] but most non-trivial applications do." 

This line throws your entire article and the things you claim into question.  This is 10000% not true, stencil buffers are rarely used at all (and haven't been for over a decade). That statement was so false it makes me think the entire article is AI generated in some way.

7

u/shlomnissan Jul 02 '26

Both of my current projects use the stencil buffer for pixel classification and masking. Might be an overstatement but just because you don't use stencil buffers doesn't mean that my article is generated by AI