Combining multiple PostEffects

Started by
3 comments, last by lipsryme 11 years, 9 months ago
I'm curious on how the correct way of applying them should work.

Do I input my final rendered image (before postfx) into the first posteffect and then output to a seperate image which is then the input of the next postEffect (like a chain) ?

Or do I reuse the final rendered image for every postEffect and then render the result to seperate images which I then combine (multiply) by each other in a final shader ?

How is this normally done ?

I realize that it might not work applying e.g. a blur onto an already blurred image from the posteffect before, so I'd rather do something like the second approach? Or is that the same =/ ?
Advertisement
depends on what you are trying to do, if you want flexibility a chain isn't ideal but if you do one at a time you end up with duplicated work.

I went for more of a graph-esque enabling me to plug any output into any input, that way you can reuse effects such as downsamples blurs luminance etc but only if needed.

However if you want PURE speed and you know what you want your end result to be you will want to combine as many steps as possible to reduce the number of passes.

With a graph you could analyse the structure and then flatten effect where possible, a bit more work but should give you the best of both.

Just my 2 pennies and I am sure there are better ways, but that has worked well for me.

Do I input my final rendered image (before postfx) into the first posteffect and then output to a seperate image which is then the input of the next postEffect (like a chain) ?

Or do I reuse the final rendered image for every postEffect and then render the result to seperate images which I then combine (multiply) by each other in a final shader ?

How is this normally done ?

It depends. Chains and composition of previous results are used both. It is more like a graph than a pure sequence, here's a simple example:
[source lang="cpp"]
geometry => lightning => apply shadow => apply bloom => apply SSAO => apply outlines
=> half resolution => blur =^
=> SSAO =^
[/source]
I started out with an effect chain, then decided that I want to work with two outputs separately and then combine them.

For example for a Depth of Field effect I needed two copies of the full color output. One to keep it as-is, and the other to pass it through a blur filter. Then I interpolate the blurred image and the original, unblurred image for a simple soft-focus DOF effect.

I had to make a helper "CopyShader" class for needing multiple copies of the same render target, because I cannot deep copy a RenderTarget in a straightforward manner in the API I'm currently using (XNA).

New game in progress: Project SeedWorld

My development blog: Electronic Meteor

Thanks for the insight :)

This topic is closed to new replies.

Advertisement