voronoise: Parametric Voronoi-Noise Hybrid
Controllable transition between cellular patterns and smooth noise
Voronoise generates textures that interpolate between Voronoi cellular patterns and smooth noise based on control parameters. The function produces weighted cellular structures where parameter controls randomness displacement and parameter governs the transition between sharp cellular boundaries and smooth noise characteristics.
The mathematical foundation uses weighted distance fields within a grid sampling approach. For each grid cell, random offset vectors are generated and combined with distance calculations to produce weighted contributions:
where determines the sharpness of the transition, and represents the offset distance from grid positions.
The final value is computed as a weighted average:
where represents the z-component of random offset vectors used as height values.
Parameter scales the random displacement within each cell, affecting the randomness of cell positions. When , cells align to regular grid positions. As increases, cells become more randomly displaced.
Parameter controls the blend between cellular and noise characteristics. At , the function produces sharp Voronoi cellular patterns with distinct boundaries. At , the output becomes smooth noise-like with gradual transitions between regions.
const fragment = () => { const p = uv.mul(8) const noise1 = voronoise(p, iTime.sin(), 0.3) const noise2 = voronoise(p, 1, 0.7) const pattern = vec3(noise1, noise2, noise1.mul(noise2)) return vec4(pattern, 1) }