Skip to content

API reference Obsidian.API.Noise

PerlinNoise class

Multi-octave Perlin noise (vanilla PerlinNoise). Octave i samples at frequency 2^(FirstOctave + i) and is weighted by Amplitudes[i]; zero amplitudes skip the octave.

public sealed class PerlinNoise

In Obsidian.API.

Properties

public ReadOnlySpan<double> Amplitudes { get; }public int FirstOctave { get; }

MaxValue

public double MaxValue { get; }

Upper bound of PerlinNoise.GetValue.

Methods

Create(IRandomSource, int, ReadOnlySpan<double>)

public static PerlinNoise Create(IRandomSource random, int firstOctave, ReadOnlySpan<double> amplitudes);

Creates a noise whose octaves are seeded independently via ForkPositional().FromHashOf("octave_N").

CreateLegacyForBlendedNoise(IRandomSource, IEnumerable<int>)

public static PerlinNoise CreateLegacyForBlendedNoise(IRandomSource random, IEnumerable<int> octaves);

Creates a legacy-initialized noise with amplitude 1 for each octave in octaves (all must be <= 0). Used by BlendedNoise.

CreateLegacyForLegacyNetherBiome(IRandomSource, int, ReadOnlySpan<double>)

public static PerlinNoise CreateLegacyForLegacyNetherBiome(IRandomSource random, int firstOctave, ReadOnlySpan<double> amplitudes);

Creates a legacy-initialized noise for the legacy nether biome source.

GetOctaveNoise(int)

public ImprovedNoise GetOctaveNoise(int index);

Returns the octave with the index-th highest frequency (0 = highest), or null if its amplitude is zero. This is vanilla's (reversed) indexing.

public double GetValue(double x, double y, double z);

GetValue(double, double, double, double, double, bool)

public double GetValue(double x, double y, double z, double yScale, double yMax, bool useFixedY);

Legacy sampling. yScale/yMax are passed (scaled per octave) to ImprovedNoise.Noise; when useFixedY is set each octave samples at its own fixed y (-Yo) instead of y.

MaxBrokenValue(double)

public double MaxBrokenValue(double scale);

Upper bound used by BlendedNoise for samples scaled by scale.

Wrap(double)

public static double Wrap(double value);

Wraps a coordinate into [-2^24, 2^24] to keep precision for far-out samples.

Remarks

Math.Floor is the same as vanilla's Mth.lfloor widened back to a double for any coordinate within Int64 range times PerlinNoise.RoundOff, and is a single instruction.

On this page