tangentGeometry
Provides access to the geometry's vertex tangent data within a TSL shader, which is crucial for advanced rendering techniques like normal mapping and anisotropic lighting.
Core Advantages
The node automatically checks for and computes missing tangent data (by calling `computeTangents()`), simplifying the development workflow and enhancing shader robustness by preventing rendering errors from missing tangent attributes.
Common Uses
Normal Mapping
Anisotropic Lighting
Flow Mapping
How to adjust
The value of `tangentGeometry` is determined by the geometry's 'tangent' attribute and cannot be adjusted directly in the shader. To change its effect, you must modify the source geometry data before rendering, such as by editing tangents in 3D software or programmatically setting the 'tangent' attribute in JavaScript.
Code Examples
1// Get the tangent direction (vec3)
2const tangentVec = tangentGeometry.xyz;
3
4// Visualize it as a color
5const vizColor = tangentVec.mul( 0.5 ).add( 0.5 );