dot
The dot product of two vectors.
dot(a: Val, b: Val): Expr
Import math from shaders/std and use math.dot.
With two unit vectors it is the cosine of the angle between them, which is how a light direction meets a surface normal.
Parameters
| Name | Type | Notes |
|---|---|---|
a | Val | |
b | Val |
Example
const facing = max(dot(normal, lightDir), 0)
See also
Used by
CarbonFiber, Crystal, Frost, Goo, Heatmap, Holographic, Irradiance, Nebula, PixelThrow, Plastic, ReactionDiffusion, Sparkle, TimeTrail, Voxels, Water