lightTargetPosition
In TSL, automatically provides the world-space position (vec3) of a specified light's `target` object (for DirectionalLight or SpotLight).
Core Advantages
It fully automates passing the light's target position to the shader. When combined with `lightPosition`, it makes calculating the direction of directional lights incredibly simple, without any manual uniform management.
Common Uses
Combined with `lightPosition` to calculate the direction of a DirectionalLight or SpotLight.
As a spatial 'focal point' to create visual effects that vary with distance to the target.
As an attractor or repulsor point for geometry deformation in the vertex shader.
For debugging by visualizing the target's position as a color to verify data transfer.
How to adjust
This node's value is not adjusted directly. It is controlled by manipulating the position of the associated light's `target` object in your JavaScript scene graph (e.g., by moving `myLight.target` or attaching it to another moving object).
Code Examples
1// Calculate the world-space direction vector from the target to the light source
2const worldSpaceLightDir = lightPosition( myLight ).sub( lightTargetPosition( myLight ) );