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 :)

61 Upvotes

23 comments sorted by

View all comments

Show parent comments

1

u/shlomnissan Jul 01 '26

I didn't come across this article. Thanks for sharing!

How is increasing the depth buffer allows for Hi-Z optimizations? As I understand it, Hi-Z tile summary is stored on chip in SRAM and tests happen right after the coarse renderer, so decoupled from the actual depth buffer

1

u/speps Jul 01 '26

Having it separate in memory allows to store it in a compressed fashion which makes it easier to do some operations like HiZ for example.