Notice how the texture seems to bend and warp along the diagonal
triangle edges. Let's take a closer look at what is going on.
Let's assume that the viewport is located 1 unit away from the center of
projection.
to interpolation in 3-space
Applet with
subdivided
triangles
…
if (w<wbuffer[x]) {
wbuffer[x]=w;
raster.setPixel(x, texturemap[tile(correct_s, max), tile(correct_t, max)])
}
…
int tile(int val, int size) {
if (val >= size) {
do { val -= size; } while (val >= size);
} else {
while (val < 0) { val += size; }
}
return val;
} Tiling applet
…
if (w<wbuffer[x]) {
Color4=raster.setPixel(x,
oldColor=raster.getPixel(x);
textureColor= texturemap[tile(correct_s, max), tile(correct_t, max)];
float t= textureColor.transparency()
newColor = t*textureColor+ (1-t)*oldColor;
raster.setPixel(x, newColor)
wbuffer[x]=w; //NOT SO SIMPLE.. BEYOND THE SCOPE OF THIS LECTURE
}
…
Applet showing
texture
transparency
Constant Diffuse Color Diffuse Texture Color Texture used as Label Texture used as Diffuse Color
Environment maps
Shadow maps
…
Instanced Yes No
Since the actual shape of the object does not change, the silhouette edge of the object will
not change. Bump Mapping also assumes that the Illumination model is applied at every pixel
(as in Phong Shading or ray tracing).
v v v v B ( s − ∆, t ) − B ( s + ∆, t )
Bu =
N ′ ≈ N + Bu Pu + Bv Pv 2∆
142 v
43 B ( s, t − ∆ ) − B ( s, t + ∆ )
D Bv =
2∆
Variation of normal in v direction
v General case
P = [ x(u , v), y (u , v), z (u , v)]T Initial point
v
N′ v
Pv
v v v
N = Pu × Pv Normal
v v
v − N ×P
u
v
v v B(u , v) N v Pu
P′ = P + v Simulated elevated point after bump D v v
N × Pv
N
v v v v
v Bu (N × Pv ) − Bv (N × Pu )
Variation of normal in u direction
v Bu =
B ( s − ∆, t ) − B ( s + ∆, t )
N′ ≈ N + v 2∆
N B ( s, t − ∆ ) − B ( s, t + ∆ )
1444 42 4444 3 Bv =
v 2∆
D Variation of normal in v direction
Bump Map
Cylinder w/Diffuse Texture Map Cylinder w/Texture Map & Bump Map
Image from
Geometry Caching for
Ray-Tracing Displacement Maps
by Matt Pharr and Pat Hanrahan.
Now we're getting somewhere. But even turbulence is rarely used all
by itself. We can use turbulence to build even more fancy 3D
textures...