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

texture mapping
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Texture Mapping

slide-2
SLIDE 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)

  • nto the surface.
slide-3
SLIDE 3
slide-4
SLIDE 4

Texture Mapping Example

 Texture:  Result:

slide-5
SLIDE 5
slide-6
SLIDE 6
slide-7
SLIDE 7
slide-8
SLIDE 8

Texture Mapping Example

 Given an image, think of it as a 2D function

from [0,1]2 (texture coordinates) to the RGB color space:

 For each geometric primitive, define a

mapping M that maps points on the surface to texture coordinates:

 To shade a pixel corresponding to a point

(x,y,z) on the surface, use the color:

) , , ( ) , ( b g r v u T 

M x y z u v ( , , ) ( , )  ( , , ) ( ( , , )) r g b T M x y z 

slide-9
SLIDE 9
slide-10
SLIDE 10
slide-11
SLIDE 11
slide-12
SLIDE 12
slide-13
SLIDE 13
slide-14
SLIDE 14

Affected Parameters

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

slide-15
SLIDE 15

Bump Mapping

slide-16
SLIDE 16

Bump Mapping

slide-17
SLIDE 17

Bump Mapping

 Texture = change in surface normal!

Sphere w/ diffuse texture Swirly bump map Sphere w/ diffuse texture and swirly bump map

slide-18
SLIDE 18

Parametrizing Objects

 Certain objects have a natural parameterization

(e.g., Bezier patches)

 Polygons (triangles): each vertex is assigned a pair

  • f texture coordinates (u,v). Inside, linear

interpolation is used.

 How do we handle a more complex object?

slide-19
SLIDE 19

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

  • bject surface
slide-20
SLIDE 20

Two-step Texture Mapping

slide-21
SLIDE 21

Intermediate Surface Projections

slide-22
SLIDE 22

Environment Mapping

slide-23
SLIDE 23

Environment Mapping

slide-24
SLIDE 24

Environment Mapping

slide-25
SLIDE 25

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

slide-26
SLIDE 26

Perspective…

slide-27
SLIDE 27

Linear mapping…

slide-28
SLIDE 28

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

slide-29
SLIDE 29

Texture Mapping

Linear interpolation

  • f texture coordinates

Correct interpolation with perspective divide

Hill Figure 8.42

slide-30
SLIDE 30

 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

slide-31
SLIDE 31

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

slide-32
SLIDE 32

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

  • bject

 Texture function can be digitized or procedural

slide-33
SLIDE 33

Solid Textures

slide-34
SLIDE 34
slide-35
SLIDE 35
slide-36
SLIDE 36

Wood Texture

slide-37
SLIDE 37
slide-38
SLIDE 38

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

slide-39
SLIDE 39