Deferred Rendering - Rendering models with individual effects
I have read a few tutorials (Catalin Zima, TheCansin) regarding Deferred Rendering in XNA. They all seem to use a Deferred Rendering Pipeline for rendering the models. This is great, but they only deal with Normal and Specular maps.
If I have my thinking correct, if I wanted to render a model that has, for example, a glow effect in it and I have a glow shader, then the Deferred Rendering Pipeline won't know about this shader?
If my question above is correct, would I need to render the mode开发者_Python百科l with glow in the Deferred Rendering Pipeline and then re-render with the glow shader?
There are lots of different approaches really. My reccomendation would be to include a material mask pass in your pipeline. Eg: render a target that is just a solid colour for each type of surface you want to render in your scene. Use this mask target to perform branching operations in your final deferred lighting pass and make surface calculations for different materials ( for example, pure red for phong shading, pure blue for matte surfaces etc. ). You still use the diffuse, normals and specular gbuffer passes as normal.
Specifically for a glow effect, you can also use the mask approach and bring that target forward to your post-processing step, to perform a fullscreen blur / glow, using the the mask to determine which objects should have the glow applied.
精彩评论