mx_worley_noise_vec2
An advanced cellular noise generator that returns the distances to both the nearest (F1) and second-nearest (F2) feature points, specialized for creating sharp cellular boundary (Voronoi) patterns.
Core Advantages
By providing both F1 and F2 distance values, it enables the calculation of their difference (F2 - F1), which is the key to generating advanced structures like precisely controlled cell walls, cracks, or veins.
Common Uses
Generating Voronoi patterns or thick cell walls
Simulating cracked mud or fractured stone
Creating biological leaf veins or vessel networks
How to adjust
The core usage is to calculate the difference between the output `vec2`'s y and x components (`F2 - F1`) to get the boundaries. The `metric` parameter (0=circular, 1=diamond) can change the basic cell shape. The `jitter` parameter controls cell randomness. Applying `smoothstep` to the `F2 - F1` result is a common technique to control the thickness of the boundary lines.
Code Examples
1// Calculate the difference between F2 and F1, the core of Voronoi patterns
2const distances = mx_worley_noise_vec2( uv().mul(8) );
3const voronoi = distances.y.sub( distances.x );
4
5// Use smoothstep to sharpen the boundary lines
6const lines = smoothstep( 0.01, 0.03, voronoi );