lightProjectionUV
A function node that calculates the corresponding UV coordinates on a given light's (typically a SpotLight) projection texture for a point in world space, essential for creating projector effects.
Core Advantages
It encapsulates complex projection matrix calculations into a simple function and seamlessly integrates with scene light objects, allowing developers to easily create dynamic projective texturing effects without handling the underlying linear algebra.
Common Uses
Implementing Gobo/projector effects, such as projecting a logo onto a wall.
Using Cookie Maps to shape light and simulate dappled lighting patterns.
Creating cheap, decal-like fake shadows (Blob Shadows).
How to adjust
The effect of this node is adjusted by modifying the properties of the `light` object passed as a parameter in JavaScript. For example, changing `spotLight.position` moves the projected pattern, while changing `spotLight.angle` scales the pattern, similar to adjusting a zoom lens.
Code Examples
1
2// Get the projection UV by passing in the scene's SpotLight object
3const projectionUV = lightProjectionUV( spotLight );
4
5// Use the resulting UV to sample the projection texture
6const projectedColor = texture( projectorMap ).uv( projectionUV.xy );
7