Noise
Wanho Choi (wanochoi.com)
Signal
• What conveys information (or message)
about the behavior of some phenomenon from a source to an observer
Frequency
• The number of occurrences of a repeating event ‣ Per unit time: temporal freq.
‣ Per unit length: spatial freq.
time (or length)
Frequency Domain
• Fourier Transform
‣ Spatial domain → Frequency domain
https://ranabasheer.files.wordpress.com/2014/03/ft.gif http://hometheaterhifi.com/wp-content/uploads/2015/05/up-sampling-fig3-sm.jpg
Colored Noises
https://en.wikipedia.org/wiki/Colors_of_noise
white noise pink noise red noise
brown(ian) noise
Random Number Generator
• Pseudo (=not real) random number generator • Unpredictable
• Deterministic • Reproducible
Random Number Generator
for( int i=0; i<1000; ++i ) {
cout << drand48() << endl; } 0.000985395 0.176643 0.0913306 0.487217 0.454433 0.831292 0.56806 0.0508319 0.0189148 0.298197 . . .
Good Noise
• 𝒇(𝒑) = 𝑣 (𝒑∈ℝn, 𝑣∈ℝ), (𝑣∈[-1.0,1.0], average=0.0)
• Random to the human eye (Not every noise is equal.) • Controllable frequency and amplitude
• Reproducible (always same results)
• Smooth (no sharp feature, C2-continuity) • Correlated (coherency: 𝒑1≈𝒑2 → 𝒇1≈𝒇2)
• Band-limited (concentrated region in freq. domain.) • Invariant (indiscernible translation and rotation)
Coherent Noises
• Value noise • Perlin noise • Simplex noise • etc. http://libnoise.sourceforge.net/noisegen/index.htmlLattice & Value Noise
Lattice & Value Noise
Lattice & Value Noise
Interpolation
Names of Polynomials
degree name formula
1 linear (or monic) ax+b
2 quadratic ax2+bx+c
3 cubic ax3+bx2+cx+d
4 quartic ax4+bx3+cx2+dx+e
5 quintic ax5+bx4+cx3+dx2+ex+f
6 sextic (or hexic) ax6+bx5+cx4+dx3+ex2+fx+g
7 septic ax7+bx6+cx5+dx4+ex3+fx2+gx+h
8 octic ax8+bx7+cx6+dx5+ex4+fx3+gx2+hx+i
9 nonic ax9+bx8+cx7+dx6+ex5+fx4+gx3+hx2+ix+j
Interpolation
closest neighborhood linear interpolation smooth interpolation http://libnoise.sourceforge.net/noisegen/Interpolation
• The flaw is especially apparent when this function
is used to generate a bump-map texture.
http://libnoise.sourceforge.net/noisegen/
Lattice & Value Noise
• A lattice noise acts as a low pass filter. • Noise looks like blurry.
Infinite Domain
• Periodicity by (the first value) = (the last value)
Value Noise
• Divide the n-dimensional space into a lattice. • Assign a random value to each lattice point.
‣ Real value range: -1.0 ~ +1.0
• Get the noise value of a point by interpolating ‣ Two lattice values when n=1.
‣ Four lattice values when n=2. ‣ Eight lattice values when n=3.
Perlin(’s Gradient) Noise
• Divide the n-dimensional space into a lattice.
• Assign a random gradient to each lattice point. ‣ Gradient: unit vector
‣ Lattice value: (gradient vector) • (distance vector) ‣ Distance vector: (lattice point) - (query point)
• Get the noise value of a point by interpolating ‣ Two lattice values when n=1.
‣ Four lattice values when n=2. ‣ Eight lattice values when n=3.
Picking Gradients
• It needs to have enough variation to conceal the
fact that the function if not truly random.
• But, too much variation will cause unpredictable
behavior for the noise function.
• Predefined set of unit vectors (2D:8, 3D:12, 4D:32)
Why Gradient Noise?
• Non-aligned light and dark areas to a lattice
value noise gradient noise
http://libnoise.sourceforge.net/noisegen/ rotation invariant
Improved Perlin Noise
• Published at SIGGRAPH 2002 after almost 20 years
cubic interpolation quintic interpolation
(2t3+3t2) (6t5-15t4+10t3 )
http://http.developer.nvidia.com/GPUGems/elementLinks/fig05-07.jpg
Original Perlin Noise Improved Perlin Noise
discontinuous
of 2nd order derivative (zero curvature)
Improved Perlin Noise
cubic interpolation quintic interpolation
Improved Perlin Noise
cubic interpolation quintic interpolation
Cons. of Perlin Noise
• Zero at any lattice point
⇒ Value-gradient noise (value+gradient)
• Slow for higher dimensions
Simplex Noise
• Lower computational complexity • Linear dimensional scalibility
Simplex
• A simplest polygon tessellating n-D space • A hyper-tetrahedron with n+1 corners
‣ 1D: line segment ‣ 2D: triangle
‣ 3D: tetrahedron
Simplex
simplex vertex count hyper-cube vertex count
1D line 2 line 2 2D triangle 3 square 4 3D tetrahedron 4 hexahedron 8 4D pentachoron 5 tesseract 16
O(n)
O(2
n)
Simplex noise lattice points Perlin noise lattice pointsSimplex Noise
• Step1) Find the simplex including the query point.
Simplex Noise
Simplex vs Perlin
Worley(=Cell) Noise
• Point based approach (But, It also use grid.) • Noise value = the distance to the closest point
Fractal
• If you look at things in nature, they look like fractals.
• Various level of details in a mountain
‣ Large variations (mountains)
‣ Medium variations (hills)
‣ Small variations (boulders)
‣ Tiny variations (stones)
‣ . . .
Fractal
• Frequency: the number of cycles in unit length • Amplitude: the maximum absolute value
• Octave: successive coherent-noises • Lacunarity: scale factor of frequency
• Persistence(or gain): scale factor of amplitude
float value = 0.f;
for( int i=0;i<numOctaves;++i ) { value += noise( x*f, y*f, z*f ) * a; f *= lacunarity;
a *= persistence; }
fBm
• Fractal Brownian Motion
• The summation of successive octaves of noise,
each with higher frequency and lower amplitude.
http://libnoise.sourceforge.net/noisegen/
+ + +
fBm
• Fractal Brownian Motion
• The summation of successive octaves of noise,
each with higher frequency and lower amplitude.
+ + =
Procedural Textures
http://lodev.org/cgtutor/randomnoise.html http://devmag.org.za/2009/04/25/perlin-noise/
• Play with sin(), cos(), abs(), …
while combining octaves.