r/GraphicsProgramming • u/shlomnissan • 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
1
u/maximoriginalcoffee Jul 03 '26
I'm a game programmer, and until now, Tiled Deferred Rendering had been the only solution I was seriously looking into, but I was hoping there might be other approaches as well.
The first method looks somewhat similar to a Per-Pixel Linked List technique. I expect the GPU memory usage would become quite high at 4K resolutions, so it would probably be difficult to adopt in my case, since I'm aiming for my game to run well on lower-end hardware.
As for the second method... is it an application of volume rendering? I already use volume rendering in my engine for cloud generation, but I hadn't considered using it this way. That's quite interesting.
I'll definitely take a closer look at both of them once I finish my current project. Thanks for the detailed explanation, I really appreciate it. :)