This project is read-only.

New PostProcess Framework

Nov 12, 2010 at 1:31 PM

Hi all,I would like to re-create Nine Post Process framework and allow to extend it to allow next gen effect to be applied...My idea would be to allow creation of effects like HDR,Depth of Field,Bloom,SSAO,HeatVision,RadialBlur,GaussianBlur..
I would allow the user to automatically create post process chain with no need to worry about final report..Every post process stage would have its own RenderState (you can specify DepthState's,Stencil State's,BlendState) etc.

All post process stages can have access to BackBuffer Data..Sets of PostProcess Stage would create the final PostProcess chain..
So this is my roadmap.

1) Modify Nine to support main post process support (Decide to use ScreenEffects or new Effect framework for post process)

2) Create PostProcess State class with possibility to downsample RenderTargets, not only fullscreen RenderTargets 

3) Create a post process chain. (With Depth Of Field effect)

4) Add RenderState management to PostProcess States.

5) Add rest of effect (SSAO,HDR etc)

6) Allow photoshop like blending between PostProcess stages.


Tell me what you think about this.
Amer Koleci

Nov 13, 2010 at 2:20 AM
Edited Nov 13, 2010 at 3:26 AM

"Every post process stage would have its own RenderState (you can specify DepthState's,Stencil State's,BlendState) etc."
When do you need to set DepthState and Stencil State? Since post processing works on the result image space, it doesn't need to read or write to depth buffer. BlendState might be usable.

"All post process stages can have access to BackBuffer Data"
In the existing ScreenEffect implementation, the scene is rendered into a rendertarget that serves as the BackBuffer, the rendertarget is feeded to the postprocessing chain.
The current post processing chain is a list, but if you examine carefully, post processing should be a graph, it's not a tree since all stages will finally compose in a result texture.
Take Bloom for example, the root node has 2 edges, threshold effect will extract illumination data into a texture, while the other edge reserved the backbuffer to be blended later, these two edges combine into a single node in the end. So if we want to extract HDR or Bloom into smaller stages, a Graph based post processing chain might be needed.

"Create PostProcess State class with possibility to downsample RenderTargets"
We can have a special downsample and upsample node that create corresponding rendertargets.

"Add RenderState management to PostProcess States. Allow photoshop like blending between PostProcess stages."
If you use hardware blending, the possibility is limited to what BlendState can express, basically you can only to AlphaBlend, Add, Subtract, Multiply and invert stuff, but if you use shaders that's a different story. Most post processing effect seems to be sequecial, you take it input texture, add same color and translation effect, then produce the output texture to be used by the next effect. Only HDR and Bloom is a special case where they includes extract and combine. So I doubt if there are much usage for explicitly specify render state and blend state for each post processing state (or ScreenEffect graph node).

And in my opinion, HeatHaze, just like Underwater and Explosion, invisible models, are just special kinds of Distortion effect, so a single distortion effect with different distortors would be enough. And the ColorMatrixEffect can be extended to a lot of different style of effect that manipulates colors, e.g. blue shift, saturation.

Nov 13, 2010 at 2:21 PM

Maybe you can report modifiation to code of what you would like to be, after that i an create the effets you've just tell.

Nov 13, 2010 at 2:42 PM
Ok, you can first rename the current BlurEffect into DirectionalBlurEffect, and add a new BlurEffect that blurs the whole screen in one pass.

I'll make some change to ScreenEffect class to support more complicated chainning, but it won't affect existing shaders since every post processing screen effect is implemented as a standalone class that inherit Xna Effect class, By then, you should be able to implement HDR, bloom, Ambient Occlusion.

Thanks.