Struct NoiseSettings
Immutable configuration struct for coherent gradient noise generation. Bundles the noise algorithm, fractal layering method, base sampling frequency, and per-octave scaling parameters into a single value that can be passed to Fractal2D(float, float, NoiseSettings), Fractal3D(float, float, float, NoiseSettings), Fill2D(float[], int, int, NoiseSettings, float, float), Fill3D(float[], int, int, int, NoiseSettings, float, float, float), and the NoiseDomainWarper warp methods.
Inherited Members
Namespace: Scylla.Core.Util.Noise
Assembly: ScyllaCore.dll
Syntax
public readonly struct NoiseSettings
Remarks
This struct is readonly and allocation-free. Use the provided named presets (e.g., Default, Terrain, Clouds) as starting points and pass custom instances to the constructor for fine-grained control.
Fractal layering fields (Octaves, Lacunarity, Persistence) are only meaningful when Fractal is not None and Octaves is greater than 1. When single-octave evaluation is needed, set Fractal to None and call Evaluate2D(float, float, NoiseAlgorithm) or Evaluate3D(float, float, float, NoiseAlgorithm) directly.
Output value ranges depend on the Fractal setting: FBM and PingPong return approximately [-1, 1]; Turbulence returns [0, 1]; Ridged returns approximately [0, 2] (unnormalized).
Constructors
NoiseSettings(NoiseAlgorithm, FractalType, float, int, float, float)
Creates a new NoiseSettings with fully specified parameters. All fields are assigned directly without clamping or validation.
Declaration
public NoiseSettings(NoiseAlgorithm algorithm, FractalType fractal, float frequency, int octaves, float lacunarity, float persistence)
Parameters
| Type | Name | Description |
|---|---|---|
| NoiseAlgorithm | algorithm | The coherent noise algorithm to use for per-octave evaluation. See NoiseAlgorithm for the available algorithms and their trade-offs. |
| FractalType | fractal | Fractal layering method. Use None for single-octave
evaluation. Any other value activates multi-octave layering governed by
|
| float | frequency | Base sampling frequency applied to input coordinates. Higher values produce smaller-scale, more detailed features; lower values produce broader features. Typical world-space terrain values are in [0.001, 0.05]. |
| int | octaves | Number of noise octaves to layer. Ignored when |
| float | lacunarity | Frequency multiplier per octave. Typically |
| float | persistence | Amplitude multiplier per octave. Typically |
Fields
Algorithm
The coherent noise algorithm used to generate per-octave values. OpenSimplex2 is the recommended default for its isotropy and patent-free status. Perlin reproduces the classic Ken Perlin look. Value and ValueCubic are faster hash-based alternatives with a blockier character.
Declaration
public readonly NoiseAlgorithm Algorithm
Field Value
| Type | Description |
|---|---|
| NoiseAlgorithm |
See Also
Caves
Cave system preset: 4-octave FBM with OpenSimplex2 at frequency 0.05 and a reduced persistence of 0.45. The higher frequency relative to Terrain and the lower persistence produce a more erratic, tunnel-like pattern when thresholded, suitable for generating 2D cave cross-sections or 3D cave volumes via a solid/void cutoff value.
Declaration
public static readonly NoiseSettings Caves
Field Value
| Type | Description |
|---|---|
| NoiseSettings |
Clouds
Cloud density preset: 4-octave turbulence with OpenSimplex2 at frequency 0.01. Turbulence takes the absolute value per octave, creating the folded, billowy character of cumulus clouds. Output is always in [0, 1], making it suitable for direct use as a density or opacity map.
Declaration
public static readonly NoiseSettings Clouds
Field Value
| Type | Description |
|---|---|
| NoiseSettings |
Default
Default settings: single-octave OpenSimplex2 at frequency 1.0 with no fractal layering. Returns values in approximately [-1, 1]. Suitable as a neutral starting point when building a custom configuration or as a quick noise source for prototype work.
Declaration
public static readonly NoiseSettings Default
Field Value
| Type | Description |
|---|---|
| NoiseSettings |
Fractal
The fractal layering method applied when combining multiple octaves. Set to None for single-octave evaluation with no layering. Any other value activates multi-octave layering using Octaves, Lacunarity, and Persistence to scale each octave.
Declaration
public readonly FractalType Fractal
Field Value
| Type | Description |
|---|---|
| FractalType |
See Also
Frequency
Base sampling frequency applied to input coordinates before the first noise evaluation. Higher values zoom in, producing finer-grained detail per unit of input space. Lower values zoom out, producing coarser, broader features. Typical world-space terrain values are in [0.001, 0.05]; texture-space values may reach 1.0 or higher.
Declaration
public readonly float Frequency
Field Value
| Type | Description |
|---|---|
| float |
Lacunarity
Frequency multiplier applied to each successive fractal octave. A value of
2.0 (the standard) doubles the sampling frequency per octave, adding
detail at half the previous spatial scale. Values above 2.0 produce more
aggressive detail layering; values below 2.0 produce subtler, more evenly spaced
layers. Only meaningful when Fractal is not None
and Octaves is greater than 1.
Declaration
public readonly float Lacunarity
Field Value
| Type | Description |
|---|---|
| float |
Octaves
Number of noise octaves to layer when Fractal is not None. Each additional octave adds finer detail at the cost of an additional noise evaluation per sample. Ignored when Fractal is None or this value is 1 or less. Typical values are 2-8; diminishing returns occur beyond 6-7 octaves as each added octave contributes exponentially less amplitude.
Declaration
public readonly int Octaves
Field Value
| Type | Description |
|---|---|
| int |
Persistence
Amplitude multiplier applied to each successive fractal octave. A value of
0.5 (the standard) halves the contribution of each octave so coarser
layers dominate and finer layers add subtle variation. Values above 0.5 give
higher-frequency octaves more weight, producing rougher or more chaotic output;
values below 0.5 reduce fine detail and smooth the result. Only meaningful when
Fractal is not None and
Octaves is greater than 1.
Declaration
public readonly float Persistence
Field Value
| Type | Description |
|---|---|
| float |
Ridges
Mountain ridge preset: 5-octave ridged multifractal with OpenSimplex2 at frequency 0.008. The ridged formula produces sharp peaks with smooth valleys, characteristic of dramatic mountain ranges, canyon walls, and river channel edges. Output is unnormalized and approximately in [0, 2].
Declaration
public static readonly NoiseSettings Ridges
Field Value
| Type | Description |
|---|---|
| NoiseSettings |
Terrain
Terrain heightmap preset: 6-octave FBM with OpenSimplex2 at a very low frequency (0.005), standard lacunarity (2.0) and persistence (0.5). Produces smooth, continuous elevation data with fine detail layered over broad continental shapes. Pass the output directly to a terrain heightmap or normalise it from [-1, 1] to [0, 1] for height scaling.
Declaration
public static readonly NoiseSettings Terrain
Field Value
| Type | Description |
|---|---|
| NoiseSettings |