tangentView
tangentView
Provides the tangent direction of a model's surface in view space (camera space), primarily used for view-dependent lighting calculations.
Core Advantages
Encapsulates complex matrix transformations, allowing developers to directly perform advanced calculations like anisotropic lighting in view space, greatly simplifying shader logic.
Common Uses
Anisotropic lighting (e.g., brushed metal, hair)
Parallax Occlusion Mapping
Stylized rendering (e.g., velvet effect)
How to adjust
This node's value is determined by the camera and object's position and orientation. Adjust its effect by moving the camera or rotating the object in the animation loop, or by modifying the geometry's `tangent` attribute in JavaScript before rendering.
Code Examples
1// Directly get the view-space tangent vector (vec3), which is already normalized
2const viewTangent = tangentView;
3
4// Convert the vector from the [-1, 1] range to the displayable [0, 1] color range
5const color = viewTangent.mul( 0.5 ).add( 0.5 );
6
7// Output the converted color
8return color;