Hey there.
I’ve made some changes to my engine which will hopefully work out just fine, but if not I can always roll back to what I had before, even if it wasn’t that great…
Anyway- The change that I made was to decouple my simple renderer into a new class that’s designed to handle more advanced pipelines. I decoupled it from my scenemanager… Yeah, I just crammed the rendering right in there to save myself the trouble of dealing with it right then and there.
But that’s all taken care of. The new renderer class is much, much better and it finally feels like I’m doing something right again. (Been a while since I felt that.
)
This time however I got inspired. I read online about some guy (please forgive me, guy. But I really can’t remember who it was specifically) who had written a hybrid renderer that utilized both a forward rendering part as well as a deferred renderer for some other tasks. And this gobsmacked me to say the least. It felt like some kind of heavy weight was lifted off my head and I started planning.
It’s so obvious and so perfect for my needs. It offers me the best of both worlds!
There’s a reason why this suits me and my engine. Since forward rendering is still the most robust way of dealing with a few rendering issues (transparency being just one of them), it offers me a pretty stable platform to stand on for lower-end rigs that might like to run my game(s).
I’m not going to go too crazy with supporting lower-end hardware though, this is just a half-measure.
So if the platform isn’t up for spending all that GPU memory on the GBuffer cost it can default to my forward rendering solution.
Now this might seem obvious to some, creepy to some and maybe even a bit stupid to some.
But this is a good choice for my needs right now.
But enough of that. Let’s walk through some stuff it supports right now!
Now I’ve thought a bit different than some regarding the hybrid approach and I’ve chosen to offload as much as possible to a forward rendering pass, this includes unlit/emissive geometry.
Because I’ve come across a few implementations that render the emissive geometry into a chunk in the GBuffer. But that baffled me and I instead render it onto the ambient pass before the deferred rendering even gets to work. Why waste an entire chunk of a buffer for something the lighting doesn’t give a crap about? Emissive (or Unlit) geometry is supposed to look like lit parts of a surface, or maybe I just have a different opinion of what emissive actually implies in this context. *shrug*
Along with this choice I’ve also rendered the “sun” light after the ambient pass just like one would in any forward renderer. I’ve chosen to include at least one global light because there are few scenes that doesn’t use some kind of main light, or even a super-subtle under-lighting. And that’s all available through this.
And even if we don’t want it we can turn it right off, no biggie.
There’s one last thing I do before I let the deferred renderer loose. And that is to render cubemap reflections for the parts of the scene that need it.
Keep in mind that this doesn’t work exactly right as of now, or at least I’m not happy with the resulting look. It’s a bit overpowering right now.
And right about now is the time when I let the deferred renderer do its part. Rendering all of the smaller, non-shadow casting lights. But the good part is that I can have a TON of these!
During the creation of this I’ve tried to my best extents to keep it running fast and avoid potential bottle-necks and the good news is that there isn’t that much for the renderer to fail on. There’s a slight chance that the forward rendering part, with all effects included, could draw the scene geometry a few times more than we’d like. But even with that it’s nowhere near how many times I’d have to redraw something if I were to use a full-featured forward renderer.
And we all know that a much liked part of a deferred renderer is that we only draw geometry once and that is still true.
But as for the forward rendering pass it draws the scene more than once, and that could potentially, not necessarily, but maybe turn into a performance-killer depending on scene complexity.
And that’s pretty much it. I might make a new post soon that includes some pretty pictures and some future plans, but that’s only if it keeps itself out of trouble.
But, as logic dictates, I’m very prone to being wrong and this dreamy house of cards I’ve assembled might come crashing down on me.
Let’s just hope for the best, I really want to work on games…
Bye!