Class TTerrainNoise
Unit
Declaration
type TTerrainNoise = class(TTerrainImage)
Description
Procedural terrain: data from a procedural noise.
"Synthesized noise" means it's not simply something random. We take the noise (integer noise, i.e. hash), smooth it (how well, and how fast — see Interpolation and Blur), and add several functions ("octaves") of such noise (with varying frequency and amplitude) together. This is the kind of noise used to synthesize textures, terrains and all other procedural stuff.
For more info about math inside:
[http://en.wikipedia.org/wiki/Fractional_Brownian_motion]. This is the idea of summing up octaves of noise. Ken Musgrave's dissertation has a lot of info and interesting references: [http://www.kenmusgrave.com/dissertation.html]
Blender's source code is informative, interesting file is blender/source/blender/blenlib/intern/noise.c
The simplest practical introduction to the idea is on [http://freespace.virgin.net/hugo.elias/models/m_perlin.htm]. It describes how to get nice noise very easily, and my approach follows theirs.
This descends from TTerrainImage, so you can add an image to your function result, e.g. to flatten some specific generated area.
Hierarchy
- TObject
- TTerrain
- TTerrainImage
- TTerrainNoise
Overview
Methods
![]() |
constructor Create; |
![]() |
function Height(const X, Y: Single): Single; override; |
Properties
![]() |
property Octaves: Single read FOctaves write FOctaves default 4.0; |
![]() |
property Smoothness: Single read FSmoothness write FSmoothness default 2.0; |
![]() |
property Amplitude: Single read FAmplitude write FAmplitude default 1.0; |
![]() |
property Frequency: Single read FFrequency write FFrequency default 1.0; |
![]() |
property Interpolation: TNoiseInterpolation
read FInterpolation write SetInterpolation default niCosine; |
![]() |
property Blur: boolean read FBlur write SetBlur default false; |
![]() |
property Seed: Cardinal read FSeed write FSeed default 0; |
![]() |
property Heterogeneous: Single
read FHeterogeneous write FHeterogeneous default 0.0; |
Description
Methods
![]() |
constructor Create; |
![]() |
function Height(const X, Y: Single): Single; override; |
Properties
![]() |
property Smoothness: Single read FSmoothness write FSmoothness default 2.0; |
|
How noise amplitude changes, when frequency doubles. When we double frequency, amplitude is divided by this. Smaller values <=> larger frequency noise is more visible, so terrain is less smooth (more noisy). This is elsewhere called fractal increment, fractal dimension parameter, "H", spectral exponent (see e.g. Blender sources, Musgrave's dissertation). Do not confuse this with "lacunarity" (how frequency changes in each octave), that is simply hardcoded to 2.0 in our code currently. In [http://freespace.virgin.net/hugo.elias/models/m_perlin.htm], the inverse of this 1/ I decided to call it " Value equal 1.0 means that amplitude doesn't change at all, each noise frequency is visible the same, so in effect you will just see a lot of noise. And values < 1.0 are really nonsense, they make more frequency noise even more visible, which means that the terrain is dominated by noise. | |
![]() |
property Amplitude: Single read FAmplitude write FAmplitude default 1.0; |
|
| |
![]() |
property Frequency: Single read FFrequency write FFrequency default 1.0; |
![]() |
property Interpolation: TNoiseInterpolation
read FInterpolation write SetInterpolation default niCosine; |
|
How integer noise is interpolated to get smooth float noise. Setting this to niNone turns off Using niLinear (means "bilinear", since this is 2D case) is also usually bad. Unless you use octaves of really high frequencies, usually sharp edges / flat in-betweens will be visible. Using niCosine in right now the best. Using niSpline is even better looking (usese Catmull-Rom splines, which are special case of cubic Hermite spline, see http://en.wikipedia.org/wiki/Cubic_Hermite_spline, http://en.wikipedia.org/wiki/Bicubic_interpolation). But it's more time consuming under current implementation. | |
![]() |
property Blur: boolean read FBlur write SetBlur default false; |
|
Resulting noise octaves may be blurred. This helps to remove the inherent vertical/horizontal directionality in our 2D noise (it also makes it more smooth, since that's what blurring is about; you may want to increase Frequency * 2 to balance this). This is independent from Interpolation. Although the need for Note about [http://freespace.virgin.net/hugo.elias/models/m_perlin.htm]: this "blurring" is called "smoothing" there. I call it blurring, as it seems more precise to me. | |
![]() |
property Seed: Cardinal read FSeed write FSeed default 0; |
|
Determines the random seeds used when generating the terrain. | |
![]() |
property Heterogeneous: Single
read FHeterogeneous write FHeterogeneous default 0.0; |
|
If non-zero, then we generate terrain using More precisely, this means that we accumulate multiplied previous noise, at each step dividing this accumulated result by This is called "threshold" in Musgrave's dissertation (see algorithm in section 2.3.2.5 "A Large Scale Terrain Model"). | |
Generated by PasDoc 0.16.0.
