r/GraphicsProgramming • u/miki-44512 • 2d 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!
•
u/AutoModerator 2d ago
Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
25
u/obp5599 2d 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
22
u/aleques-itj 2d 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.
10
u/sirpalee 2d 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 2d 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:
https://www.reddit.com/r/gamedev/s/3qFTujHPdc
2
u/cybereality 2d 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/LoneWolf6062 2d 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/Electromasta 2d ago
Most modern engines used deferred rendering with a gbuffer. Most older engines used forward rendering without.
1
u/Coding-Kitten 2d ago
I'm working on mine being Forward+ with clustered rendering
1
u/OkAccident9994 2d ago
UE uses deferred (g-buffer) and Unity may use it if you want.
It is more costly with forward, as you need position + normals (same as g-buffer) to do it - on top pf your forward renderer - but others have done so as well, and there are tricks like a depth pre-pass to get positions, which one can utilize for multiple effects and some optimizations (eg. cull based on visibility using the depth info).
But ssao really is built with deferred in mind.
0
u/Rorybabory 1d ago
if you want to do ssao with a clustered forward+ renderer, you can still do it, you just calculate the view space normals based on the depth buffer.
Deferred rendering has its pros and cons, some engines use it some don't. Deferred rendering doesn't handle transparency very well, and you can't really do MSAA. You also run into memory bandwidth issues with the really huge g-buffers, so many games use a very thin g-buffer.
0
u/Business-Weather-217 1d ago
Whats a g-buffer, in simple words? Never heard of it..