pointShadow
The pointShadow node encapsulates the complex cube shadow map logic for creating omnidirectional real-time shadows from a PointLight. It returns a shadow factor from 0.0 to 1.0, allowing developers to easily implement high-quality point light shadows in TSL as if calling a simple function.
Core Advantages
It reduces the difficulty of creating realistic point light shadows from writing dozens of complex GLSL lines to calling a single node. Users don't need to worry about underlying details like cube maps or coordinate transformations, and it integrates seamlessly with the standard Three.js workflow.
Common Uses
Simulating indoor or local lighting (e.g., light bulbs, candles, bonfires)
Creating real-time shadows in dynamic and interactive environments (e.g., a character holding a lantern)
Serving as a basic occlusion data source to drive stylized or artistic shadow effects
How to adjust
The node's effect is adjusted entirely by configuring the `.shadow` property of its associated `THREE.PointLight` object in JavaScript. Key properties include: `shadow.bias` to fix shadow acne, `shadow.radius` to create soft shadow edges, and `shadow.mapSize` to control the shadow map's resolution, balancing quality and performance.
Code Examples
1const shadowFactor = pointShadow( pointLight );
2
3// Multiply the color by the shadow factor to apply the shadow
4material.colorNode = baseColor.mul( shadowFactor );