mx_unifiednoise2d
A unified 2D noise node. Switch noiseType to select Perlin (0) / Cell (1) / Worley (2, Euclidean metric) / Fractal fBm (3). The input is computed as p = texcoord * freq + offset, then remapped to [outmin, outmax] and optionally clamped. Returns a float.
Core Advantages
One node covers multiple classic noise types and includes built-in range remapping/clamping and parameter normalization (frequency/offset/jitter/fractal levels). Makes it easy to switch and compare different noise types within the same material.
Common Uses
Procedural textures/masks (stains, fog, marble)
Fractal detail for terrain/water surfaces (fBm)
Cell/Worley style organic patterns and edge-expansion masks
UV-based de-tiling and randomization
How to adjust
Key parameters: noiseType (0/1/2/3) to switch type; freq (default 1,1) controls pattern density; offset translates the pattern; jitter (0-1) applies only to Worley; outmin/outmax remap the range; clampoutput clamps the output; octaves/lacunarity/diminish apply only to fBm. Recommendations: increase freq to add detail; for fBm, common settings are octaves = 4–6, lacunarity ≈ 2, diminish ≈ 0.5.
Code Examples
1// Perlin: base grayscale noise
2const n0 = mx_unifiednoise2d( int(0), uv(), vec2(4.0), vec2(0.0), 1.0, 0.0, 1.0, false, 1, 2.0, 0.5 );
3material.emissiveNode = vec3( n0 );
4
5// Worley: adjust jitter and clamp output
6const n2 = mx_unifiednoise2d( int(2), uv(), vec2(10.0), vec2(0.0), 0.8, 0.0, 1.0, true, 1, 2.0, 0.5 );
7
8// Fractal fBm: multiple octaves
9const n3 = mx_unifiednoise2d( int(3), uv(), vec2(2.0,3.0), vec2(0.1, 0.0), 1.0, 0.0, 1.0, false, 5, 2.0, 0.5 );
10material.colorNode = mix( color(0x223344), color(0xffffff), n3 );