Conversation
Partitions the view frustum into a 3D cluster grid (screen tiles × exponential depth slices) so each fragment only evaluates the point lights whose spheres intersect its cluster. Suitable for 3D scenes with many point lights and real depth complexity, where the existing 2D `TiledLighting` drops lights that share screen pixels at different depths. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
What's the difference to the existing https://threejs.org/examples/webgpu_lights_tiled IMO, we should only provide a single Forward+ implementation otherwise it becomes confusing. We should either replace |
Tiled and Clustered shading reduce the lighting processing in the fragment shader because, instead of calculating all lights in the scene, we only calculate the lights associated with a specific tile or cluster. The main difference, in short, is that tiled shading is based only on the 2d-screen dividing in tiles, while clustered also considers depth by creating z-slices, the lights matching should be more accurate for clustered for this reason.
One of the reasons for the performance issue is the light distance (range) in the example. Reducing the distance should improve it, no have sure if it is enough, but considering that we can have up to 64 lights per cluster, which is quite a lot if they are all included in the same cluster. If put the The artifacts are probably related to this as well. If we have many lights included in the same cluster, it could exceed the limits, and some lights may be missing from that cluster. It seems there is a bug when I resize the window. |
I think we can remove I improved the debug adding support for z-slice.
|




Description
Adds a
ClusteredLightingaddon that partitions the view frustum into a 3D cluster grid (screen tiles × exponential depth slices). A compute pass builds a per-cluster light list via sphere-vs-AABB tests; the material-side lookup only evaluates lights that actually reach the fragment.Defaults: 32 px tiles, 24 depth slices, 64 lights per cluster, 1024 max lights.
https://raw.githack.com/mrdoob/three.js/clustered/examples/webgpu_lights_clustered.html
@sunag Any interest on following/finishing this?