Post Process Engine Modification
Ok, a few days ago, i played with the post process engine Mahdi Khodadadi made.
It wasn’t totally fitting my needs, so I “think” i improved it a little bit. (Now, adding an effect is as simple as dropping it in the right folder, and making an advanced one is as simple as derivating the PostProcessEffect)
Today effects are : Color Tone, Combine, Gaussian Blur, Radial Blur, Smart Blur, Simple Blur, Tone Mapping, Bright Extract, Color Inverse, Edge Detection, Embossing, Sharpen, Night Time, Under Water, and differents Greyscale effects.
Here is what’s new :
*-Simples Effects can be loaded automatically, they just need to be in the right path.
*-For more sophisticated effects, just create the right .cs file, according to the ones i already made.
*-For advanced effects, simply define parameters as properties, and override what’s needed.
*-Effects are currently manager through a simple queue/dictionnary list, this will probably change in the future.
*-Viewports are recreated automatically when device lost/reset, RenderTargets too.
*-When drawing, only draw in the current viewport (should work for my splitted screen multiplayer game, although, i haven’t tested it yet) (Different effects for each players)
*-I changed the namespaces to reflect my current game architecture, and to best fit into my UML designer
*-Added some more effects from Glenn Wilson (Mykres)
*-Using a delegate for the drawing (almost all effects are using a delegate from the PostProcessManager, but a few overrides their begin/draw/end functions)
*-Can update needed variables for each effect, just overload the Update methods, default one will set any hlsl parameter whose name contains ‘timer’ to the current total second value.
Here the creation of the post process manager :
PostProcessManager ppm = new PostProcessManager(this, this.graphics.GraphicsDevice, this.content); this.Components.Add(ppm);
And here the code you need to put in update (the effect queue is flushed every frame)
ppm.AppliedEffects.Enqueue(ppm.EffectDictionary.Keys[currentEffectIndex]);
You can DOWNLOAD the library right here (Use space to change the current effect), change it as you want, but please give credits to Mahdi, Mykres and me.
(I left the .svn folder intentionally in the zip files, so you can update to the last version, I don’t promise the Queue and Dictionnary will last a long time.)