mx_ramptb
mx_ramptb
A function node for creating a vertical (top-to-bottom) linear gradient between two values, such as colors or floats.
Core Advantages
Simplifies gradient logic with a descriptive name (Ramp Top to Bottom), and is fully procedural, requiring no textures, which provides infinite resolution and creative flexibility.
Common Uses
Simulating sky or horizon gradients.
Creating liquid fill or vertical progress bar effects when used as a mask.
Implementing world-height-based shading, such as for snow on mountains.
How to adjust
Reverse the gradient's direction by swapping the `valuet` and `valueb` inputs; scale the gradient area by manipulating the `y` component of the `texcoord` input; or use world-space inputs like `positionWorld.y` to achieve height-based effects.
Code Examples
1
2// Define the top and bottom colors for the gradient
3const topColor = color( 0x87CEEB ); // Sky Blue
4const bottomColor = color( 0x00008B ); // Dark Blue
5
6// Create a vertical gradient from top (sky) to bottom (dark)
7const rampNode = mx_ramptb( topColor, bottomColor );
8