mx_ifgreatereq
mx_ifgreatereq
MaterialX‑style conditional selector: return in1 when value1 ≥ value2, otherwise in2; implemented as value1.greaterThanEqual(value2).mix(in1, in2).
Core Advantages
Expresses a threshold branch with a single node—no explicit if/cond; supports scalar and vector per‑component selection and maps to efficient GPU boolean/mix ops.
Common Uses
Hard switch between two looks by height/normal (e.g., ground vs. snow).
Thresholding a mask/noise to gate layered materials or regions.
Use of ≥ for more stable comparisons around the boundary.
How to adjust
Raise/lower value2 to move the threshold; replace in1/in2 with textures or full node graphs to switch entire looks. If you need strict “>” instead of “≥”, use mx_ifgreater (if available) or compose value1.greaterThan(value2).mix(in1, in2).
Code Examples
1
2<Canvas>
3 <mesh>
4 <sphereGeometry args={[0.5, 64, 64]} />
5 <meshStandardNodeMaterial
6 // use warm color when y ≥ 0, else cool color
7 colorNode={mx_ifgreatereq(
8 positionWorld.y,
9 float(0.0),
10 color(0xff8844),
11 color(0x4488ff)
12 )}
13 />
14 </mesh>
15</Canvas>
16