loud
loud is a pure-Dart procedural noise toolkit for generating deterministic 1D/2D/3D noise and composing it into texture or terrain pipelines.
What This Project Does
This package gives you building blocks for procedural generation:
- Create seeded noise fields (value, Perlin, simplex, cellular, white, flat).
- Sample noise in 1D, 2D, or 3D (
noise1,noise2,noise3). - Chain modifiers (scale, octave, warp, exponent, output fitting).
- Apply interpolation filters (linear, hermite, cubic, starcast).
- Cache sampled planes with wrapping or mirrored coordinates.
- Use the included Flutter demo app (
loud_texture/) to render procedural materials.
Dart/SDK Compatibility
From pubspec.yaml:
- Dart SDK:
>=2.18.4 <3.0.0
Installation
dependencies:
loud: ^1.0.3
Then:
dart pub get
Quick Example
import 'package:loud/loud.dart';
import 'package:loud/util/double_cache.dart';
void main() {
final warpField = PerlinProvider(seed: 42).scale(0.02);
final terrain = SimplexProvider(seed: 1337)
.octave(5, 0.5)
.scale(0.01)
.warp(warpField, 0.02, 35.0)
.fit(0.0, 1.0);
final cached = terrain.cached(
width: 1024,
height: 1024,
coordinatePlane: CacheCoordinatePlane.mirrored,
lazy: true,
);
print(cached.noise2(128, 256));
}
Features
Noise Generators
WhiteProvider(seed: ...)- Deterministic hash-based white noise.
FlatProvider(seed: ...)- Constant output (
1.0) field.
- Constant output (
ValueLinearProvider(seed: ...)- Value noise with linear interpolation.
ValueHermiteProvider(seed: ...)- Value noise with hermite smoothing.
PerlinProvider(seed: ...)- Gradient Perlin-style noise.
SimplexProvider(seed: ...)- 3D simplex-style noise (1D/2D calls route through 3D sampling).
CellularProvider(seed: ...)- Worley/cellular nearest-cell value selection.
CellularHeightProvider(seed: ...)- Cellular edge distance style output (
distance2 - distance - 1).
- Cellular edge distance style output (
Composition and Modifiers (Chainable on NoisePlane)
scale(double scale)- Scales input coordinates.
octave(int octaves, double gain)- Layered/fractal accumulation of the same generator.
warp(NoisePlane warp, double scale, double multiplier)- Domain warping using another noise plane.
fit(double min, double max)- Remaps output range.
exponent(double exponent)- Applies power curve to outputs.
cellularize(int seed)- Samples your current generator via nearest cellular points.
Interpolation Filters
linear(double scale)- Linear interpolation upsampling.
hermite(double scale)- Hermite interpolation upsampling.
cubic(double scale)- Cubic interpolation upsampling.
starcast(double scale, double checks)- Radial sample averaging with configurable sample count.
starcast9(double scale)- Convenience starcast with 9 checks.
Caching and Performance Helpers
cached({width, height, coordinatePlane, lazy, initialValue})- Caches
noise2values in a 2D array. - Supports:
CacheCoordinatePlane.normalCacheCoordinatePlane.mirrored
lazy: falseprecomputes cache.lazy: truecomputes on demand.
- Caches
benchmark(String name, double ms)- Prints approximate sampling throughput for 1D/2D/3D.
Core API Shape
noise1(double x)noise2(double x, double y)noise3(double x, double y, double z)getMinOutput()/getMaxOutput()
Exported Types
The package exports:
- Interpolators:
LinearInterpolator,HermiteInterpolator,CubicInterpolator,StarcastInterpolator - Core:
NoisePlane,NoisePlaneProvider - Providers:
CellularProvider,CellularHeightProvider,Cellularizer,ExponentProvider,FittedProvider,FlatProvider,OctaveProvider,PerlinProvider,ScaledProvider,SeededProvider,SimplexProvider,ValueHermiteProvider,ValueLinearProvider,WarpedProvider,WhiteProvider
Demo App
loud_texture/ is a Flutter example project that uses loud to render animated procedural materials like stone, cobblestone, sandstone, and dirt.
License
GPL-3.0 (see LICENSE).
Libraries
- interpolator/cubic
- interpolator/hermite
- interpolator/interpolator
- interpolator/linear
- interpolator/starcast
- loud
- noise/noise_plane
- noise/noise_plane_provider
- noise/provider/cache
- noise/provider/cellular
- noise/provider/cellular_height
- noise/provider/cellularizer
- noise/provider/exponent
- noise/provider/fitted
- noise/provider/flat
- noise/provider/octave
- noise/provider/perlin
- noise/provider/scaled
- noise/provider/seeded
- noise/provider/simplex
- noise/provider/value_hermite
- noise/provider/value_linear
- noise/provider/warped
- noise/provider/white
- util/compiled_starcast
- util/double_cache
- util/magic