parallaxDirection
Calculates the view direction vector in tangent space. It's the fundamental node for creating parallax depth illusions (e.g., bumpy brick walls) on flat surfaces.
Core Advantages
Encapsulates the complex coordinate transformation (view direction to tangent space) into a single node, serving as the cornerstone for advanced shading techniques like Parallax Mapping and POM, which dramatically enhance material detail without adding geometry.
Common Uses
Standard Parallax Mapping
Parallax Occlusion Mapping (POM)
Anisotropic Highlights
How to adjust
This node has no parameters itself. The effect is adjusted via a `parallaxScale` float, which scales the UV offset generated from `parallaxDirection`. Increasing `parallaxScale` enhances the depth illusion but can cause artifacts; a negative value inverts the effect, turning bumps into dents.
Code Examples
1// Sample depth from the height map
2const heightValue = texture( heightMap, uv() ).r;
3
4// Calculate UV offset using the view direction in tangent space
5const uvOffset = parallaxDirection.xy.mul( heightValue ).mul( parallaxScale );
6
7// Apply the offset to the original UVs
8const parallaxUV = uv().sub( uvOffset );