Multiple RenderTargets with a Final PostProcess
Hey, I am playing around with a SceneManager component I am working on and have been wondering how to do something. Right now I have a class called a RenderGroup which can render a collection of items to a RenderTarget and then Post Process the RT with an Effect. I want to take it one step further and have multiple RenderGroups(RenderTargets) and post process all of them one more final time. How is this possible? Can I grab the BackBuffer before rendering completes and run an effect on it or something? Do I put another RenderTarget in index 1 (instead of 0) or something?
Speaking of which, what is the multiple indices for when setting RenderTargets?
[670 byte] By [
jsedlak] at [2007-12-29]
What you probably want is to nest RenderGroups. You could have options controlling how it works.
For example, you could run a final post process over all the RT's, then add them to the backbuffer. Or perhaps you would want it to add them on top of the backbuffer first and then do the post process.
You can grab the backbuffer whenever you want with: device.ResolveBackBuffer(TargetTexture2D, RTIndex);
jsedlak wrote: |
Speaking of which, what is the multiple indices for when setting RenderTargets? |
|
Multiple render targets allows your pixel shader to output to more than one render target at the same time (using the COLORn pixel shader output semantics). For example you might write the usual colour output of the pixel shader to render target 0 and a calculated depth value to render target 1.
Currently XNA on the Xbox 360 only supports one render target at a time but many pc graphics cards support more. A common usage is in deferred rendering schemes where the pixel shader needs to output a lot of information (colour, normal, depth, etc.)
Cheers,
Leaf.