Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.

Similar presentations


Presentation on theme: "1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing."— Presentation transcript:

1 1 Texture Mapping

2 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing

3 3 The Limits of Geometric Modeling Although graphics cards can render over 10 million polygons per second, that number is insufficient for many phenomena Clouds Grass Terrain Skin

4 4 Modeling an Orange – 1/2 Consider the problem of modeling an orange (the fruit) Start with an orange-colored sphere Too simple Replace sphere with a more complex shape Does not capture surface characteristics (small dimples) Takes too many polygons to model all the dimples

5 5 Modeling an Orange – 2/2 Take a picture of a real orange, scan it, and “ paste ” onto simple geometric model This process is texture mapping Still might not be sufficient because resulting surface will be smooth Need to change local shape Bump mapping

6 6 The Quest for Visual Realism

7 7 Three Types of Mapping Texture Mapping Uses images to fill inside of polygons Environmental (reflection mapping) Uses a picture of the environment for texture maps Allows simulation of highly specular surfaces Bump mapping Emulates altering normal vectors during the rendering process

8 8 Texture Mapping geometric model texture mapped

9 9 Decal Textures

10 10 Bump Mapping

11 11 Where does Mapping take place? Mapping techniques are implemented at the end of the rendering pipeline Very efficient because few polygons pass down the geometric pipeline

12 12 Simple Texture Mapping s t x y z image geometry screen

13 13 Is it Simple? Although the idea is simple---map an image to a surface---there are 3 or 4 coordinate systems involved 2D image 3D surface

14 14 Coordinate Systems Parametric coordinates May be used to model curved surfaces Texture coordinates Used to identify points in the image to be mapped World Coordinates Conceptually, where the mapping takes place Screen Coordinates Where the final image is really produced

15 15 Texture Mapping parametric coordinates texture coordinates world coordinates screen coordinates

16 16 Texture Mapping = Pattern Mapping

17 17 Mapping Functions Basic problem is how to find the maps Consider mapping from texture coordinates to a point a surface Appear to need three functions x = x(s,t) y = y(s,t) z = z(s,t) But we really want to go the other way s t (x,y,z)

18 18 Backward Mapping We really want to go backwards Given a pixel, we want to know to which point on an object it corresponds Given a point on an object, we want to know to which point in the texture it corresponds Need a map of the form s = s(x,y,z) t = t(x,y,z) Such functions are difficult to find in general

19 19 Sample Mapping – 1/2 In next topic, we will study parametric surfaces Assume we want to map a point in the texture map T(s, t) to a point on the surface p(u, v) by a linear map of the form: u=as + bt + c v=ds + et + f as long as ae  bd, this mapping is invertible

20 20 Sample Mapping – 2/2

21 21 Mapping a Texture Based on parametric texture coordinates s t 1, 1 0, 1 0, 01, 0 (s, t) = (0.2, 0.8) (0.4, 0.2) (0.8, 0.4) A BC a b c Texture SpaceObject Space

22 22 Two-part Mapping One solution to the mapping problem is to first map the texture to a simple intermediate surface Example: map to cylinder

23 23 Cylindrical Mapping parametric cylinder x = r cos 2  u y = r sin 2  u z = v/h maps rectangle in u,v space to cylinder of radius r and height h in world coordinates s = u t = v maps from texture space

24 24 Spherical Mapping We can use a parametric sphere x = r cos 2  u y = r sin 2  u cos 2  v z = r sin 2  u sin 2  v in a similar manner to the cylinder but have to decide where to put the distortion Spheres are use in environmental maps

25 25 Box Mapping Easy to use with simple orthographic projection Also used in environmental maps

26 26 Second Mapping Map from intermediate object to actual object Normals from intermediate to actual Normals from actual to intermediate Vectors from center of intermediate intermediate actual What if a ray is blocked?

27 27 Texture Example The texture (below) is a 256 x 256 image that has been mapped to a rectangular polygon which is viewed in perspective mode

28 28 Linear Interpolation of Textures

29 29 Texture Mapping & Polygon Rasterization Problems of linearly interpolating texture coordinates in screen space. Similar problems in the interpolations of colors for Gouraud shading and normals for Phong shading. Problems in antialiasing Expanding and shrinking

30 30 Example

31 31 Perspective Correction Dividing the texture coordinates by w Linearly interpolating (u/w, v/w, 1/w) At each pixel, dividing (interpolated) u/w and v/w by (interpolated) 1/w

32 32 Aliasing Point sampling of the texture can lead to aliasing errors point samples in u,v (or x,y,z) space point samples in texture space miss blue stripes

33 33 Area Averaging A better but slower option is to use area averaging Note that preimage of pixel is curved pixel preimage

34 34 Sampling Texture Maps

35 35 Over-Sampling indicative of aliasing high-frequency details showing up in areas where we expect to see low frequencies

36 36 Spatial Filtering Prefilter the texture to remove the high frequencies that show up as artifacts

37 37 Mip Mapping MIP Mapping is one popular technique for precomputing and performing this prefiltering Computing this series of filtered images requires only a small fraction of additional storage over the original texture

38 38 Magnification and Minification More than one texel can cover a pixel (minification) or more than one pixel can cover a texel (magnification) Can use point sampling (nearest texel) or linear filtering ( 2 x 2 filter) to obtain texture values TexturePolygon MagnificationMinification PolygonTexture

39 39 Examples point sampling mipmapped point sampling mipmapped linear filtering linear filtering

40 40 Environment Mapping

41 41 Sphere Mapping

42 42 Box Mapping

43 43 Bump Mapping

44 44 Bump Mapping

45 45 Bump Mapping

46 46 Displacement Mapping

47 47 Bump Mapping versus Displacement Mapping

48 48 Texture Mapping in Quake

49 49 Shadow Maps

50 50 Basic Steps of Shadow Maps Render the scene from the light ’ s point of view, Use the light ’ s depth buffer as a texture (shadow map), Projectively texture the shadow map onto the scene, Use “ texture color ” (comparison result) in fragment shading.

51 51 Three Dimensional or Solid Textures

52 52 Tri-linear Interpolation

53 53 Line Aliasing Ideal raster line is one pixel wide All line segments, other than vertical and horizontal segments, partially cover pixels Simple algorithms color only whole pixels Lead to the “ jaggies ” or aliasing Similar issue for polygons

54 54 Antialiasing Can try to color a pixel by adding a fraction of its color to the frame buffer Fraction depends on percentage of pixel covered by fragment Fraction depends on whether there is overlap no overlapoverlap

55 55 Area Averaging Use average area  1 +  2 -  1  2 as blending factor

56 56 Image Filtering H: Filter(convolution) matrix of (2m+1)×(2n+1) Examples:

57 57 Motion Blur Jitter an object and render it multiple times, leaving the positions of the other objects unchanged, we get dimmer copies of the jittered object If the object is moved along a path, rather then randomly jittered, we see the trail of the object  motion blur


Download ppt "1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing."

Similar presentations


Ads by Google