views:

42

answers:

2

I have been thinking about how to implement a PostProcessing manager into my engine (Vanquish).

I am struggling to get my head around how a Post Processing technique works. I have read and viewed the Post Processing sample on the creators.xna.com webiste, but this seems to re-render the model applying the Post Processing effect.

I can add this functionality for static models, but when it comes to redrawing the Skinned Models, I then get confused as they already have their own techniques to their effects.

Can someone help me straighten my thoughts by pointing me in the right direction?

A: 

Generally post-processing works over the entire screen. This is pretty simple, really.

What you do is set a render target on the device (I assume you can figure out how to create a render target from the sample):

GraphicsDevice.SetRenderTarget(renderTarget);

From this point onward everything you render will be rendered to that render target. When you're done you can set the device back to drawing to the back buffer:

GraphicsDevice.SetRenderTarget(null);

And finally you can draw using your render target as if it were a texture (this is new in XNA 4.0, in XNA 3.1 you had to call GetTexture on it).

So to making a post-processing effect:

  • Render your scene to a render target
  • Switch back to the back buffer
  • Render your render target full screen (using SpriteBatch will do) with a pixel shader that will apply your post-processing effect.

You sound like you want to do this per model? Which seems kind of strange but certianly possible. Simply ensure your render target has a transparent alpha channel to begin with, and then draw it with alpha blending.

Or do you not mean post-processing at all? Do you actually wish to change the pixel shader the model is drawn with, while keeping the skinned model vertex shader?

Andrew Russell
This is great information. I'm not wanting to do it on a per model basis, this is exactly what I am trying to get away from :o)
Ardman
+4  A: 

@Andrew Russell: Thanks for your information and assistance. I did find this link which hit the nail on the head.

Ardman