![Page 1: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/1.jpg)
Noise and Procedural Techniques
John SpitzerSimon Green
NVIDIA Corporation
![Page 2: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/2.jpg)
Overview
• What is procedural texturing?• Advantages and disadvantages• When to use procedural texturing• What is noise?• Ideal noise characteristics• Spectral synthesis• Demos...
![Page 3: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/3.jpg)
What is Procedural Texturing?
• Code vs. tables
• Classic time vs. storage space trade-off
![Page 4: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/4.jpg)
Advantages of Procedural Texturing
• Compact- code is small (compared to textures)
• No fixed resolution- "infinite" detail, limited only by precision
• Unlimited extent- can cover arbitrarily large areas, no repeating
• Parameterized- can easily generate a large no. of variations on a theme
• Solid texturing (avoids 2D mapping problem)
![Page 5: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/5.jpg)
Disadvantages of Procedural Texturing
• Computation time (big ouch!)
• Hard to code and debug
• Aliasing
![Page 6: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/6.jpg)
When to use Procedural Textures
• Don’t use them just for the hell of it!• Procedurals are good for animating
effects – fire, water, clouds, explosions…
• ..or anywhere where a repeating texture would be obvious
• Combine the best aspects of both techniques – e.g. painted maps + noise to add variation
![Page 7: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/7.jpg)
Procedural Noise• Noise is an important part of many
procedural textures• Used everywhere in production
rendering• Procedural noise provides a controlled
method of adding randomness to:– Color, texture– Bump map / displacement maps– Animation– Terrains, anything else…
![Page 8: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/8.jpg)
Ideal Noise Characteristics
• Can’t just use rand()!• An ideal noise function has:
– repeatable pseudorandom values– specific range (typically [-1,1] or [0,1])– band-limited frequency ~= 1– no obvious repeating patterns– invariance under rotation and translation
• “Random yet smooth”
![Page 9: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/9.jpg)
What does Noise look like?• Imagine creating a big block of random
numbers and blurring them:
![Page 10: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/10.jpg)
What does Noise look like?
0
1
-1
1 2 3 4 5 6
• Random values at integer positions• Varies smoothly in-between. In 1D:
7 8x
noise(x)
• This is value noise, gradient noise is zero at integer positions
![Page 11: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/11.jpg)
Spectral Synthesis
• Narrow-band noise by itself is not very exciting
• Summations of multiple frequencies are!• Like Fourier synthesis (summing sine waves)• Each layer is known as an “octave” since
the frequency typically doubles each time• Increase in frequency known as “lacunarity”
(gap)• Change in amplitude/weight known as
“gain”
![Page 12: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/12.jpg)
Fractal Sum
=
+1/41/2
+1/8 +1/16
Freq = 1 Freq = 2
Freq = 4 Freq = 8
![Page 13: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/13.jpg)
Turbulence• Ken Perlin’s trick – assumes noise is signed
[-1,1]• Exactly like fBm, but take absolute value of
noise• Introduces discontinuities that make the
image more “billowy”float turbulence(float3 p, int octaves, float lacunarity, float gain){ float sum = 0; float amp = 1; for(int i=0; i<octaves; i++) { sum += amp * abs(noise(p)); p *= lacunarity; amp *= gain; } return sum;}
![Page 14: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/14.jpg)
Turbulence
=
![Page 15: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/15.jpg)
Pixel Shader Noise
• Implementation of Perlin’s original (Academy-award winning) algorithm
• Gradient noise over R3, scalar output
• Uses 2 1D textures as look-up tables
• Compiles to around 40 instructions
![Page 16: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/16.jpg)
Pixel Shader Noise using 3D Textures
• Pre-compute 3D texture containing random values
• Pre-filtering with tri-cubic filter helps avoid linear interpolation artifacts
• 4 lookups into a single 64x64x64 3D texture produces reasonable looking turbulence
![Page 17: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/17.jpg)
Applying Colour Tables to Noise
![Page 18: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/18.jpg)
Using Noise to Perturb Patterns
colormap(sin(x + turbulence(P)))
![Page 19: Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation](https://reader036.vdocuments.site/reader036/viewer/2022062405/56649f275503460f94c3e8ae/html5/thumbnails/19.jpg)
Questions, comments, feedback?• [email protected]• www.nvidia.com/developer