noise::module::Turbulence Class Reference
[Transformer Modules]
#include <turbulence.h>
Inheritance diagram for noise::module::Turbulence:
List of all members.
Detailed Description
Noise module that randomly displaces the input value before returning the output value from a source module.
Turbulence is the pseudo-random displacement of the input value. The GetValue() method randomly displaces the ( x, y, z ) coordinates of the input value before retrieving the output value from the source module. To control the turbulence, an application can modify its frequency, its power, and its roughness.
The frequency of the turbulence determines how rapidly the displacement amount changes. To specify the frequency, call the SetFrequency() method.
The power of the turbulence determines the scaling factor that is applied to the displacement amount. To specify the power, call the SetPower() method.
The roughness of the turbulence determines the roughness of the changes to the displacement amount. Low values smoothly change the displacement amount. High values roughly change the displacement amount, which produces more "kinky" changes. To specify the roughness, call the SetRoughness() method.
Use of this noise module may require some trial and error. Assuming that you are using a generator module as the source module, you should first:
- Set the frequency to the same frequency as the source module.
- Set the power to the reciprocal of the frequency.
From these initial frequency and power values, modify these values until this noise module produce the desired changes in your terrain or texture. For example:
- Low frequency (1/8 initial frequency) and low power (1/8 initial power) produces very minor, almost unnoticeable changes.
- Low frequency (1/8 initial frequency) and high power (8 times initial power) produces "ropey" lava-like terrain or marble-like textures.
- High frequency (8 times initial frequency) and low power (1/8 initial power) produces a noisy version of the initial terrain or texture.
- High frequency (8 times initial frequency) and high power (8 times initial power) produces nearly pure noise, which isn't entirely useful.
Displacing the input values result in more realistic terrain and textures. If you are generating elevations for terrain height maps, you can use this noise module to produce more realistic mountain ranges or terrain features that look like flowing lava rock. If you are generating values for textures, you can use this noise module to produce realistic marble-like or "oily" textures.
Internally, there are three noise::module::Perlin noise modules that displace the input value; one for the x, one for the y, and one for the z coordinate.
This noise module requires one source module.
|
Public Member Functions |
| Turbulence () |
| Constructor.
|
double | GetFrequency () const |
| Returns the frequency of the turbulence.
|
double | GetPower () const |
| Returns the power of the turbulence.
|
int | GetRoughnessCount () const |
| Returns the roughness of the turbulence.
|
int | GetSeed () const |
| Returns the seed value of the internal Perlin-noise modules that are used to displace the input values.
|
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 turbulence.
|
void | SetPower (double power) |
| Sets the power of the turbulence.
|
void | SetRoughness (int roughness) |
| Sets the roughness of the turbulence.
|
void | SetSeed (int seed) |
| Sets the seed value of the internal noise modules that are used to displace the input values.
|
Protected Attributes |
double | m_power |
| The power (scale) of the displacement.
|
Perlin | m_xDistortModule |
| Noise module that displaces the x coordinate.
|
Perlin | m_yDistortModule |
| Noise module that displaces the y coordinate.
|
Perlin | m_zDistortModule |
| Noise module that displaces the z coordinate.
|
Constructor & Destructor Documentation
Turbulence::Turbulence |
( |
|
) |
|
|
Member Function Documentation
double Turbulence::GetFrequency |
( |
|
) |
const |
|
|
Returns the frequency of the turbulence.
- Returns:
- The frequency of the turbulence.
The frequency of the turbulence determines how rapidly the displacement amount changes. |
double noise::module::Turbulence::GetPower |
( |
|
) |
const [inline] |
|
|
Returns the power of the turbulence.
- Returns:
- The power of the turbulence.
The power of the turbulence determines the scaling factor that is applied to the displacement amount. |
int noise::module::Turbulence::GetRoughnessCount |
( |
|
) |
const [inline] |
|
|
Returns the roughness of the turbulence.
- Returns:
- The roughness of the turbulence.
The roughness of the turbulence determines the roughness of the changes to the displacement amount. Low values smoothly change the displacement amount. High values roughly change the displacement amount, which produces more "kinky" changes. |
int Turbulence::GetSeed |
( |
|
) |
const |
|
|
Returns the seed value of the internal Perlin-noise modules that are used to displace the input values.
- Returns:
- The seed value.
Internally, there are three noise::module::Perlin noise modules that displace the input value; one for the x, one for the y, and one for the z coordinate. |
virtual int noise::module::Turbulence::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 Turbulence::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::Turbulence::SetFrequency |
( |
double |
frequency |
) |
[inline] |
|
|
Sets the frequency of the turbulence.
- Parameters:
-
| frequency | The frequency of the turbulence. |
The frequency of the turbulence determines how rapidly the displacement amount changes. |
void noise::module::Turbulence::SetPower |
( |
double |
power |
) |
[inline] |
|
|
Sets the power of the turbulence.
- Parameters:
-
| power | The power of the turbulence. |
The power of the turbulence determines the scaling factor that is applied to the displacement amount. |
void noise::module::Turbulence::SetRoughness |
( |
int |
roughness |
) |
[inline] |
|
|
Sets the roughness of the turbulence.
- Parameters:
-
| roughness | The roughness of the turbulence. |
The roughness of the turbulence determines the roughness of the changes to the displacement amount. Low values smoothly change the displacement amount. High values roughly change the displacement amount, which produces more "kinky" changes.
Internally, there are three noise::module::Perlin noise modules that displace the input value; one for the x, one for the y, and one for the z coordinate. The roughness value is equal to the number of octaves used by the noise::module::Perlin noise modules. |
void Turbulence::SetSeed |
( |
int |
seed |
) |
|
|
|
Sets the seed value of the internal noise modules that are used to displace the input values.
- Parameters:
-
Internally, there are three noise::module::Perlin noise modules that displace the input value; one for the x, one for the y, and one for the z coordinate. This noise module assigns the following seed values to the noise::module::Perlin noise modules:
- It assigns the seed value (seed + 0) to the x noise module.
- It assigns the seed value (seed + 1) to the y noise module.
- It assigns the seed value (seed + 2) to the z noise module.
|
The documentation for this class was generated from the following files:
|