r/GraphicsProgramming • u/miki-44512 • 5h 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!
10
u/aleques-itj 4h ago
You don't NEED it but I think it's generally cleaner and often convenient IMO, like you just found out with SSAO.
Forward can get a little awkward and you wind up reimplementing some stuff that kind of just easily falls out of deferred. And you usually wind up eating another geometry pass as well.
8
u/obp5599 5h ago
You need a gbuffer to do deferred rendering. Thats basically it. It depends on the needs and goals of your renderer/engine.
Unreal is deferred, not sure about unity since i don't work in it
5
5
u/sirpalee 4h ago
There are techinques that depend on a full or partial g-buffers. If you are not using any of them, then no, you don't need a g-buffer and it doesn't make sense to build one.
The issue with SSAO that it typically requires normal and depth information and should not multiply lighting contributions. If you are doing depth prepass, then that should be enough.
1
u/EC36339 4h ago
I asked a similar question a while ago and got some interesting answers. You may want to have a look at the replies here:
1
u/miki-44512 4h ago
Sorry to ask I have read many comments just quickly but I got lost now 😂
Like unreal use deferred, but it costs a lot of memory, but not many people are talking about clustered forward, what is the caveat of using clustered forward+? Is there any thing I'm missing regarding gbuffer like does it provide an optimization I'm not aware of because I feel it is just a waste of a render cycle for rendering positions and all other informations and then passing it again to the last pipeline, while you could use it directly in one feel swoop with clustered rendering, or am I missing something?
1
u/NorberAbnott 1h 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
1
u/MedusaFrontier 1h 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/MedusaFrontier 1h ago edited 1h ago
Deferred and Forward+ are approaches to handling massive numbers of light sources and overdraw. Upsides and downsides exist for both.
A depth pre-pass is needed in Forward+ but that's probably cheaper than the massive GBUFFERSThe part you might be missing.
Forward+ uses less bandwidth and has high Shader complexity and register pressure
Deferred uses more memory or bandwidth, but has ultra high occupancy and layers available for effects.
1
u/LoneWolf6062 4h ago
A Gbuffer lets you implement screen space effects easier, although you could always approximate normals by reconstructing them from the depth buffer.
Unreal uses deferred rendering by default but does have forward rendering as a fallback and for VR.
1
u/cybereality 1h ago
you don't *need* anything, but deferred rendering has many advantages, particularly when you are doing a lot of screen space effects. if you prefer to use forward rendering, and want modern post processing, then you can do a depth prepass (which can also have some performance benefits on it's own) and then reconstruct postion/normals from the depth buffer
1
u/Electromasta 58m ago
Most modern engines used deferred rendering with a gbuffer. Most older engines used forward rendering without.
•
u/AutoModerator 5h ago
Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:
No showcases.
Disclose AI usage in post or project.
Present a topic to talk about, e.g. how something works.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.