Deferred Rendering - [OpenGL / GLSL / C++]

Deferred Rendering – [OpenGL / GLSL / C++]

This project was done at GAMAGORA. It consist in coding the basis of a graphical engine using deferred rendering.

Lighting in a 3D real-time scene is a process that demand a huge quantity of resources.

Using Frame Buffer Object (FBO) in OpenGL, we can draw a scene in a texture from the light point of view ( or any camera ) that we can then use for further purposes. With this we can compute which point of the scene is not seen by the light camera, and so consider this point as being part of a shadow.

For example, this image has been realised thanks to 3 steps :

First step : rendering from the main camera
    We store in 3 textures :
– Positions of vertices
– Normals
– Colors

Second step : processing the light(s)
We’ll compute the diffuse and specular values, using the previously created textures. We don’t have to get information from the buffers anymore, because all is stored in the textures in the world coordinates.
The operation consists in creating a quad with the screen dimensions, and then place each textures on it. This quad represents, in some sort of way, a window on what the camera sees.

We’ll the compute a shadow map for each light that we’ll store in the FBO, then we’ll pass it to the shader computing the diffuse and specular (Pong).
We will have as many light textures as we have lights (logic).

Third step : Combining
We used the same Quad system and combine colors and lights textures in order to have the final result.