Implementing G-buffer for deferred rendering
Deferred rendering is a technique that adds an additional render pass at the beginning of the scene rendering that accumulates various information about the scene in screen space, such as position, surface normal, surface color, and others. This extra information is stored in a buffer called the geometry buffer (G-buffer), where each one of the values computed during this step is stored for each pixel. Once this initial pass has finished, the final scene rendering can take place, and the extra information to improve the rendering quality by computing things such as reflections, ambient occlusion, atmospheric effects, and others can be used. The benefit of using deferred rendering is that it provides more efficient handling of complex scenes with many lights, as each light only needs to be calculated once per pixel, rather than once per object. We have essentially decoupled geometry and shading, which allows for more flexibility in the rendering...