Texture Mapping 1 Overview Modeling with textures motivation texture coordinates Texture mapping implementation Anti-aliasing and level of detail 2 1
Texture mapping Model surface-detail with images wrap objects with photographs model and render color or flat detail does not capture 3D detail 3 Texture mapping example Model t-shirt with logo no need to model the letters and engine with triangles use large base polygon color it with the photograph 4 2
Texture mapping example Subtle wall lighting no need to compute it at every frame no need to model it with a lot of constant color triangles 5 Texture mapping example Subtle wall lighting paste photograph on large polygon 6 3
Texture mapping example Non-planar surfaces work also 7 Texture mapping example Non-planar surfaces work also subdivide surface into planar patches assign photograph subregions to each individual patch 8 4
Texture mapping example Non-planar surfaces work also subdivide surface into planar patches assign photograph subregions to each individual patch 9 Texture mapping example Non-planar surfaces work also subdivide surface into planar patches assign photograph subregions to each individual patch 10 5
Texture mapping example bark veneer Generic image to represent material tile pattern to cover big surface bricks 11 Tiling Repeat pattern 12 6
Tiling Repeat pattern 13 Tiling Repeat pattern 14 7
Tiling Repeat pattern reduce seems by mirroring 15 Tiling Repeat pattern reduce seems by mirroring 16 8
Tiling Repeat pattern reduce seems by mirroring 17 Tiling Repeat pattern reduce seems by mirroring 18 9
Tiling Repeat pattern reduce seems by mirroring reduce seems by choosing tile that covers one period of repeated texture 19 Tiling 20 10
Texture mapping limitations 21 Bricks are similar not identical 22 11
Texture mapping limitations Shiny floor reflection is view dependent 23 Texture coordinates Mechanism for attaching the texture map to the surface modeled a pair of floats (s, t) for each triangle vertex corners of the image are (0, 0), (0, 1), (1, 1), and (1, 0) tiling indicated with tex. coords. > 1 texels color samples in texture maps 24 12
Texture coordinates P 2 (0, 0) P 1 (1, 0) P 3 (0, 1) P 4 (1, 1) y O x z 25 Overview Modeling with textures motivation texture coordinates Texture mapping implementation Anti-aliasing and level of detail 26 13
Overview Modeling with textures motivation texture coordinates Texture mapping implementation Anti-aliasing and level of detail 27 Texture mapping a P 2 (0, 0) P 3 (0, 1) P 1 (1, 0) c P 2 P 4 (1, 1) y P 1 P 3 z O x C b 28 14
Find texel for current pixel P 1 (u 1, v 1, s 1, t 1 ) P (u, v, s, t) P 3 (u 3, v 3, s 3, t 3 ) P 2 (u 2, v 2, s 2, t 2 ) 29 Texture mapping P 2 (s 2, t 2 ) P(s, t) P 1 (s 1, t 1 ) a y c P P 2 P 3 P 1 P 3 (s 3, t 3 ) z O x C b 30 15
Texture mapping problem: compute the texture coordinates for an interior pixel a P 2 (s 2, t 2 ) P(s, t) P 1 (s 1, t 1 ) y c P P 2 P 3 P 1 P 3 (s 3, t 3 ) z O x C b 31 Texture mapping solution: interpolate vertex texture coordinates P 2 (s 2, t 2 ) P(s, t) P 1 (s 1, t 1 ) a y c P P 2 P 3 P 1 P 3 (s 3, t 3 ) z O x C b 32 16
Overview Modeling with textures motivation texture coordinates Texture mapping implementation Anti-aliasing and level of detail 33 Overview Modeling with textures motivation texture coordinates Texture mapping implementation Anti-aliasing and level of detail 34 17
Aliasing sampling locations (desired image pixel centers) texture map 35 Aliasing sampling locations (desired image pixel centers) texture map 36 18
Aliasing High frequencies pose as lower frequencies display resolution gives maximum displayable frequency if not sufficient high frequencies are called (aliased as) low frequencies Nyquist law max frequency displayable is half the sampling frequency 37 Nyquist law for given texture map, one should sample at least this frequently to avoid aliasing 38 19
Nyquist law for given texture map resolution, one should sample at least this frequently to avoid aliasing 39 Possible Antialiasing Solution convolution with 2 outputpixel-wide kernel EXPENSIVE 40 20
Level of detail Adapt texture resolution to desired image resolution Mip-mapping texture is filtered as preprocess to several resolutions at runtime find out required resolution use corresponding version of texture map 41 Mip-mapping: example 256x256 128x128 64x64 42 21
Trilinear filtering Use two most appropriate resolutions of texture map lookup color values with bilinear interpolation in each texture version linearly interpolate in between the two color values 43 Trilinear filtering: example bilinear bilinear linear 44 22
Anisotropic filtering Different levels of detail are needed along the two directions in the texture map filter differently along s and t 63 desired image view of polygon 312 trilinear interpolation between levels 32 and 64 blurs too much along the s direction use levels 256 512 for s and 32 64 for t 45 23