inverseSqrt
Calculates the inverse square root (1/√x), a classic high-performance operation in graphics, primarily used for vector normalization.
Core Advantages
Its core value is converting the division in vector normalization into a more performant multiplication (`V * inverseSqrt(dot(V,V))`), boosting shader performance, especially when processing many vertices or pixels.
Common Uses
Normalizing normals in lighting calculations
Calculating light attenuation
Calculating direction vectors (e.g., view direction)
Procedural geometry effects
How to adjust
This node has no adjustable parameters; its effect is determined by its input `x`. Since the function's result is huge when `x` is near 0 and rapidly approaches 0 as `x` increases, it's often used to create glow or force field effects that emanate from a center point (where input is 0) and fall off very quickly.
Code Examples
1// Efficiently normalize vector V
2const normalizedV = V.mul( inverseSqrt( dot( V, V ) ) );