A portable, open-source, coherent noise-generating library for C++
Main Page | Modules | Class Hierarchy | Class List | File List | Class Members # noise::module::RidgedMulti Class Reference [Generator Modules] `#include <ridgedmulti.h>` Inheritance diagram for noise::module::RidgedMulti: List of all members. ## Detailed Description Noise module that outputs 3-dimensional ridged-multifractal noise. 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 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. Note: 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. This noise module does not require any source modules. 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() method. Frequency An application may specify the frequency of the first octave by calling the SetFrequency() method. Lacunarity The lacunarity specifies the frequency multipler 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.)
## Public Member Functions
| RidgedMulti ()
| Constructor.
double | GetFrequency () const
| Returns the frequency of the first octave.
double | GetLacunarity () const
| Returns the lacunarity of the ridged-multifractal noise.
noise::NoiseQuality | GetNoiseQuality () const
| Returns the quality of the ridged-multifractal noise.
int | GetOctaveCount () const
| Returns the number of octaves that generate the ridged-multifractal noise.
int | GetSeed () const
| Returns the seed value used by the ridged-multifractal-noise function.
virtual int | GetSourceModuleCount () const
| Returns the number of source modules required by this noise module.
virtual double | GetValue (double x, double y, double z) const
| Generates an output value given the coordinates of the specified input value.
void | SetFrequency (double frequency)
| Sets the frequency of the first octave.
void | SetLacunarity (double lacunarity)
| Sets the lacunarity of the ridged-multifractal noise.
void | SetNoiseQuality (noise::NoiseQuality noiseQuality)
| Sets the quality of the ridged-multifractal noise.
void | SetOctaveCount (int octaveCount)
| Sets the number of octaves that generate the ridged-multifractal noise.
void | SetSeed (int seed)
| Sets the seed value used by the ridged-multifractal-noise function.
## Protected Member Functions
void | CalcSpectralWeights ()
| Calculates the spectral weights for each octave.
## Protected Attributes
double | m_frequency
| Frequency of the first octave.
double | m_lacunarity
| Frequency multiplier between successive octaves.
noise::NoiseQuality | m_noiseQuality
| Quality of the ridged-multifractal noise.
int | m_octaveCount
| Total number of octaves that generate the ridged-multifractal noise.
double | m_pSpectralWeights [RIDGED_MAX_OCTAVE]
| Contains the spectral weights for each octave.
int | m_seed
| Seed value used by the ridged-multfractal-noise function.
## Constructor & Destructor Documentation
RidgedMulti::RidgedMulti | ( |  | ) |
| Constructor. The default number of octaves is set to noise::module::DEFAULT_RIDGED_OCTAVE_COUNT. The default frequency is set to noise::module::DEFAULT_RIDGED_FREQUENCY. The default lacunarity is set to noise::module::DEFAULT_RIDGED_LACUNARITY. The default seed value is set to noise::module::DEFAULT_RIDGED_SEED.
## Member Function Documentation
void RidgedMulti::CalcSpectralWeights | ( |  | ) | `[protected]`
| Calculates the spectral weights for each octave. This method is called when the lacunarity changes.
double noise::module::RidgedMulti::GetFrequency | ( |  | ) | const`[inline]`
| Returns the frequency of the first octave. Returns: The frequency of the first octave.
double noise::module::RidgedMulti::GetLacunarity | ( |  | ) | const`[inline]`
| Returns the lacunarity of the ridged-multifractal noise. Returns: The lacunarity of the ridged-multifractal noise. The lacunarity is the frequency multiplier between successive octaves.
noise::NoiseQuality noise::module::RidgedMulti::GetNoiseQuality | ( |  | ) | const`[inline]`
| Returns the quality of the ridged-multifractal noise. Returns: The quality of the ridged-multifractal noise. See noise::NoiseQuality for definitions of the various coherent-noise qualities.
int noise::module::RidgedMulti::GetOctaveCount | ( |  | ) | const`[inline]`
| Returns the number of octaves that generate the ridged-multifractal noise. Returns: The number of octaves that generate the ridged-multifractal noise. The number of octaves controls the amount of detail in the ridged-multifractal noise.
int noise::module::RidgedMulti::GetSeed | ( |  | ) | const`[inline]`
| Returns the seed value used by the ridged-multifractal-noise function. Returns: The seed value.
virtual int noise::module::RidgedMulti::GetSourceModuleCount | ( |  | ) | const`[inline, virtual]`
| Returns the number of source modules required by this noise module. Returns: The number of source modules required by this noise module. Implements noise::module::Module.
double RidgedMulti::GetValue | ( | double | x,
|  | double | y,
|  | double | z
| ) | const`[virtual]`
  | Generates an output value given the coordinates of the specified input value. Parameters:
  | x | The x coordinate of the input value.
  | y | The y coordinate of the input value.
  | z | The z coordinate of the input value.
Returns: The output value. Precondition: All source modules required by this noise module have been passed to the SetSourceModule() method. Before an application can call this method, it must first connect all required source modules via the SetSourceModule() method. If these source modules are not connected to this noise module, this method raises a debug assertion. To determine the number of source modules required by this noise module, call the GetSourceModuleCount() method. Implements noise::module::Module.
void noise::module::RidgedMulti::SetFrequency | ( | double | frequency | ) | `[inline]`
  | Sets the frequency of the first octave. Parameters:
  | frequency | The frequency of the first octave.
void noise::module::RidgedMulti::SetLacunarity | ( | double | lacunarity | ) | `[inline]`
  | Sets the lacunarity of the ridged-multifractal noise. Parameters:
  | lacunarity | 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.
void noise::module::RidgedMulti::SetNoiseQuality | ( | noise::NoiseQuality | noiseQuality | ) | `[inline]`
  | Sets the quality of the ridged-multifractal noise. Parameters:
  | noiseQuality | The quality of the ridged-multifractal noise.
See noise::NoiseQuality for definitions of the various coherent-noise qualities.
void noise::module::RidgedMulti::SetOctaveCount | ( | int | octaveCount | ) | `[inline]`
  | Sets the number of octaves that generate the ridged-multifractal noise. Parameters:
  | octaveCount | The number of octaves that generate the ridged-multifractal noise.
  Precondition: The number of octaves ranges from 1 to noise::module::RIDGED_MAX_OCTAVE. Exceptions:
  | noise::ExceptionInvalidParam | An invalid parameter was specified; see the preconditions for more information.
The 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.
void noise::module::RidgedMulti::SetSeed | ( | int | seed | ) | `[inline]`
  | Sets the seed value used by the ridged-multifractal-noise function. Parameters:
  | seed | The seed value.
The documentation for this class was generated from the following files: ridgedmulti.h ridgedmulti.cpp