Wednesday, February 24, 2010
at
1:03 AM
|
I started working on our deferred lighting / light pre-pass / semi deferred / or whatever you wanna call it renderer. Right now, all it does is just generate the appropriate G-Buffer.
As simple as it looked, it wasn't so for me since our engine have pretty complex mix of custom materials. I had to restructure the way we sort our render queues to filter out unwanted meshes from the G-Buffer pass. One draw back of our current system was that our models consist of both shaded and unshaded materials; E.G. Buildings with holographic ads. The other was the AO boxing overlay that shares vertex buffer with the mesh that is being overlayed. So in the end, I had to hijack them away during the renderableQueued() callback stage. This method feels ugly though. Unfortunately, I can't think of any other way to solve this. Especially since the problem is mostly about filtering submeshes, so there's no way to use the visibility flag in Ogre.
Nevertheless, it's done and I'm beginning to see how to build this renderer in the most optimum way possible(in Ogre). I must admit that the reason why I am working on this now is all thanks to the Ogre dudes. Without the recent added features, I probably wouldn't be working on this now. So lemme give my thanks to Noman and dark_sylinc for making this possible. :) Oh, I should also thank Google too since they technically funded Ogre's compositor improvement.
As always, I like posting some graphics since I'm a graphics person. So, without further ado, here they are:
G-Buffer normal:
G-Buffer depth:
and since the depth buffer looked so strangely satisfying, here's two more just for kicks.
Don't you think they set the post-apocalyptic mood? :-)
As simple as it looked, it wasn't so for me since our engine have pretty complex mix of custom materials. I had to restructure the way we sort our render queues to filter out unwanted meshes from the G-Buffer pass. One draw back of our current system was that our models consist of both shaded and unshaded materials; E.G. Buildings with holographic ads. The other was the AO boxing overlay that shares vertex buffer with the mesh that is being overlayed. So in the end, I had to hijack them away during the renderableQueued() callback stage. This method feels ugly though. Unfortunately, I can't think of any other way to solve this. Especially since the problem is mostly about filtering submeshes, so there's no way to use the visibility flag in Ogre.
Nevertheless, it's done and I'm beginning to see how to build this renderer in the most optimum way possible(in Ogre). I must admit that the reason why I am working on this now is all thanks to the Ogre dudes. Without the recent added features, I probably wouldn't be working on this now. So lemme give my thanks to Noman and dark_sylinc for making this possible. :) Oh, I should also thank Google too since they technically funded Ogre's compositor improvement.
As always, I like posting some graphics since I'm a graphics person. So, without further ado, here they are:
G-Buffer normal:
G-Buffer depth:
and since the depth buffer looked so strangely satisfying, here's two more just for kicks.
Don't you think they set the post-apocalyptic mood? :-)
Posted by
Lf3T-Hn4D
10 comments:
Funnily enough, the depth buffer shots look a little like concept art sketches :)
Very nice! I´m wondering when we start to migrate our own project to deferred lighting...
Keep us posted! Every experience you share will be gladly received.
I like the depth buffer effect. It makes the game look foggy/creepy.
I like the way this game is looking.
Hehe, yeah. Feels like some sort of abstract creepy sci-fi game of sort. Haha.
@Mirko, definitely! I'll be posting the progress as I go along. ;-)
Hahaha, can we have a "depth-buffer" rendering mode in the final game?
Screenshots would look awesome. :D (Want to put as my background on my laptop!)
lol. We'll think about it. :-P
"Unfortunately, I can't think of any other way to solve this. Especially since the problem is mostly about filtering submeshes, so there's no way to use the visibility flag in Ogre."
The way I solved it in the deferred shading demo is by using material scheme techniques. Another way to signal to ogre "don't render this object" is to give it a material technique with zero passes.
You can create different schemes (for example : ToLightBuffer, FromLightBuffer and BypassLightBuffer ) and populate them accordingly (holographic ad only has bypass, etc).
You can then tell ogre to not render objects that don't have a material specified for the active scheme - check out NullSchemeHandler in the deferred shading demo.
Hope this helps!
Hmm.. ok. I've been using the scheme not found handler to add a default G-Buffer technique for any material with no G-Buffer scheme. This is because I have plenty of custom materials that are shaded using deferred lighting. So instead of manually editing all the materials one by one, this is much easier. :-P So now I'm doing it the reverse of your suggestion. I'm manually adding the no z-buffer scheme with a technique of zero passes for all objects that doesn't need shading. Looks cleaner now. :-) Thanks for the suggestion.
Maybe you could composite the depth texture onto the final scene, that would look great :)
I'm curious to know what format your gbuffer uses, if you don't mind sharing :)
Haha, hmm that would be an interesting mode. About my gbuffer, right now it's two MRT at PF_FLOAT16_GR PF_R8G8B8A8. First one is for depth and material ID. Second one is normal and spec value on alpha channel.
Post a Comment