acos
A math node that wraps the GLSL `acos()` (arccosine) function. It takes a cosine value in the range [-1, 1] (typically from a dot product) and returns the corresponding angle in radians [0, π].
Core Advantages
Provides the core, high-performance ability to directly calculate the actual angle between two vectors from their dot product. It is a fundamental building block for advanced geometric queries and procedural effects like custom rim lighting or programmatic spotlights, which would be otherwise extremely difficult to implement.
Common Uses
Creating custom Fresnel or rim light effects with sharp falloffs by precisely calculating the angle between the normal and view vectors.
Implementing procedural spotlights or cones of vision by checking if the angle to a point is within a defined threshold.
Driving procedural 'look-at' animations by calculating the angle between an object's current orientation and a target direction.
Generating angular procedural patterns like radar sweeps or gauges as part of a polar coordinate conversion.
How to adjust
This node itself is not configurable. The effect is entirely controlled by its input value, which is typically the dot product of two unit vectors. Changing the relative orientation of these input vectors directly alters the angle output by `acos`, thus adjusting geometric conditions like the size of a spotlight cone or the trigger angle for a rim light.
Code Examples
1 // Calculate the dot product between the light's direction and the pixel's direction
2 const dotProduct = dot( lightDirection, pixelDirection );
3
4 // Get the actual angle in radians using acos
5 const angle = acos( dotProduct );
6
7 // If the angle is less than the cone's half-angle, the pixel is lit
8 const spotlightFactor = step( angle, coneAngle );