So I’ve been, again, looking at my screen enough to hallucinate pixies playing hop-scotch on my keyboard and the reason is my implementation for using deferred rendering techniques in my engine. I cannot for my life get the alternative, less expensive, way of calculating the pixel’s world position from depth no matter what I try. It’s quite obvious my inability to understand the different spaces is what’s hampering my progress.
So I started thinking… (Oh no!)
I made it clear a while back that none of the game-projects I’m working on now are big enough or complex enough to really make deferred rendering beneficial in the long run.
The only requirement I had was to not restrict my engine from using any number of lights, because realistically I didn’t picture my game turning on/off lights when unaccounted for lights(Gunfire, spells, short-term light-sources in general) would suddenly light the world.
My idea was to employ a technique similar to that of deferred rendering where I separate lighting and geometry. Though this is only a half-truth. What I do is to first render my geometry complete with sorting for alpha, all of the layers. After that I render that same geometrical information, only with light, into a off-screen buffer blending the results as I go.
After that I simply display that off-screen buffer as a fullscreen post processing effect blended onto the previously rendered geometry.
This is, of course, about a million times slower than deferred rendering but it requires less GPU memory to produce similar results, and the best of all (in my case, anyhow) is that I have technically unlimited lights at my disposal. They are limited by framerate though, as with any forward lighting technique.
This screenshot shows what this rendering technique is able to achieve. It looks a bit muddy because of my low-resolution normalmap and my super-intense gloss, but it does blend the lights nicely and that makes for a rather OK effect actually. It actually supports arbitrary ambient lighting too.
I haven’t delved too deep into this but I’m almost but certain I can throw together a half-decent rendering pipeline utilizing this way of rendering lighting. Shadows are still very much in debate. I’m sure I could pass all my shadowing as a single source shadow that’s generated from an arbitrary angle, since not many people are going to base their experience with the game on the lack of dynamic shadows for all sources of light (Otherwise I’m screwed no matter what I do.). There are trade-offs to be made, for sure.
It’s just a half-wit take on re imagining an old method. 🙂
(And oh. Maybe this has been done before a thousand times, but I haven’t seen such a thing made before so I guess it’s either too stupid to consider or too obscure.)
*Edit: I understand now why no one has done this successfully, haha! Blending the result makes each models backfaces shine through itself, which is completely understandable. So I’m back to regular forward rendering. 🙂 Let this be a lesson.