Textures
Describe color variation in interior of 3D polygon
o When scan converting a polygon, vary pixel colors according to values fetched from a texture
Texture Mapping
Adam Finkelstein Princeton University COS 426, Spring 2003
Texture Surface
Image
Angel Figure 9.3
3D Rendering Pipeline (for direct illumination)
3D Primitives 3D Modeling Coordinates Modeling Modeling Transformation Transformation 3D World Coordinates Lighting Lighting 3D World Coordinates Viewing Viewing Transformation Transformation 3D Camera Coordinates Projection Projection Transformation Transformation 2D Screen Coordinates Clipping Clipping 2D Screen Coordinates Viewport Viewport Transformation Transformation 2D Image Coordinates Scan Scan Conversion Conversion 2D Image Coordinates Image
Surface Textures
Add visual detail to surfaces of 3D objects
Texture mapping
With surface texture Polygonal model
Surface Textures
Add visual detail to surfaces of 3D objects
Overview
Texture mapping methods
o Parameterization o Mapping o Filtering
Texture mapping applications
o o o o o o Modulation textures Illumination mapping Bump mapping Environment mapping Image-based rendering Non-photorealistic rendering
[Daren Horley]
Parameterization
Option: Varieties of projections
+
geometry image
=
texture map
Q: How do we decide where on the geometry each color from the image should go?
[Paul Bourke]
Option: unfold the surface
Option: make an atlas
[Piponi2000]
charts
atlas
surface
[Sander2001]
Overview
Texture mapping methods
o Parameterization o Mapping o Filtering
Texture Mapping
Steps:
o Define texture o Specify mapping from texture to surface o Lookup texture values during scan conversion
(0,1)
Texture mapping applications
o o o o o o o Modulation textures Illumination mapping Bump mapping Environment mapping Image-based rendering Volume textures Non-photorealistic rendering y x Image Coordinate System
t s Texture Coordinate System
v
(0,0)
(1,0)
Modeling Coordinate System
Texture Mapping
When scan convert, map from
o image coordinate system (x,y) to o modeling coordinate system (u,v) to o texture image (t,s)
(1,1) (0,1)
Texture Mapping
Texture mapping is a 2D projective transformation
o texture coordinate system: (t,s) to o image coordinate system (x,y)
t s Texture Coordinate System
v
(0,0)
(1,0)
y x Image Coordinate System
Modeling Coordinate System
Allison Klein, Princeton
Texture Mapping
Scan conversion
o Interpolate texture coordinates down/across scan lines o Distortion due to bilinear interpolation approximation Cut polygons into smaller ones, or Perspective divide at each pixel
Texture Mapping
Linear interpolation of texture coordinates
Correct interpolation with perspective divide
Hill Figure 8.42
Overview
Texture mapping methods
o Parameterization o Mapping o Filtering
Texture Filtering
Must sample texture to determine color at each pixel in image
Texture mapping applications
o o o o o o Modulation textures Illumination mapping Bump mapping Environment mapping Image-based rendering Non-photorealistic rendering
Angel Figure 9.4
Texture Filtering
Aliasing is a problem
Texture Filtering
Ideally, use elliptically shaped convolution filters
Point sampling
Area filtering
Angel Figure 9.5
In practice, use rectangles
Texture Filtering
Size of filter depends on projective warp
o Can prefiltering images Mip maps Summed area tables
Mip Maps
Keep textures prefiltered at multiple resolutions
o For each pixel, linearly interpolate between two closest levels (e.g., trilinear filtering) o Fast, easy for hardware
Magnification
Minification
Angel Figure 9.14
Summed-area tables
At each texel keep sum of all values down & right
o To compute sum of all values within a rectangle, simply subtract two entries o Better ability to capture very oblique projections o But, cannot store values in a single byte S1 S2
Overview
Texture mapping methods
o Parameterization o Mapping o Filtering
Texture mapping applications
o o o o o o Modulation textures Illumination mapping Bump mapping Environment mapping Image-based rendering Non-photorealistic rendering
Modulation textures
Map texture values to scale factor
Wood texture
Illumination Mapping
Map texture values to surface material parameter
o o o o o KA KD KS KT n
Texture value
I = T ( s, t )( I E + K A I A + L ( K D ( N L) + K S (V R ) n ) S L I L + K T I T + K S I S )
KT = T(s,t)
I = I E + K A I A + L ( K D ( N L) + K S (V R ) n ) S L I L + K T I T + K S I S
Bump Mapping
Texture values perturb surface normals
Bump Mapping
H&B Figure 14.100
Environment Mapping
Texture values are reflected off surface patch
Image-Based Rendering
Map photographic textures to provide details for coarsely detailed polygonal model
H&B Figure 14.93
Solid textures
Texture values indexed by 3D location (x,y,z)
Expensive storage, or Compute on the fly, e.g. Perlin noise
Nonphotorealistic Rendering
Art-Maps
Summary
Texture mapping methods
o Parameterization o Mapping o Filtering
Texture mapping applications
o o o o o o o Modulation textures Illumination mapping Bump mapping Environment mapping Image-based rendering Volume textures Non-photorealistic rendering