mul
The `mul` node provides the standard implementation for the core multiplication operation in shaders. It's widely used in nearly all shader logic, like blending colors, applying textures, calculating lighting, and scaling vectors.
Core Advantages
Improves code readability via chainable syntax (`a.mul(b)`) and ensures type safety by intelligently handling operations between different data types. Its node-based nature allows for elegantly building complex calculation graphs (e.g., `color.mul(texture).mul(light)`).
Common Uses
Applying Textures & Blending Colors
Calculating Light Contribution
Controlling UV Tiling
Adjusting Effect Strength
How to adjust
Adjusting the numerical values input to the `mul` node directly scales its output. For example, increasing a multiplier for UV coordinates increases texture tiling density; multiplying a color by a dynamic float can create brightness pulsing or fade effects.
Code Examples
1// Multiply a base color with the color from a texture
2// This operation modulates or "tints" the texture pixel-by-pixel with the base color
3const finalColor = baseColor.mul( texture( myTexture, uv() ) );