This noise module, heavily based on the Perlin-noise module, generates ridged-multifractal noise. Ridged-multifractal noise is generated in much of the same way as Perlin noise, except the output of each octave is modified by an absolute-value function. Modifying the octave values in this way produces ridge-like formations.
Ridged-multifractal noise does not use a persistence value. This is because the persistence values of the octaves are based on the values generated from previous octaves, creating a feedback loop (or that's what it looks like after reading the code.)
This noise module outputs ridged-multifractal-noise values that usually range from -1.0 to +1.0, but there are no guarantees that all output values will exist within that range.
For ridged-multifractal noise generated with only one octave, the output value ranges from -1.0 to 0.0.
Ridged-multifractal noise is often used to generate craggy mountainous terrain or marble-like textures.
Octaves
The number of octaves control the amount of detail of the ridged-multifractal noise. Adding more octaves increases the detail of the ridged-multifractal noise, but with the drawback of increasing the calculation time.
An application may specify the number of octaves that generate ridged
-multifractal noise by calling the setOctaveCount(int) method.
Frequency
An application may specify the frequency of the first octave by
calling the setFrequency(double) method.
Lacunarity
The lacunarity specifies the frequency multiplier between successive octaves.
The effect of modifying the lacunarity is subtle; you may need to play with the lacunarity value to determine the effects. For best results, set the lacunarity to a number between 1.5 and 3.5.
References & Acknowledgments
F.
Kenton "Doc Mojo" Musgrave's texturing page - This page contains
links to source code that generates ridged-multfractal noise, among
other types of noise. The source file
fractal.c contains the code I used in my ridged-multifractal class
(see the RidgedMultifractal()) function.) This code was written by F.
Kenton Musgrave, the person who created MojoWorld.
He is also one of the authors in Texturing and Modeling:
A Procedural Approach (Morgan Kaufmann, 2002. ISBN 1-55860-848-6).
- Source Modules
- This module does not require any source modules.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleDefault frequency for theRidgedMultinoise module.static final doubleDefault lacunarity for theRidgedMultinoise module.static final intDefault number of octaves for theRidgedMultinoise module.static final NoiseQualityDefault noise quality for theRidgedMultinoise module.static final intDefault noise seed for theRidgedMultinoise module.static final intMaximum number of octaves for theRidgedMultinoise module.Fields inherited from class org.spongepowered.noise.module.NoiseModule
sourceModule -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleGet the frequency of the first octave.doubleget(double x, double y, double z) Generates an output value given the coordinates of the specified input value.doubleGet the lacunarity of the ridged-multifractal noise.doublemaxValue()Returns the maximum value the RidgedMulti module can output in its current configuration.Get the quality of the ridged-multifractal noise.intGet the number of octaves that generate the ridged-multifractal noise.intseed()Get the seed value used by the ridged-multifractal noise function.voidsetFrequency(double frequency) Set the frequency of the first octave.voidsetLacunarity(double lacunarity) Sets the lacunarity of the ridged-multifractal noise.voidsetNoiseQuality(NoiseQuality noiseQuality) Set the quality of the ridged-multifractal noise.voidsetOctaveCount(int octaveCount) Set the number of octaves that generate the ridged-multifractal noise.voidsetSeed(int seed) Set the seed value used by the ridged-multifractal noise function.Methods inherited from class org.spongepowered.noise.module.NoiseModule
setSourceModule, sourceModule, sourceModuleCount
-
Field Details
-
DEFAULT_RIDGED_FREQUENCY
public static final double DEFAULT_RIDGED_FREQUENCYDefault frequency for theRidgedMultinoise module.- See Also:
-
DEFAULT_RIDGED_LACUNARITY
public static final double DEFAULT_RIDGED_LACUNARITYDefault lacunarity for theRidgedMultinoise module.- See Also:
-
DEFAULT_RIDGED_OCTAVE_COUNT
public static final int DEFAULT_RIDGED_OCTAVE_COUNTDefault number of octaves for theRidgedMultinoise module.- See Also:
-
DEFAULT_RIDGED_QUALITY
Default noise quality for theRidgedMultinoise module. -
DEFAULT_RIDGED_SEED
public static final int DEFAULT_RIDGED_SEEDDefault noise seed for theRidgedMultinoise module.- See Also:
-
RIDGED_MAX_OCTAVE
public static final int RIDGED_MAX_OCTAVEMaximum number of octaves for theRidgedMultinoise module.- See Also:
-
-
Constructor Details
-
RidgedMulti
public RidgedMulti()
-
-
Method Details
-
frequency
public double frequency()Get the frequency of the first octave.- Returns:
- the frequency of the first octave
- See Also:
-
setFrequency
public void setFrequency(double frequency) Set the frequency of the first octave.- Parameters:
frequency- the frequency of the first octave
-
lacunarity
public double lacunarity()Get the lacunarity of the ridged-multifractal noise.- Returns:
- the lacunarity of the ridged-multifractal noise.
- See Also:
-
setLacunarity
public void setLacunarity(double lacunarity) Sets the lacunarity of the ridged-multifractal noise.The lacunarity is the frequency multiplier between successive octaves.
For best results, set the lacunarity to a number between 1.5 and 3.5.
- Parameters:
lacunarity- the lacunarity of the ridged-multifractal noise
-
noiseQuality
Get the quality of the ridged-multifractal noise.See
NoiseQualityfor definitions of the various coherent-noise qualities.- Returns:
- the quality of the ridged-multifractal noise
- See Also:
-
setNoiseQuality
Set the quality of the ridged-multifractal noise.See
NoiseQualityfor definitions of the various coherent-noise qualities.- Parameters:
noiseQuality- the quality of the ridged-multifractal noise
-
octaveCount
public int octaveCount()Get the number of octaves that generate the ridged-multifractal noise.The number of octaves controls the amount of detail in the ridged-multifractal noise.
- Returns:
- the number of octaves that generate the ridged-multifractal noise
- See Also:
-
setOctaveCount
public void setOctaveCount(int octaveCount) Set the number of octaves that generate the ridged-multifractal noise.The number of octaves must be between 1 and
RIDGED_MAX_OCTAVEThe number of octaves controls the amount of detail in the ridged-multifractal noise.
The larger the number of octaves, the more time required to calculate the ridged-multifractal noise value.
- Parameters:
octaveCount- the number of octaves that generate the ridged-multifractal noise- Throws:
IllegalArgumentException- if the octave count is larger thanRIDGED_MAX_OCTAVE
-
seed
public int seed()Get the seed value used by the ridged-multifractal noise function.- Returns:
- the seed value
- See Also:
-
setSeed
public void setSeed(int seed) Set the seed value used by the ridged-multifractal noise function.- Parameters:
seed- the seed value
-
maxValue
public double maxValue()Returns the maximum value the RidgedMulti module can output in its current configuration.- Returns:
- The maximum possible value for
get(double, double, double)to return
-
get
public double get(double x, double y, double z) Description copied from class:NoiseModuleGenerates an output value given the coordinates of the specified input value.All source modules required by this module must have been connected with the
NoiseModule.setSourceModule(int, NoiseModule)method. If these source modules are not connected, this method will throw aNoModuleException.To determine the number of source modules required by this noise module, call the
NoiseModule.sourceModuleCount()method.- Specified by:
getin classNoiseModule- Parameters:
x- thexcoordinate of the input valuey- theycoordinate of the input valuez- thezcoordinate of the input value- Returns:
- the output value
-