Introduction To Noise Functions




Definitions
Sin Wave  
Noise Wave 



Persistence
frequency = 2^{i} amplitude = persistence^{i}
Frequency  1  2  4  8  16  32  
Persistence = 1/4  +  +  +  +  +  =  
Amplitude:  1  ^{1}/_{4}  ^{1}/_{16}  ^{1}/_{64}  ^{1}/_{256}  ^{1}/_{1024}  result  
Persistence = 1/2  +  +  +  +  +  =  
Amplitude:  1  ^{1}/_{2}  ^{1}/_{4}  ^{1}/_{8}  ^{1}/_{16}  ^{1}/_{32}  result  
Persistence = 1 / root2  +  +  +  +  +  =  
Amplitude:  1  ^{1}/_{1.414}  ^{1}/_{2}  ^{1}/_{2.828}  ^{1}/_{4}  ^{1}/_{5.656}  result  
Persistence = 1  +  +  +  +  +  =  
Amplitude:  1  1  1  1  1  1  result 
Octaves
Making your noise functions
function IntNoise(32bit integer: x) x = (x<<13) ^ x; return ( 1.0  ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0); end IntNoise function 
Interpolation
Linear Interpolation:


Cosine Interpolation:


Cubic Interpolation:

Smoothed Noise


function Noise(x) . . end function function SmoothNoise_1D(x) return Noise(x)/2 + Noise(x1)/4 + Noise(x+1)/4 end function 
2dimensional Smooth Noise
function Noise(x, y) . . end function function SmoothNoise_2D(x>, y) corners = ( Noise(x1, y1)+Noise(x+1, y1)+Noise(x1, y+1)+Noise(x+1, y+1) ) / 16 sides = ( Noise(x1, y) +Noise(x+1, y) +Noise(x, y1) +Noise(x, y+1) ) / 8 center = Noise(x, y) / 4 return corners + sides + center end function 
Putting it all together
1dimensional Perlin Noise Pseudo code
function Noise1(integer x) x = (x<<13) ^ x; return ( 1.0  ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0); end function function SmoothedNoise_1(float x) return Noise(x)/2 + Noise(x1)/4 + Noise(x+1)/4 end function function InterpolatedNoise_1(float x) integer_X = int(x) fractional_X = x  integer_X v1 = SmoothedNoise1(integer_X) v2 = SmoothedNoise1(integer_X + 1) return Interpolate(v1 , v2 , fractional_X) end function function PerlinNoise_1D(float x) total = 0 p = persistence n = Number_Of_Octaves  1 loop i from 0 to n frequency = 2^{i} amplitude = p^{i} total = total + InterpolatedNoise_{i}(x * frequency) * amplitude end of i loop return total end function 
2dimensional Perlin Noise Pseudocode
function Noise1(integer x, integer y) n = x + y * 57 n = (n<<13) ^ n; return ( 1.0  ( (n * (n * n * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0); end function function SmoothNoise_1(float x, float y) corners = ( Noise(x1, y1)+Noise(x+1, y1)+Noise(x1, y+1)+Noise(x+1, y+1) ) / 16 sides = ( Noise(x1, y) +Noise(x+1, y) +Noise(x, y1) +Noise(x, y+1) ) / 8 center = Noise(x, y) / 4 return corners + sides + center end function function InterpolatedNoise_1(float x, float y) integer_X = int(x) fractional_X = x  integer_X integer_Y = int(y) fractional_Y = y  integer_Y v1 = SmoothedNoise1(integer_X, integer_Y) v2 = SmoothedNoise1(integer_X + 1, integer_Y) v3 = SmoothedNoise1(integer_X, integer_Y + 1) v4 = SmoothedNoise1(integer_X + 1, integer_Y + 1) i1 = Interpolate(v1 , v2 , fractional_X) i2 = Interpolate(v3 , v4 , fractional_X) return Interpolate(i1 , i2 , fractional_Y) end function function PerlinNoise_2D(float x, float y) total = 0 p = persistence n = Number_Of_Octaves  1 loop i from 0 to n frequency = 2^{i} amplitude = p^{i} total = total + InterpolatedNoise_{i}(x * frequency, y * frequency) * amplitude end of i loop return total end function 
Applications of Perlin Noise
1 dimensional
Controlling virtual beings: 

Drawing sketched lines: 
See: Creating Informal Looking Interfaces.

2 dimensional
Landscapes: 

Clouds: 

Generating Textures: 

3 dimensional
3D Clouds: 

Animated Clouds: 

Solid Textures: 

4 dimensional
Animated 3D Textures and Clouds: 

Copyright Matt Fairclough 1998 
The land, clouds and water in this picture were all mathematically generated with Perlin Noise, and rendered with Terragen. 
The clouds in this demo are animated with 3D perlin Noise. The algorithm had to be modified slightly to be able to produce Perlin Noise in real time. See the Clouds Article for more info on how this was done. 
Generating Textures with Perlin Noise
The following textures were made with 3D Perlin Noise






texture = cosine( x + perlin(x,y,z) ) 


g = perlin(x,y,z) * 20 grain = g  int(g) bumps = perlin(x*50, y*50, z*20) if bumps < .5 then bumps = 0 else bumps = 1t 
References
Procedural textures: http://developer.intel.com/drg/mmx/appnotes/proctex.htm
Ken Perlin's Homepage: http://mrl.nyu.edu/perlin/
Texturing And Modeling A Procedural Approach: http://www.cs.umbc.edu/~ebert/book/book.html
Procedural Texture Page: http://www.threedgraphics.com/pixelloom/tex_synth.html
Return to the Good Looking Textured Light Sourced Bouncy Fun Smart and Stretchy Page.