Skip to content

Commit 0cd46de

Browse files
authored
Clustered Deferred Readme
1 parent dc720a9 commit 0cd46de

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,24 @@ Using a compute shader, the renderer figures out which lights actually affect ea
3434

3535
### Clustered Deferred Rendering
3636

37+
Clustered Deferred Shading extends the Forward+ approach by performing lighting in a deferred fullscreen pass rather than during geometry rendering. The screen is divided into a 3D grid of clusters using a 16×9 screen-space tiling combined with logarithmic Z-slicing through the camera’s view frustum. These depth slices provide finer resolution near the camera, where geometry and lights are denser, and coarser slices farther away.
38+
39+
In the first stage, called the G-buffer pass, the renderer outputs several textures that store geometric and material information for each visible pixel. The albedo, position (depth), and normals are saved as textures shown below:
40+
41+
![Albedo](img/alebdo.png)
42+
![normals](img/normal.png)
43+
![pos](img/positon.png)
44+
45+
During the second stage, the fullscreen lighting pass, a quad covers the entire screen and performs lighting using the data stored in the G-buffer. For each pixel, the fragment shader determines which cluster the fragment belongs to based on its screen coordinates and view-space depth, retrieves the list of lights affecting that cluster, and accumulates their contributions using the G-buffer position and normal.
46+
47+
Because of the added Z-slicing, each pixel only considers lights that intersect its actual depth range rather than all lights visible in its 2D screen tile. This greatly improves culling precision and keeps performance consistent even with thousands of lights distributed throughout the scene.
48+
49+
Clustered Deferred Shading effectively decouples lighting cost from scene complexity, allowing large numbers of dynamic lights while maintaining physically consistent results and stable frame rates.
50+
3751
## Performance Analysis
3852

53+
54+
3955
### Credits
4056

4157
- [Vite](https://vitejs.dev/)

0 commit comments

Comments
 (0)