




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Lecture 21
Slide 1
6.837 Fall 2001
ย^ Combining Textures ย^ Filtering Textures ย^ Textures and Shading ย^ Bump Mapping ย^ Solid Textures
Lecture 21
Slide 2
6.837 Fall 2001
ย^ Label textures ย^ Projective textures ย^ Environment maps ย^ Shadow maps ย^ โฆ
Lecture 21
Slide 3
6.837 Fall 2001
All these texture mapping modes are great!The problem is, no one of them does everything well.Suppose we allowed several textures to be applied to each primitiveduring rasterization.
Lecture 21
Slide 4
6.837 Fall 2001
Multipass (the old way) - Render the image in multiple passes, and "add"the results.Multitexture - Make multiple texture accesses within the rasterizing loopand "blend" results.Blending approaches:
ย^ Texture modulation ย^ Alpha Attenuation ย^ Additive textures ย^ Weird modes
Lecture 21
Slide 5
6.837 Fall 2001
Quake uses
light maps in addition to texture maps.
Texture maps are used
to add detail to surfaces, and light maps are used to store pre-computedillumination.
The two are multiplied together at run-time, and cached for
efficiency.^ Resolution
High
Low
Instanced
Yes^
No
Data
RGB^
Intensity
TextureMaps
Light Maps
Light map imageby Nick Chirkov
Lecture 21
Slide 6
6.837 Fall 2001
When texture mapping it is rare that the screen-space sampling densitymatches the sampling density of the texture. Typically one of two thingscan occur:
In the case of oversampling we already know what to do...Interpolation (review on Antialiasing and Resampling). But, how dowe handle undersampling?
Lecture 21
Slide 7
6.837 Fall 2001
Let's take a look at what undersampling looks like:Notice how details in the texture, in particular the mortar betweenthe bricks, tend to pop (disappear and reappear).This popping is most noticeable around details (parts of the texturewith a high-spatial frequency). This is indicative of aliasing (high-frequency details showing up in areas where we expect to see lowfrequencies).
Lecture 21
Slide 8
6.837 Fall 2001
Aliasing?
This was the phenomenon that occurred when we undersampled asignal. It caused certain high frequency features to appear as lowfrequencies. To eliminate aliasing we had to either band limit (low pass filter) our inputsignal or sample it at a higher rate:
Lecture 21
Slide 13
6.837 Fall 2001
Actually, you have a choice of ways to translate this
gradient value
into a MIP
level.This also brings up one of the shortcomings of MIP mapping. MIP mapping assumesthat both the
u and v components of the texture index are undergoing a uniform
scaling, while in fact the terms
du/dt and
dv/dt are relatively independent. Thus,
we must make some sort of compromise. Two of the most common approaches aregiven below: The differences between these level selection methods is illustrated by theaccompanying figure.
Lecture 21
Slide 14
6.837 Fall 2001
There are other approaches to computing this prefiltering integration on the fly. One, which was introduced by Frank Crow is called a
summed-area table. Basically, a summed-
area table is a tabularized two-dimensional cumulative distribution function. Imagine having a2-D table of numbers the cumulative distribution function could be found as shown below.
T (x
, y 1 )^ -^ 1 T (x
, y 0 )^ -^ 1
T (x
, y 1 )^ + 0 T (x
, y 0 ) 0
To find the sum of region contained in a box bounded by
(x^0
, y)^0
and
(x^1 , y^1 ) :
This approach can be used to compute the integration of pixels that lie undera pixel by dividing the resulting sum by the area of the rectangle,
(y^1
- y^0 )(x^1 - x ). 0
With a little more work you can compute the area under any four-sidedpolygon (How?).
Lecture 21
Slide 15
6.837 Fall 2001
ยHow much storage does a summed-area table require? ยDoes it require more or less work per pixel than a MIP map? ยWhat sort of low-pass filter does a summed-area table represent? ยWhat do you remember about this sort of filter?
No filtering These nice images were originally grabbed from a link on the http://www.gris.unituebingen.de/ web page.
MIP mapping
Summed-Area Table
Lecture 21
Slide 16
6.837 Fall 2001
To this point we've only used textures as labels over geometry.Their applications are much broader, however.
Simple extensions include: ย^ Spatially varying surface properties:
ยบ^ The diffuse shading coefficient,
k^ , could be stored as a texture.d
ยบ^ Likewise for the intrinsic color,
k^ ,a k^ , ands^
nshiny
.
ย^ Textures can also be used in a lot of other ways
Lecture 21
Slide 17
6.837 Fall 2001
Phong's Illumination Model
Constant Diffuse Color
Diffuse Texture Color
Texture used as Label
Texture used as Diffuse Color
Lecture 21
Slide 18
6.837 Fall 2001
Textures can be used to alter the surface normal of an object. This does not change the actualshape of the surface -- we are only shading it as if it were a different shape! This technique iscalled
bump mapping. The texture map is treated as a single-valued height function. The value of the function is not actually used, just its partial derivatives. The partial derivatives tellhow to alter the true surface normal at each point on the surface to make the object appearas if it were deformed by the height function.Since the actual shape of the object does not change, the silhouette edge of the object willnot change. Bump Mapping also assumes that the Illumination model is applied at every pixel(as in Phong Shading or ray tracing).
Sphere w/Diffuse Texture
Swirly Bump Map
Sphere w/Diffuse Texture & Bump Map
Lecture 21
Slide 19
6.837 Fall 2001
T v uz v u y v u x
v
v u^
v v v^
v u B P P^
v
v
v v^
v
v v v v v v
v D
u
v v
u
v N
v P^ v v P u P^ v N^
v v^ ร
P^ u N^
v v^ รโ
v N โฒ^ v^ D
โ
โ+ โ โโ =^
2
), ( ), (^
t s B t sB Bu
โ
โ+
โ โโ
=^
2
) ,( ) ,(
ts B ts B Bv^ Compute bump map partialsby numerical differentiation
Lecture 21
Slide 20
6.837 Fall 2001
u
u u u^
v v v v
v v^
v
v v v^
v v
v v
v v^
v u B P P^
v
v
v v^
v u^
v v v
2
v u u v v u v
u^
v
v v
v
v v
v
v v
v v v^
small... very is
Assume
so 0
and
But
u
u
v u
v v v v v v v v v N
u
v v
u^
v
v v
v
v v
v v^
Lecture 21
Slide 25
6.837 Fall 2001
Image from Ken Musgrave
Lecture 21
Slide 26
6.837 Fall 2001
solid
textures.Solid textures are very effective atrepresenting some types of materials such asmarble and wood. Generally, solid texturesare defined procedural functionsrather thantabularized or sampled functions as used in2-D (Any guesses why?)The approach that we will explore is basedon An Image Synthesizer, by Ken Perlin, SIGGRAPH '85.The vase to the right is from this paper.
Lecture 21
Slide 27
6.837 Fall 2001
When we say we want to create an "interesting" texture, we usually don'tcare exactly what it looks like -- we're only concerned with the overallappearance. We want to add random variations to our texture, but in acontrolled way. Noise and turbulence are very useful tools for doing justthat.A noise function is a continuous function that varies throughout space at a uniform frequency. To create a simple noise function, consider a 3Dlattice, with a random value assigned to each triple of integercoordinates:
Lecture 21
Slide 28
6.837 Fall 2001
To calculate the noise value of any point in space, we first determinewhich cube of the lattice the point is in. Next, we interpolate the desiredvalue using the 8 corners of the cube: Trilinear interpolation is illustrated above. Higher-order interpolation canalso be used.
Lecture 21
Slide 29
6.837 Fall 2001
Since noise is a 3D function, we can evaluate it at any point we want.We don't have to worry about about mapping the noise to the object,we just use (x, y, z) at each point as our 3D texture coordinates! It is asif we are carving our object out of a big block of noise.
Original Object
Trilinear Noise
Triquadratic Noise
Lecture 21
Slide 30
6.837 Fall 2001
Noise is a good start, but it looks pretty ugly all by itself. We can use noiseto make a more interesting function called turbulence. A simple turbulencefunction can be computed by summing many different frequencies of noisefunctions:
One Frequency
Two Frequencies
Three Frequencies
Four Frequencies
Now we're getting somewhere. But even turbulence is rarely used allby itself. We can use turbulence to build even more fancy 3Dtextures...
Lecture 21
Slide 31
6.837 Fall 2001
We can use turbulence to generate beautiful 3Dmarble textures, such as the marble vase created byKen Perlin. The idea is simple. We fill space withblack and white stripes, using a sine wave function.Then we use turbulence at each point to distort thoseplanes.
By varying the frequency of the sin function,
you get a few thick veins, or many thin veins. Varyingthe amplitude of the turbulence function controls howdistorted the veins will be.
Marble = sin(f * (x + A*Turb(x,y,z)))
Lecture 21
Slide 32
6.837 Fall 2001