max
max
Returns the greater of two or more input values. For vectors, it performs a component-wise comparison. It's a fundamental tool for 'lighten' blending, ensuring numerical lower bounds, and combining shapes.
Core Advantages
Common Uses
Ensuring a numerical lower bound (e.g., in lighting)
'Lighten' blend mode
Procedural shape generation (SDF)
How to adjust
Control the result by changing the input values. For example, `max(noise, level)` acts like an adjustable water level; only parts of the noise texture brighter than `level` will 'surface', dynamically filtering or brightening the dark areas of an image.
Code Examples
1// Ensure diffuse light intensity is not negative
2const diffuse = max( dot( lightDir, normal ), 0.0 );