BRL-CAD

These noise functions provide mostly random noise at the integer lattice points. More...

Collaboration diagram for Fractal Noise:

Functions

void bn_noise_init (void)
 
double bn_noise_perlin (point_t pt)
 Robert Skinner's Perlin-style "Noise" function. More...
 
void bn_noise_vec (point_t point, point_t result)
 
double bn_noise_fbm (point_t point, double h_val, double lacunarity, double octaves)
 Procedural fBm evaluated at "point"; returns value stored in "value". More...
 
double bn_noise_turb (point_t point, double h_val, double lacunarity, double octaves)
 Procedural turbulence evaluated at "point";. More...
 
double bn_noise_mf (point_t point, double h_val, double lacunarity, double octaves, double offset)
 
double bn_noise_ridged (point_t point, double h_val, double lacunarity, double octaves, double offset)
 A ridged noise pattern. More...
 

Detailed Description

These noise functions provide mostly random noise at the integer lattice points.

The functions should be evaluated at non-integer locations for their nature to be realized.

Contains contributed code from: F. Kenton Musgrave Robert Skinner

Function Documentation

◆ bn_noise_init()

void bn_noise_init ( void  )

◆ bn_noise_perlin()

double bn_noise_perlin ( point_t  pt)

Robert Skinner's Perlin-style "Noise" function.

Results are in the range [-0.5 .. 0.5]. Unlike many implementations, this function provides random noise at the integer lattice values. However this produces much poorer quality and should be avoided if possible.

The power distribution of the result has no particular shape, though it isn't as flat as the literature would have one believe.

◆ bn_noise_vec()

void bn_noise_vec ( point_t  point,
point_t  result 
)

Vector-valued "Noise"

◆ bn_noise_fbm()

double bn_noise_fbm ( point_t  point,
double  h_val,
double  lacunarity,
double  octaves 
)

Procedural fBm evaluated at "point"; returns value stored in "value".

Parameters
pointlocation to sample noise
h_valfractal increment parameter
lacunaritygap between successive frequencies
octavesnumber of frequencies in the fBm

The spectral properties of the result are in the APPROXIMATE range [-1..1] Depending upon the number of octaves computed, this range may be exceeded. Applications should clamp or scale the result to their needs. The results have a more-or-less gaussian distribution. Typical results for 1M samples include:

  • Min -1.15246
  • Max 1.23146
  • Mean -0.0138744
  • s.d. 0.306642
  • Var 0.0940295

The function call pow() is relatively expensive. Therefore, this function pre-computes and saves the spectral weights in a table for re-use in successive invocations.

◆ bn_noise_turb()

double bn_noise_turb ( point_t  point,
double  h_val,
double  lacunarity,
double  octaves 
)

Procedural turbulence evaluated at "point";.

Returns
turbulence value for point
Parameters
pointlocation to sample noise at
h_valfractal increment parameter
lacunaritygap between successive frequencies
octavesnumber of frequencies in the fBm

The result is characterized by sharp, narrow trenches in low values and a more fbm-like quality in the mid-high values. Values are in the APPROXIMATE range [0 .. 1] depending upon the number of octaves evaluated. Typical results:

Min 0.00857137
Max 1.26712
Mean 0.395122
s.d. 0.174796
Var 0.0305536

The function call pow() is relatively expensive. Therefore, this function pre-computes and saves the spectral weights in a table for re-use in successive invocations.

◆ bn_noise_mf()

double bn_noise_mf ( point_t  point,
double  h_val,
double  lacunarity,
double  octaves,
double  offset 
)

From "Texturing and Modeling, A Procedural Approach" 2nd ed

◆ bn_noise_ridged()

double bn_noise_ridged ( point_t  point,
double  h_val,
double  lacunarity,
double  octaves,
double  offset 
)

A ridged noise pattern.

From "Texturing and Modeling, A Procedural Approach" 2nd ed p338