API reference

aster_blueprint::noise

Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.

Deterministic, seeded procedural noise kernels (pure Rust, no dependencies).

Every kernel is built from integer hashing (u32 wrapping arithmetic) and f64 addition, subtraction, multiplication, division, floor, abs and sqrt. IEEE-754 requires those operations to be correctly rounded or exact, Rust never fuses a * b + c into an FMA, and no libm function whose last bit differs between platforms (sin, cos, exp, powf, ...) is used anywhere. Gradient tables are literal constants. The same (seed, coordinates) therefore produce bit-identical results on every platform and every build profile; the golden values in tests/noise.rs compare f64::to_bits.

  • seed selects an independent noise field; any u32.
  • Signed kernels (value, perlin, simplex, fbm, warp) return about -1..=1 and are clamped into that range.
  • ridged, turbulence and the cellular distances return 0..=1.
  • Coordinates are in lattice units (one feature per unit). Multiply by a frequency before calling; x, y, z are saturated to the i32 lattice, so keep magnitudes below about 2e9.
  • The third axis of the *3 kernels is meant to be time.

Structs

structaster_blueprint::noise::Fractal

pub struct Fractal { /* see fields */ }

Octave controls shared by the fractal kernels.

Public fields

fieldtype
octavesu32Layers summed, 1..=[MAX_OCTAVES].
lacunarityf64Frequency multiplier per octave (1..=8, usually 2).
gainf64Amplitude multiplier per octave (0..=2, usually 0.5).

Trait implementations: Clone, Copy, Debug, Default, PartialEq, StructuralPartialEq

Enums

enumaster_blueprint::noise::Base

pub enum Base { Value, Perlin, Simplex }

The lattice noise a fractal is built from.

Variants

  • Value
  • Perlin
  • Simplex

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

enumaster_blueprint::noise::CellMode

pub enum CellMode { F1, F2, Edges }

Which cellular quantity to report.

Variants

  • F1 — Distance to the nearest feature point (soft blobs, dark at the points).
  • F2 — Distance to the second-nearest point.
  • Edges — F2 - F1: bright ridges along cell borders (cracks, cells, veins).

Trait implementations: Clone, Copy, Debug, Eq, PartialEq, StructuralPartialEq

Functions

fnaster_blueprint::noise::base3

pub fn base3(base: Base, seed: u32, p: [f64; 3]) -> f64

One sample of base in 3D (-1..=1).

fnaster_blueprint::noise::cellular2

pub fn cellular2(seed: u32, x: f64, y: f64, jitter: f64) -> (f64, f64)

Cellular (Worley) noise: Euclidean distance to the nearest (f1) and second-nearest (f2) feature point, in lattice units. jitter (0..=1) scales how far points stray from their cell centre; with jitter <= 1 the 3x3 neighbourhood is searched, which is exact for f1 and can very rarely under-estimate f2. Results are unclamped (typically f1 < 1.2); see [cellular_unit] for a 0..=1 mapping.

fnaster_blueprint::noise::cellular3

pub fn cellular3(seed: u32, x: f64, y: f64, z: f64, jitter: f64) -> (f64, f64)

3D cellular noise (27 cells searched); see [cellular2].

fnaster_blueprint::noise::cellular_unit

pub fn cellular_unit(mode: CellMode, (f1, f2): (f64, f64)) -> f64

Map a (f1, f2) pair to 0..=1 for mode.

fnaster_blueprint::noise::fbm2

pub fn fbm2(base: Base, seed: u32, x: f64, y: f64, cfg: Fractal) -> f64

2D convenience for [fbm3] (z = 0).

fnaster_blueprint::noise::fbm3

pub fn fbm3(base: Base, seed: u32, p: [f64; 3], cfg: Fractal) -> f64

Fractal Brownian motion, -1..=1.

fnaster_blueprint::noise::hash2

pub fn hash2(seed: u32, x: i32, y: i32) -> u32

Hash of a 2D lattice point.

fnaster_blueprint::noise::hash3

pub fn hash3(seed: u32, x: i32, y: i32, z: i32) -> u32

Hash of a 3D lattice point.

fnaster_blueprint::noise::perlin2

pub fn perlin2(seed: u32, x: f64, y: f64) -> f64

Gradient (Perlin) noise, -1..=1; exactly 0 on lattice points.

fnaster_blueprint::noise::perlin3

pub fn perlin3(seed: u32, x: f64, y: f64, z: f64) -> f64

3D gradient noise, -1..=1.

fnaster_blueprint::noise::ridged3

pub fn ridged3(base: Base, seed: u32, p: [f64; 3], cfg: Fractal) -> f64

Ridged multifractal-style noise, 0..=1: sharp bright crests (mountains, lightning).

fnaster_blueprint::noise::seed_from_f64

pub fn seed_from_f64(v: f64) -> u32

A reproducible u32 seed from an authored scalar (3.7 -> 3, negatives wrap).

fnaster_blueprint::noise::simplex2

pub fn simplex2(seed: u32, x: f64, y: f64) -> f64

2D simplex noise, -1..=1.

fnaster_blueprint::noise::simplex3

pub fn simplex3(seed: u32, x: f64, y: f64, z: f64) -> f64

3D simplex noise, -1..=1. Use the third axis as time.

fnaster_blueprint::noise::to_unit

pub fn to_unit(v: f64) -> f64

-1..=1 to 0..=1.

fnaster_blueprint::noise::turbulence3

pub fn turbulence3(base: Base, seed: u32, p: [f64; 3], cfg: Fractal) -> f64

Turbulence (sum of |noise|), 0..=1: billowy smoke, creased clouds.

fnaster_blueprint::noise::unit

pub fn unit(h: u32) -> f64

0..1 (never 1) from a hash.

fnaster_blueprint::noise::value2

pub fn value2(seed: u32, x: f64, y: f64) -> f64

Value noise: smoothly interpolated random lattice values, -1..=1.

fnaster_blueprint::noise::value3

pub fn value3(seed: u32, x: f64, y: f64, z: f64) -> f64

3D value noise, -1..=1.

fnaster_blueprint::noise::warp3

pub fn warp3(base: Base, seed: u32, p: [f64; 3], cfg: Fractal, strength: f64) -> f64

Domain-warped fBm, -1..=1: the sample point is displaced by two further fBm fields scaled by strength (in lattice units; ~0.5-2 looks like marble and smoke) before the final fBm is read.

Constants

constaster_blueprint::noise::MAX_OCTAVES

pub const MAX_OCTAVES: u32

Most octaves any fractal sums (more are clamped).