Graphics Reference
In-Depth Information
picking them from the set 12 vectors from the center of a cube to its edge mid-
points, namely,
( 1, 1, 0 )
(
1, 1, 0 )
( 1,
1, 0 )
(
1,
1, 0 )
(20.15)
( 1, 0, 1 )
(
1, 0, 1 )
( 1, 0,
1 )
(
1, 0,
1 )
(20.16)
( 0, 1, 1 )
( 0,
1, 1 )
( 0, 1,
1 )
( 0,
1,
1 ) ,
(20.17)
to avoid a kind of bias in which the gradient of the noise function ends up pref-
erentially aligned with the coordinate axes. By appending a redundant row to this
list, namely,
( 1, 1, 0 )
(
1, 1, 0 )
( 0,
1, 1 )
( 0,
1,
1 ) ,
(20.18)
we end up with 16 vectors, which makes it easy to use bitwise arithmetic to select
one of them.
Having assigned a gradient vector uvw T to the lattice point ( i , j , k ) we
define a linear function
g i , j , k ( x , y , z )= u ( x
i )+ v ( y
j )+ w ( z
k ) .
(20.19)
1.0
0.5
0.0
To find the noise value at a point ( x , y , z ) ,welet i 0 , j 0 , and k 0 be the floor of x , y ,
and z , respectively, so that i 0
−0.5
i 0 + 1, and similarly for y and z , and the eight
corners of the grid cube containing ( x , y , z ) have coordinates ( i 0 , j 0 , k 0 ) , ( i 0 , j 0 , k 0 +
1 ) , ( i 0 , j 0 + 1, k 0 ) ,
x
<
−1.0
6
5
4
4
, ( i 0 + 1, j 0 + 1, k 0 + 1 ) . For each corner ( i , j , k ) , we evaluate the
linear function associated to that corner at the point ( x , y , z ) to get a value v i , j , k .We
blend these values trilinearly using a ( x f ) , a ( y f ) , and a ( z f ) . A direct but inefficient
implementation is given in Listing 20.1 (the function a of Equation 20.14 must
also be defined). Perlin [Per02a] provides an optimized implementation.
The result (in 2D) is shown in Figures 20.16 and 20.17.
We can use 3D Perlin noise to create a radial displacement map on a sphere,
while also coloring points by their displacement, to get a result like that shown in
Figure 20.18.
Perlin [Per85] describes far more complex applications, allowing him to pro-
duce things like the marble texture in Figure 20.19.
...
3
2
2
1
0
0
Figure 20.16: 2D Perlin noise on
a 6 × 6 region of the plane.
20.8.3 Reaction-Diffusion Textures
A third approach to texture synthesis is due to an idea by Turing [Tur52] about
the formation of patterns like leopard spots or snake scales in nature. He con-
jectured that such patterns could arise from evolving concentrations of chemicals
called morphogens. Typically, one starts with two morphogens, with concentra-
tions randomly distributed across a surface. They evolve through a combination
of two processes: diffusion, in which high concentrations of morphogens diffuse
to fill in areas of low concentration, and reaction, in which the two morphogens
combine chemically to either produce or consume one or both of the morphogens.
If the presence of A promotes the production of B , but the presence of B promotes
the consumption of A , for instance, interesting patterns can arise. The appearance
Figure 20.17: The same function,
displayed as a grayscale image
where 1 is black and + 1 is white.
 
 
 
Search WWH ::




Custom Search