ceil
Rounds the input floating-point number (or each component of a vector) up to the smallest integer not less than it. It's used to convert smooth, continuous signals (like UVs or light intensity) into discrete, stepped values.
Core Advantages
By encapsulating a fundamental math operation into a concise, readable node, it greatly simplifies creating stepped, discontinuous visual effects (like cel-shading levels or procedural stripes) without leaving the TSL node system.
Common Uses
Cel-shading level transitions
Generating procedural stripes or grids
Stepped animation
How to adjust
Control the number of steps by adjusting the coefficient multiplied on the input. For example, in cel shading, `ceil(light.mul(3))` produces 3 brightness levels, while `ceil(light.mul(5))` produces 5 finer brightness levels.
Code Examples
1// Quantize smooth lighting (0-1) into 4 discrete levels
2const lightLevel = ceil( smoothLight.mul( 4.0 ) ).div( 4.0 );