Sunday, September 22, 2013

Post-processing added

After some big refactoring made in Gine, I started to play with shaders.

It's not my first time of course, but I'm trying to standarize fx file loading and usage. Another time - make it user friendly.

My first goal was to make a very simple greyscale post-processing effect. Now it looks like that:


Supersimple pixel shader goes like:
Notice the usage of a gTransition float. Yeah! I made smoot transitions as well and I must say it looks exactly as it should ;)

The next step was to blur the background at a pause stage:


The thing was tricky - Gaussian blur needs two passes to work in an optimal way. So after adding a backbuffer render target view, I had to add another and swap them in meantime. Geez, it's so unnecessarily complicated at that level.

I'm happy that main rendering loop looks like that:
And when you want to enable or disable the effect: