wavelet: Turbulent Fractal Noise
Fluid-like turbulence with controlled vorticity
Wavelet noise generates turbulent patterns through iterative rotation and sampling. Unlike standard fractal noise, wavelet introduces rotation matrices at each octave, creating fluid-like turbulence with controllable vorticity.
The function combines multiple scales through a rotation-based accumulation process:
where:
- represents input coordinates
- controls phase offset for animation
- determines frequency scaling between octaves
- applies rotation
- provides radial falloff
- normalizes the result
The rotation angle at each octave:
Function Variations
Function | Purpose | Parameters |
---|---|---|
wavelet(p, phase, k) | Full control | vec2 position, phase offset, frequency ratio |
waveletVec2(p) | Basic 2D | vec2 position only |
waveletVec2Phase(p, phase) | Animated 2D | vec2 position, phase for time |
waveletVec3(p) | 3D input | vec3 with z as phase |
waveletVec3K(p, k) | 3D with control | vec3 input, frequency control |
const fragment = () => { const pos = uv.mul(8) const turbulence = waveletVec2Phase(pos, iTime.mul(0.5)) const contours = turbulence.mul(12).sin().pow(2) return vec4(contours.mul(vec3(0.3, 0.6, 0.9)), 1) }
const fragment = () => { const grid = uv.mul(4) const w1 = wavelet(grid, iTime, 1.8) const w2 = wavelet(grid.add(vec2(10, 3)), iTime.mul(0.7), 2.1) const interference = w1.add(w2).abs() const bands = interference.mul(15).fract().step(0.3) const heat = vec3(bands.pow(3), bands.pow(1.5), bands) return vec4(heat, 1) }
Mathematical Properties
The wavelet function exhibits several key characteristics:
Rotation Matrix Application: Each octave applies a 2x2 rotation matrix:
Coordinate Transformation: The fractal iteration applies:
Frequency Progression: Scale factor evolves as where provides balanced octave spacing.
Radial Falloff: The smoothstep function creates circular falloff for each sample point, preventing harsh discontinuities.
Implementation Characteristics
Wavelet noise differs from Perlin or simplex noise through:
- Rotational Coupling: Each octave introduces rotation based on local random values
- Sinusoidal Basis: Uses sine waves instead of gradient interpolation
- Radial Weighting: Applies distance-based falloff at each sample
- Phase Control: Supports temporal animation through phase parameter
- Vorticity Generation: Rotation accumulation creates swirl patterns
The algorithm maintains bounded output range through normalization factor , ensuring consistent amplitude regardless of octave count.