sabato 11 novembre 2017

Day 198: Post Processor

In the last few days I've been studying some rendering techniques, and a few of them were basically full-screen post processing effects (for example, screen-space reflections). So I decided to implement a versatile post processor for the engine, as it is fairly easy to do, and will allow me to test some of the aforementioned techniques.

I added a pass to the rendering pipeline, and also I needed to add another texture in the FBO. This is because now I will need two textures to use alternately when applying post processing techniques.
The shader used for this pass uses a structure to hold all the most important data sampled from the screen. The struct is filled directly in the shader with a function that will be available to every post processing shader. Colors, normals, depth, position and so on will be available easily and immediately. If information of adjacent pixels are needed, they'll have to be calculated manually.
An awful amount of time was pent tracking down a bug that would cause a black screen. In the end, I didn't specify a filtering option for the two new textures, and OpenGL refused to assume a default value.
My goal for the following days, is to create a PostProcess manager, in which the user can add and sort techniques.

In the picture, a simple post proces effect to invert the color of the image.



Nessun commento:

Posta un commento