Hi everyone!
Some news about my exploration of possibilities with Deferred Shading. Last time, I've released my Terrain Material Generator specially made for Deferred Rendering (as per the Deferred sample). Today, I've been at a different kind of experiment: Cel Shading!
Thanks to the already computed depth buffer, we can sample the depth channel around each pixel and test if the "distance" between the few samples is higher than a threshold. If so, we consider it as an edge. The same thing applies for normals: above a certain threshold, it'll be considered as an edge.
For reference, I've been (ab)using this paper from Stefan Sperlhofer describing the technique along with a few code snippets. Translated into the actual Ogre deferred pipeline, the edge calculation is actually done in the ambient pass, because there are no other shader/pass that contains the whole GBuffer as a texture, beside the LightMaterial_ps itself. The issue with putting it in LightMaterial_ps is that even if the edge detection make the pixel black, this black value is added to the ambient value, making in the end a non-black edge (it will have ambient color). Unless I add another pass/material to the compositor, putting the edge detection in the ambient pass was the best I could do.
This rendering technique give a very Borderlands-ish looking to our game, and here are the mandatory screenshots proving it :
I'm unfortunately not going to give away our current code - mainly because I already tweaked a lot the code and it's looking pretty ugly But I'll be glad to help you if you're also implementing this technique based on Stefan Sperlhofer paper.
Cheers
Deferred Shading with Celshading
- Xplodwild
- Goblin
- Posts: 231
- Joined: Thu Feb 12, 2009 3:49 pm
- Location: France
- x 13
- Contact: