shadowPositionWorld
A read-only node representing the vertex's world space position specifically during the shadow rendering pass. It ensures that vertex displacements applied via `material.positionNode` (like water waves) cast correctly shaped, dynamic shadows.
Core Advantages
Ensures advanced effects like vertex displacement can cast correct shadows, solving the common visual artifact where dynamic geometry casts a shadow of its original static shape.
Common Uses
Generating dynamic shadows for vertex displacement effects (e.g., water waves, fluttering flags).
Implementing custom shadow culling or clipping based on world space position.
Serving as a data source for debugging complex shadow artifacts (e.g., shadow acne).
How to adjust
This node is read-only; its value is determined by its upstream inputs. To adjust it, modify the logic connected to `material.positionNode`. For example, increasing the amplitude in the displacement logic (e.g., changing `mul(0.5)` to `mul(2.0)`) will cause both the object and its cast shadow to deform more dramatically.
Code Examples
1// Create a time-based displacement
2const displacement = vec3( 0, sin( timerLocal().mul( 2 ) ).mul( 0.5 ), 0 );
3
4// Apply the displacement to positionNode.
5// TSL ensures this modification affects shadowPositionWorld during the shadow pass.
6material.positionNode = positionLocal.add( displacement );