Deferred Rendering

The act of storing all information needed for the lighting pass into textures so that one can defer the exspensive part of rendering, lighting, to a later draw call.

Deferred Rendering is a solution to one of the most expensive problems when lighting objects in real time, you frequently wind up overwriting your work. Thus an optimization was made, and like all optimizations it came at a steep price, a lot of storage. I can recall when a teacher told me that he thought that the depth buffer was a steep cost, that was just a float for every pixel, now imagine you had 10 more of them.

To perform deferred rendering as it is taught one must make textures to store all of one's lighting information into. I.E.: Position, Diffuse, Normals, Specular, Alpha. Then one would render to those textures the values for one's geometry. Then once your geometry passed is complete, then comes the lighting pass. One then renders a square that covers the entire ndc viewport, where one takes in all the textures and uses them to calculate the light on that frame. 

For my implementation I attempted to make it perform a reverse perspective projection matrix transformation, as we have the depth and the x,y position of the coordinate already and so with that we can obtain the position of our geometry that way. 

Deferred Buffers

Final Lighting Passes