Original Post
I'm implementing post processing effects and I've come across a bit of a hurdle. I understand the principles of post processing effects, but I was wondering how typical rendering engines implement it. Do you render everything to the back buffer surface and then for each post process effect use the back buffer surface as a source and render to a temporary texture and then back to the back buffer surface? With such effects that require two passes, I understand you use an intermediate surface/texture and render to that in a flip/flop scenario but do you always have to do the render everything back to back buffer surface in order to either view it or pass it to the next post processing effect?
My system is fairly generic, so you can bolt on post processing effects at will, but I got a bit muddled with the flip flopping of surfaces - if effect A is a bright pass filter, that takes a source and a destination and has only one pass, but you obviously can't write to the same surface you read from so you need to render to a temporary surface in order to pass it on - but what if it's the last effect - do you always have to render from temporary surface A (or B in flip flopping) back to the back buffer surface?
Essentially I have this:
brightPassFilter->SetSource(backBufferTexture);
brightPassFilter->SetDestination(temporarySurfaceA);
brightPassFilter->Render();
blurFilter->SetSource(temporaryTextureA);
blurFilter->SetDestination(temporaryTextureB);
blurFilter->Render();
etc.
The problem with the above is that the blurFilter has two passes, horizontal and vertical which needs to render to 2 different surfaces, so should I be supplying two specific textures/surfaces as well as the source and destination? I don't want to create and use surfaces if I don't need to.
Any help or guidance would be greatly appreciated...
My system is fairly generic, so you can bolt on post processing effects at will, but I got a bit muddled with the flip flopping of surfaces - if effect A is a bright pass filter, that takes a source and a destination and has only one pass, but you obviously can't write to the same surface you read from so you need to render to a temporary surface in order to pass it on - but what if it's the last effect - do you always have to render from temporary surface A (or B in flip flopping) back to the back buffer surface?
Essentially I have this:
brightPassFilter->SetSource(backBufferTexture);
brightPassFilter->SetDestination(temporarySurfaceA);
brightPassFilter->Render();
blurFilter->SetSource(temporaryTextureA);
blurFilter->SetDestination(temporaryTextureB);
blurFilter->Render();
etc.
The problem with the above is that the blurFilter has two passes, horizontal and vertical which needs to render to 2 different surfaces, so should I be supplying two specific textures/surfaces as well as the source and destination? I don't want to create and use surfaces if I don't need to.
Any help or guidance would be greatly appreciated...