Capítulo 104 de 859

Chapter 104: ClusteredLightsNode

Core Idea

A custom version of LightsNode implementing Forward+ clustered shading: the view frustum is subdivided into a 3D grid of clusters (X × Y screen tiles times an exponentially-spaced set of Z depth slices), and each cluster holds only the point lights whose spheres intersect it. At shading time each fragment looks up its cluster and loops over just that cluster's lights. Unlike 2D tiled lighting, clustered shading culls lights that share screen pixels but lie at different depths — suitable for 3D scenes with real depth complexity.

Code Examples

import { clusteredLights } from 'three/addons/tsl/lighting/ClusteredLightsNode.js';
  • What it demonstrates: Typical usage of ClusteredLightsNode.

Reference Tables

Constructor

Signature
new ClusteredLightsNode( maxLights : number, tileSize : number, zSlices : number, maxLightsPerCluster : number )

Key Takeaways

  1. ClusteredLightsNode extends: EventDispatcher → Node → LightsNode

Connects To