Turbulence

Noise module that randomly displaces the input value before returning the output value from a source module.

@image html moduleturbulence.png

@a Turbulence is the pseudo-random displacement of the input value. The GetValue() method randomly displaces the ( @a x, @a y, @a 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 module::Perlin noise modules that displace the input value; one for the @a x, one for the @a y, and one for the @a z coordinate.

This noise module requires one source module.

Constructors

this
this()

Constructor.

Members

Functions

GetFrequency
double GetFrequency()

Returns the frequency of the turbulence.

GetPower
double GetPower()

Returns the power of the turbulence.

GetRoughnessCount
int GetRoughnessCount()

Returns the roughness of the turbulence.

GetSeed
int GetSeed()

Returns the seed value of the internal Perlin-noise modules that are used to displace the input values.

GetSourceModCount
int GetSourceModCount()
Undocumented in source. Be warned that the author may not have intended to support it.
GetValue
double GetValue(double x, double y, double z)
Undocumented in source. Be warned that the author may not have intended to support it.
SetFrequency
void SetFrequency(double frequency)

Sets the frequency of the turbulence.

SetPower
void SetPower(double power)

Sets the power of the turbulence.

SetRoughness
void SetRoughness(int roughness)

Sets the roughness of the turbulence.

SetSeed
void SetSeed(int seed)

Sets the seed value of the internal noise modules that are used to displace the input values.

Variables

m_power
double m_power;

The power (scale) of the displacement.

m_xDistortMod
Perlin m_xDistortMod;

Noise module that displaces the @a x coordinate.

m_yDistortMod
Perlin m_yDistortMod;

Noise module that displaces the @a y coordinate.

m_zDistortMod
Perlin m_zDistortMod;

Noise module that displaces the @a z coordinate.

Inherited Members

From Mod

~this
~this()

Destructor.

GetSourceMod
const(Mod) GetSourceMod(int index)

Returns a reference to a source module connected to this noise module.

GetSourceModCount
int GetSourceModCount()

Returns the number of source modules required by this noise module.

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

Generates an output value given the coordinates of the specified input value.

SetSourceMod
void SetSourceMod(int index, const(Mod)* sourceMod)

Connects a source module to this noise module.

m_pSourceMod
const(Mod)*[] m_pSourceMod;

An array containing the pointers to each source module required by this noise module.

Meta