ClusteredLighting.html.md 1.8 KB

Inheritance: Lighting →

ClusteredLighting

A custom lighting implementation based on Forward+ Clustered Shading that overwrites the default lighting system in WebGPURenderer. Suitable for 3D scenes with many point lights and real depth complexity — the view frustum is partitioned into a 3D cluster grid so only the lights actually reaching each fragment are evaluated.

Code Example

const lighting = new ClusteredLighting();
renderer.lighting = lighting; // set lighting system

Import

ClusteredLighting is an addon, and must be imported explicitly, see Installation#Addons.

import { ClusteredLighting } from 'three/addons/lighting/ClusteredLighting.js';

Constructor

new ClusteredLighting( maxLights : number, tileSize : number, zSlices : number, maxLightsPerCluster : number )

Constructs a new clustered lighting system.

maxLights

Maximum number of point lights.

Default is 1024.

tileSize

Screen tile size in pixels (cluster XY size).

Default is 32.

zSlices

Number of exponential depth slices.

Default is 24.

maxLightsPerCluster

Per-cluster light-list capacity.

Default is 64.

Classes

ClusteredLighting

Methods

.createNode( lights : Array. ) : ClusteredLightsNode

Creates a new clustered lights node for the given array of lights.

This method is called internally by the renderer and must be overwritten by all custom lighting implementations.

lights

The lights.

Overrides: Lighting#createNode

Returns: The clustered lights node.

Source

examples/jsm/lighting/ClusteredLighting.js

粤ICP备19079148号