NuroDev / vision

⚗️ An experimental graphics research engine
MIT License
2 stars 0 forks source link

Deferred Shading/Rendering #1

Open NuroDev opened 4 years ago

NuroDev commented 4 years ago

LearnOpenGL breaks it down very well.

Deferred shading or deferred rendering aims to overcome these issues by drastically changing the way we render objects. This gives us several new options to significantly optimize scenes with large numbers of lights, allowing us to render hundreds (or even thousands) of lights with an acceptable framerate. The following image is a scene with 1847 point lights rendered with deferred shading (image courtesy of Hannes Nevalainen); something that wouldn't be possible with forward rendering.

The way deferred shading, also known as deferred rendering, works by modifying the render pipeline into 2 stages. The first stage, known as the geometry pass will render all the scenes geometric data, such as position data, color/diffuse/albedo data, normals, specular data, etc, and store it in a collection textures called a GBuffer. This GBuffer is then handed over to the second stage, known as the lighting pass, where the lighting for the scene is calculated using the GBuffer data.

However, this technique does come with some limitations. Such as transparency/depth issues. As such there are other techniques that combine the standard forward rendering pipeline with deferred shading/rendering.

One such technique is often known as deferred lighting. This adds a 3rd stage to the deferred rendering pipeline that incorperates material properties and combines them with the output from the second stage lighting pass.

The diagrams below, provided by both LearnOpenGL & Apple help show the pipeline used to achieve deferred shading/rendering and deferred lighting

Deferred shading/rendering

Deferred lighting

NuroDev commented 4 years ago

Work on this feature had already begun prior to the projects initial unveiling but still requires some work in order to before it is ready to be used. Further research into how to correctly incorporate the feature into Vision needs to be explored further.

Could be worth researching some existing DirectX based projects on GitHub to see how they incorporate deferred shading. Some examples: