texture mapping
play

Texture Mapping Motivation: Add interesting and/or realistic detail - PowerPoint PPT Presentation

Texture Mapping Motivation: Add interesting and/or realistic detail to surfaces of objects. Problem: Fine geometric detail is difficult to model and expensive to render. Idea: Modify various shading parameters of the surface by


  1. Texture Mapping

  2.  Motivation: Add interesting and/or realistic detail to surfaces of objects.  Problem: Fine geometric detail is difficult to model and expensive to render.  Idea: Modify various shading parameters of the surface by mapping a function (such as a 2D image) onto the surface.

  3. Texture Mapping Example  Texture:  Result:

  4. Texture Mapping Example  Given an image, think of it as a 2D function from [0,1] 2 (texture coordinates) to the RGB color space:  T ( u , v ) ( r , g , b )  For each geometric primitive, define a mapping M that maps points on the surface to texture coordinates:  M x y z ( , , ) ( , ) u v  To shade a pixel corresponding to a point (x,y,z) on the surface, use the color:  ( , , ) r g b T M x y z ( ( , , ))

  5. Affected Parameters  Final color  Reflectance (either diffuse or specular)  Surface normal (bump mapping)  Transparency  Reflected color (environment mapping)  Any combination of the above

  6. Bump Mapping

  7. Bump Mapping

  8. Bump Mapping  Texture = change in surface normal! Sphere w/ diffuse texture Sphere w/ diffuse texture Swirly bump map and swirly bump map

  9. Parametrizing Objects  Certain objects have a natural parameterization (e.g., Bezier patches)  Polygons (triangles): each vertex is assigned a pair of texture coordinates (u,v). Inside, linear interpolation is used.  How do we handle a more complex object?

  10. Two-Step Texture Mapping (Bier and Sloan 1986)  Step I: define a mapping between the texture and some intermediate surface:  plane  cylinder  sphere  Cube  Step II: Project intermediate surface onto object surface

  11. Two-step Texture Mapping

  12. Intermediate Surface Projections

  13. Environment Mapping

  14. Environment Mapping

  15. Environment Mapping

  16. Environment Maps Images from Illumination and Reflection Maps: Simulated Objects in Simulated and Real Environments Gene Miller and C. Robert Hoffman SIGGRAPH 1984 “ Advanced Computer Graphics Animation ” Course Notes

  17. Perspective…

  18. Linear mapping…

  19. Interpolating Parameters  The problem turns out to be fundamental to interpolating parameters in screen- space  Uniform steps in screen space ≠ uniform steps in world space

  20. Texture Mapping Linear interpolation Correct interpolation of texture coordinates with perspective divide Hill Figure 8.42

  21.  Perspective foreshortening is not getting applied to our interpolated parameters  Parameters should be compressed with distance  Linearly interpolating them in screen-space doesn ’ t do this

  22. Perspective-Correct Interpolation  Skipping a bit of math to make a long story short…  Rather than interpolating u and v directly, interpolate u/z and v/z  These do interpolate correctly in screen space  Also need to interpolate z and multiply per-pixel  Problem: we don ’ t know z anymore  Solution: we do know w ~ 1/z  So…interpolate uw and vw and w , and compute u = uw/w and v = vw/w for each pixel  This unfortunately involves a divide per pixel

  23. Solid Textures (Peachey 1985, Perlin 1985)  Problem: mapping a 2D image/function onto the surface of a general 3D object is a difficult problem:  Distortion  Discontinuities  Idea: use a texture function defined over a 3D domain - the 3D space containing the object  Texture function can be digitized or procedural

  24. Solid Textures

  25. Wood Texture

  26. Procedural Textures  Advantages:  compact representation (code vs. data)  unlimited resolution  unlimited extent  controllable via parameters  Disadvantages:  Can be difficult to program and debug  Can be difficult to predict and control  Typically slower to evaluate  Can be difficult to pre-filter

Recommend


More recommend