Skip to main content

fractal_noise

Function fractal_noise 

pub fn fractal_noise(
    base_frequency: (f32, f32),
    num_octaves: usize,
    seed: f32,
    tile_size: impl Into<Option<ISize>>,
) -> Option<RCHandle<SkShader>>
Expand description

Creates Perlin noise of the given type (fractal noise or turbulence — see self::turbulence()). Both base frequencies (X and Y) have a usual range of (0..1) and must be non-negative.

The number of octaves provided should be fairly small, with a limit of 255 enforced. Each octave doubles the frequency, so 10 octaves would produce noise from base_frequency * 1, * 2, * 4, …, * 512, which quickly yields insignificantly small periods and resembles regular unstructured noise rather than Perlin noise.

If tile_size is Some and not empty, the tile size parameter will be used to modify the frequencies so that the noise will be tileable for the given tile size. If tile_size is None or empty, the frequencies will be used as is without modification.