Implementing screen space reflections
Physically correct reflections involve tracing the path of light rays as they bounce off surfaces. This process accounts for the geometry, material properties, and light sources in the scene, as well as the view angle. However, it is a very computationally intensive process, often too demanding for real-time rendering, especially in complex scenes or on less powerful hardware. To achieve a balance between visual quality and performance, an approximation technique known as screen space reflection (SSR) can be used. SSR is a method that approximates reflections by reusing data that has already been rendered to the screen. By utilizing a screen-space variant, the heavy computational cost associated with physically correct reflections can be significantly reduced, making it a viable technique for real-time rendering. In this recipe, we will explain how to compute reflections using buffers derived from the previous section, such as the normal and depth...