CSE 681 Perlin Noise Turbulence Functions - PowerPoint PPT Presentation

1 / 34
About This Presentation
Title:

CSE 681 Perlin Noise Turbulence Functions

Description:

Perlin Noise (Turbulence) Functions. Noise. Nature has a random or fractal look ... Turbulence ... Building a 1D Turbulence Function. Pre-compute noise ... – PowerPoint PPT presentation

Number of Views:246
Avg rating:3.0/5.0
Slides: 35
Provided by: naeems
Category:

less

Transcript and Presenter's Notes

Title: CSE 681 Perlin Noise Turbulence Functions


1
CSE 681Perlin Noise (Turbulence) Functions
2
Noise
  • Nature has a random or fractal look
  • Level of detail property
  • Mountain range
  • Coastline

Ken Musgrave
Gunther Berkus via Mojoworld
3
Level Of Detail
  • Level of detail defines fractional dimensions
  • Detail at all levels of magnification

4
Perlin Noise
  • Ken Perlin (1985) defined Perlin noise that could
    be used to define natural looking textures

Ken Musgrave
Ken Perlin, 1985
5
Perlin Noise
  • Goal Textures that look natural
  • Tools (fractal properties)
  • Randomness
  • Level of detail (scale)

6
Noise Function
  • Random values 0 1 defined on an integer
    (discrete) lattice
  • Use a random number generator

7
Resolution
  • Take examples on a 2D integer lattice
  • What resolution (or scale) do we use?
  • Remember, we want to evaluate at any (s, t, r)

10 x 10
64 x 64
256 x 256
8
Noise Function Interpolation
9

10
11
12
13
14

9
Level of Detail Magnification
  • What if we zoom into the noise texture?

10
Level of Detail Minification
  • What if we zoom out of the noise texture?

Sample too sparsely - no continuity
11
Turbulence
  • Idea Construct a noise function by adding
    together noise functions sampled at different
    scales
  • Scale sample resolution frequency
  • Function values (random) amplitude

12
Turbulence
13
1D Turbulence Sin Wave Examplesin(x)
14
1D Turbulence Example sin(x), 1/2 sin(2x)
Half amplitude Double Frequency
15
1D Turbulence Example sin(x), 1/2 sin(2x),
1/4 sin(4x)
16
1D Turbulence Example Add sin(x) 1/2 sin(2x)
17
1D Turbulence Example Add sin(x) 1/2
sin(2x) 1/4 sin(4x)
18
1D Turbulence Example Add sin(x) 1/2
sin(2x) 1/4 sin(4x) 1/8 sin(8x)
19
1D Turbulence Noise Example
20
2D Turbulence Example
21
Building a 1D Turbulence Function
  • Define noise functions on the interval 0 1
    with increasing resolutions
  • Lets assume power of two resolutions

0
1
20
21
  • Evaluate at a location x Î 0 1
  • Interpolate on each scale
  • Evaluate at any location

22
23
22
Building a 1D Turbulence Function
  • Pre-compute noise functions into textures
  • Sample and interpolate on the textures
  • Large storage cost
  • One 3D texture per resolution
  • Compute on-the-fly

23
Building a 1D Turbulence Function
  • double turbulence(double x)
  • double value 0
  • double f
  • for (f MINFREQ f lt MAXFREQ f 2)
  • value noise(x f) / f
  • return(value)

Frequency a power of two
  • Random number generator
  • Can add smoothing here

Amplitude
24
The Noise Function
  • double noise(double x)
  • int int_x (int)x
  • double fract_x x int_x
  • double r1 random(int_x)
  • double r2 random(int_x 1)
  • return interpolate(r1, r2, fract_x)
  • Noise depends on the location x
  • Each integer lattice location must be assigned
    only one random value
  • An integer lattice value may be used many times
    for texture sampling
  • How do we define random to ensure this?

25
Random Number Invariance
  • We want to ensure that the random numbers
    generated at each scale and integer lattice
    location does not change at each function
    evaluation
  • Use a seeded random number generator
  • Use a prime number generator (one per scale)
  • Pre-compute random numbers

26
Random Number Invariance
  • Assume our highest texture resolution is 256
  • Construct a table of random numbers
  • NoiseTable256 random values 0, 1
  • Construct a table of index values
  • Index256 Random permutations of values 0,
    255
  • random(i) NoiseTableIndexi, where i is an
    integer lattice location

27
Building a 3D Turbulence Function
Use a 256 x 256 x 256 Array
Deposit random values at integer grid points
28
Random Number Generation
  • Construct 1D tables
  • NoiseTable256 random values 0, 1
  • Index256 Random permutations of values 0,
    255
  • Random number depends upon integer lattice
    location
  • define PERM(v) Indexv 255
  • define INDEX(ix, iy, iz) PERM(ix PERM(iy
    PERM(iz)))
  • double random(i, j, k)
  • return NoiseTableINDEX(i, j, k)

29
3D Volume Interpolation
d110
30
3D Turbulence Function
  • double turbulence(double x, double y, double z)
  • double value 0
  • double f
  • for (f MINFREQ f lt MAXFREQ f 2)
  • value noise(x f, y f, z f) / f
  • return(value)
  • noise(x, y, z)
  • Get integer (ix, iy, iz) and fractional parts
    (fx, fy, fz)
  • Get cell lattice noise values
  • d000,d001,d010,d011, d100,d101,d110,d111
  • Do the trilinear interpolation by fx, fy, fz

31
Smoothing
  • Smooth out the sharp function slopes between the
    lattice values
  • Why ? - Theres a discontinuity in the
    derivatives between neighboring lattice element
    values
  • Alternative is to use higher order interpolation
  • Cubics, cosine interpolation, hermite splines
    can be expensive!

before
after
32
Wood and Marble Textures
  • Marble
  • texture cos( x turbulence(x, y, z))
  • Weight this on two colors (black and white here)
  • Wood
  • g turbulence (x, y, z) 20, grain g -
    int(g)
  • Use this with our concentric rings

33
More Marble
  • double marble(x, y, z)
  • return undulate(sin(2pz Aturbulence(x, y,
    z)))
  • undulate(double x)
  • if (x lt -0.4)
  • return 0.15 2.857 SQR(x 0.75)
  • else if ((x lt 0.4)
  • return 0.95 2.8125 SQR(x)
  • else
  • return 0.26 2.66 SQR(x - 0.7)
  • define SQR(x) x x

34
More Marble
  • double marble(x, y, z)
  • return (1 sin(pz turbulence( 3p/ 2 x, 3p/2
    y, 3p/2 z))) / 1.25 / 2
  • Given a base color compute a texture color as
  • white (1, 1, 1)
  • t marble(x, y, z)
  • baseColor (1 - t) white t
Write a Comment
User Comments (0)
About PowerShow.com