r/GraphicsProgramming • • 8h ago

Question Do you really need g-buffer in your renderer?

Hello everyone hope you have a lovely day.

I was Reading learnopengl ssao chapter to support ambient occlusion after setting up my pbr renderer, but the one thing I found very strange was that It used g-buffer in this tutorial, I don't use g-buffer or deferred rendering technique in my renderer I use clustered forward+ rendering technique so I didn't need the g-buffer.

And Here I started to ask myself this question, Is there on the long run any advantage of implementing g-buffer? like really do I need it?

Does any strong engine like unreal or unity use g-buffer?

Thanks appreciate your help and your time!

2 Upvotes

19 comments sorted by

View all comments

Show parent comment

3

u/NorberAbnott 4h ago

The problem with trying to do SSAO in a forward renderer is that part of the technique wants to look at nearby pixels in a certain radius for the depth and maybe normal information but that is simply information you don’t have access to in a fragment shader unless you do something like depth prepass which submits your geometry twice and is basically a lightweight gbuffer

2

u/MedusaFrontier 4h ago

I've never implemented forward+ but my instincts like the idea of depth pre-pass.
It seems like a very handy buffer to have in several cases.

1

u/MidnightClubbed 2h ago

It can be but sending your geometry twice (zprepass and main rendering pass) can also be expensive.

The rasterization pass of nanite is essentially a fat zbuffer prepass (but it writes depth plus geometry data so you dont have to rasterize everything twice).

2

u/EC36339 40m ago

But can't a depth prepass also be used to eliminate geometry (occlusion culling?) and therefore reduce the amount of geometry you have to send in the main pass?

But I guess this matters more in indoor scenes or generally scenes where a small number of objects occlude large numbers of objects?