mx_invert
mx_invert
Returns amount − in1 with default amount = 1. MaterialX‑compatible invert/mirror for floats, vectors, and colors.
Core Advantages
One‑liner for negative color or pivoted mirroring with implicit type matching. Clearer and safer than inlining sub(amount, in1).
Common Uses
Negative color: 1 − color or vec3(1) − color.
Flip masks or weights for blends/dissolves.
Glossiness from roughness: gloss = 1 − roughness.
Mirror around a custom pivot p by setting amount = 2p (scalar or vector).
How to adjust
Tune amount to set the mirror pivot. amount = 1/vec3(1) gives classic inversion; use amount = 2p to mirror around pivot p. If the input is not in [0,1], clamp or remap to normalize.
Code Examples
1// Negative: 1 − texture color
2material.colorNode = mx_invert( texture( baseMap ).rgb );
3
4// Flip a mask
5const mask = texture( maskMap ).r;
6const inv = mx_invert( mask );
7material.emissiveNode = vec3( inv );
8
9// Glossiness = 1 − roughness
10const rough = texture( roughnessMap ).r;
11material.clearcoatRoughnessNode = mx_invert( rough );