HALF_PI
A high-precision float constant node equal to π/2 (≈ 1.5707963), commonly used for 90° angle and quarter-period phase work.
Core Advantages
Direct, zero-overhead access to the 90° radian value. Avoids repeating PI * 0.5 in graphs, improves readability and maintainability, and can be inlined at compile time.
Common Uses
Use 90° as a threshold, e.g., angle.greaterThan( HALF_PI ) for half-space clipping.
Apply a quarter-period phase shift to trig functions, e.g., sin(x + HALF_PI) equals cos(x).
Serve as a fixed boundary in polar/normal calculations, e.g., split [0, PI] into [0, HALF_PI] and [HALF_PI, PI].
Create 90° rotations or phase alignment in procedural patterns.
How to adjust
HALF_PI is a mathematical constant and should not be adjusted. If you need other fractions (e.g., π/4), create your own constant (e.g., float(Math.PI * 0.25)).
Code Examples
1// Shift the sine wave by 90°, remap to 0–1, and use it as color
2const wave = TSL.sin( uv().x.mul( TSL.PI2 ).add( TSL.HALF_PI ) );
3material.colorNode = vec3( wave.mul( 0.5 ).add( 0.5 ) );