Expand description
A simple, performant, and customizable procedural noise generation library.
Libnoise provides utilities to generate coherent noise and customize them by applying a variety of operations which modify and combine generators. With a focus on customizability, the library allows users to create custom generators and modifiers.
Most immediately relevant documentation can be found in Source
and
Generator
.
§Quickstart
To get started easily, create a source generator using one of the many
sources found in Source
, and apply adapters documented in Generator
.
use libnoise::prelude::*;
// build a simplex noise generator seeded with 42
let generator = Source::simplex(42);
// sample the generator for input point [0.2, 0.5]
let value = generator.sample([0.2, 0.5]);
Note how the dimensionality, which is internally represented as a constant generic argument, is automatically inferred by sampling the generator with a 2-dimensional input point.
Naturally, we can create more interesting complex generators:
use libnoise::prelude::*;
// build a generator
let generator = Source::simplex(42) // start with simplex noise
.fbm(5, 0.013, 2.0, 0.5) // apply fractal brownian motion
.blend( // apply blending...
Source::worley(43).scale([0.05, 0.05]), // ...with scaled worley noise
Source::worley(44).scale([0.02, 0.02])) // ...controlled by other worley noise
.lambda(|f| (f * 2.0).sin() * 0.3 + f * 0.7); // apply a closure to the noise
// sample the generator for input point [0.2, 0.5]
let value = generator.sample([0.2, 0.5]);
We can also use NoiseBuffer
for efficiently filling n-dimensional arrays
with noise. The above generator produces the following image, when sampled for
every pixel position:
It is common to interpret the 3rd or 4th dimension as time, allowing us to produce space-time noise such as:
Visualizer
allows us to get such a visual representation of a given generator when using the image
feature.
Modules§
- Re-exports of useful members.
Structs§
- A generator returning the absolute value of the results of the underlying generator.
- A generator adding
offset
to results of the underlying generator. - Create a generator applying an
fbm()
-like effect on the underlying generator. - A generator blending the underlying generator with a given other generator based on the value supplied by a control-generator.
- A generator which produces an n-dimensional checkerboard pattern.
- A generator clamping results of the underlying generator to a given interval.
- A generator which produces the supplied value for every input point.
- A generator which produces n-dimensional values based on the provided closure.
- A generator producing the maximum of results of the underlying generator and results of a given other generator.
- A generator applying the exponential function on results of the underlying generator.
- A generator applying fractal brownian motion on the underlying generator.
- A generator which produces n-dimensional improved perlin noise.
- A generator applying the supplied closure to results of the underlying generator.
- A generator producing the maximum of results of the underlying generator and results of a given other generator.
- A generator producing the minimum of results of the underlying generator and results of a given other generator.
- A generator multiplying
scale
to results of the underlying generator. - A generator which negates the results of the underlying generator.
- A struct for generating an n-dimensional array and efficiently filling it with noise values.
- A generator which produces n-dimensional perlin noise.
- A generator raising results of the underlying generator to the power of
exponent
. - A generator raising results of the underlying generator to the power of results of a given other generator.
- A generator multiplying results of the underlying generator to results of a given other generator.
- Create a generator applying an
fbm()
-like effect on the underlying generator. - A generator which rotates input points before passing them to the underlying generator.
- A generator which scales input points before passing them to the underlying generator.
- Create a generator selecting the result of either the underlying generator or that of a given other generator based on whether the value supplied by a control-generator lies within the provided interval.
- A generator which produces n-dimensional simplex noise.
- A struct serving as entry point for building generators.
- A generator adding results of the underlying generator to results of a given other generator.
- A generator which translates input points before passing them to the underlying generator.
- A generator which produces n-dimensional value noise.
- A struct for visualizing the output of a generator.
- A generator which produces n-dimensional worley noise.
Traits§
- A trait for building a coherent noise generation pipeline.
- A trait representing the specialization of
Generator<D>
for 1-dimensional input spaces. - A trait representing the specialization of
Generator<D>
for 2-dimensional input spaces. - A trait representing the specialization of
Generator<D>
for 3-dimensional input spaces. - A trait representing the specialization of
Generator<D>
for 4-dimensional input spaces. - A trait attached to valid seed types for noise sources.