tangentLocal
tangentLocal
Provides the 3D tangent vector (vec3) in the model's local space, commonly used for normal mapping and anisotropic lighting calculations.
Core Advantages
Simplifies shader code and improves readability by providing a semantically clear node to access the local tangent, avoiding manual extraction of `tangentGeometry.xyz`.
Common Uses
Building the TBN matrix for normal mapping
Displacing vertices along the model's surface direction
Providing the direction for anisotropic lighting (e.g., brushed metal)
How to adjust
This node's value is determined by the geometry's `tangent` attribute. Adjust it by calling `geometry.computeTangents()` in JavaScript or by manually setting the `geometry.attributes.tangent`.
Code Examples
1// Directly get the local space tangent vector (vec3)
2const localTangent = tangentLocal;
3
4// Convert it to a color for visualization
5const color = localTangent.mul( 0.5 ).add( 0.5 );
6
7return color;