+ All Categories
Home > Documents > Texture Mapping - University of Utah College of...

Texture Mapping - University of Utah College of...

Date post: 06-Oct-2020
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
25
CS 4600 Fall 2015 1 Texture Mapping From: Ed Angel University of New Mexico 2 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Objectives • Introduce Mapping Methods - Texture Mapping - Environment Mapping - Bump Mapping • Consider basic strategies - Forward vs backward mapping - Point sampling vs area averaging
Transcript
Page 1: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 1

Texture Mapping

From: Ed Angel

University of New Mexico

2Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Objectives

• Introduce Mapping Methods- Texture Mapping

- Environment Mapping

- Bump Mapping

•Consider basic strategies- Forward vs backward mapping

- Point sampling vs area averaging

Page 2: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 2

3Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

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

4Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Modeling an Orange

• 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

Page 3: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 3

5Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Modeling an Orange (2)

•Take a picture of a real orange, scan it, and “paste” onto simple geometric model

- This process is known as texture mapping

•Still might not be sufficient because resulting surface will be smooth

- Need to change local shape- Bump mapping

6Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Three Types of Mapping

• Texture Mapping- Uses images to fill inside of polygons

• Environment (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

Page 4: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 4

7Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Texture mapping

• Texture mapping: adding surface detail by mapping texture patterns to the surface

• Developed by Catmull (1974), Blinn and Newell (1976), and others

8Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Texture Mapping

• Maps a pattern (texture) onto a surface• Texels fill each pixel• Texels selected from sample pattern

(texture map)• Pattern is repeated

Page 5: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 5

9Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Texture Maps

10Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Texture Maps

Page 6: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 6

11Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Wallpaper, Analogue Texture Map

12Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Flooring, Tiling, etc

Page 7: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 7

13Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Spring 2005 Utah School of Computing 13

Examples of Mapped Texture

14Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Examples

Page 8: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 8

15Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Texture Mapping

geometric model texture mapped

16Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Environment Mapping

Page 9: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 9

17Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Bump Mapping

18Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Bump Mapping

Look at smooth

silhouettes

Page 10: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 10

19Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Displacement Mapping

Look at silhouette

20Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Where does mapping take place?

• Mapping techniques are implemented at the end of the rendering pipeline

- Very efficient because few polygons make it past the clipper

Page 11: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 11

21Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

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

22Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Coordinate Systems

•Parametric coordinates- May be used to model curves and surfaces

•Texture coordinates- Used to identify points in the image to be mapped

•Object or World Coordinates- Conceptually, where the mapping takes place

•Window Coordinates- Where the final image is really produced

Page 12: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 12

23Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Texture Mapping

parametric coordinates

texture coordinates

world coordinateswindow coordinates

24Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Mapping Functions

•Basic problem is how to find the maps•Consider mapping from texture coordinates to a point a surface

•Appear to need three functionsx = 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)

Page 13: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 13

25Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Backward Mapping

• We really want to go backwards

- Given a texel, 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

26Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Basic Concept

• Relate a 2D image to a 3D model

• Texture coordinates- Texture coordinate is a 2D

coordinate (s,t) which maps to a location on a texture map

• Texture coordinates are over the interval [0,1], typically

Page 14: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 14

27Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Elements of Texture Mapping

• Texture source function (can be 3D)

• Inverse map: Texture (s,t) ← Surface (x(s,t), y(s,t), z(s,t))

• Typical texture sources- Procedure

- Tabular data (texture map)

28Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

Texture Mapping Techniques

• 2D texture mapping: paint 2D pattern onto the surface

• Environmental (reflection) mapping

• Bump mapping: perturb surface normals to fool shading algorithms

• Procedural texture mapping, 3D texture

Page 15: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 15

29

Make a nice can of soup?

30

Make a nice can of soup?

+

Page 16: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 16

31

Cylindrical Mapping

parametric cylinder explicit cylinder

x = r cos 2 uy = r sin 2uz = hv

maps rectangle in u,v space to cylinderof radius ө and height h in world coordinates

s = ut = v

maps from texture space

h

(ө,h)

ө

x = r cos 2y = r sin 2z = h

32

Cylindrical Mapping

parametric cylinder explicit cylinder

x = r cos 2 uy = r sin 2uz = hv

maps rectangle in u,v space to cylinderof radius ө and height h in world coordinates

s = ut = v

maps from texture space

h(0, 0)

(ө,h)

ө

x = r cos 2y = r sin 2z = h

Page 17: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 17

33

Cylindrical Mapping

parametric cylinder explicit cylinder

x = r cos 2 uy = r sin 2uz = hv

maps rectangle in u,v space to cylinderof radius ө and height h in world coordinates

s = ut = v

maps from texture space

h(0, 0)

(0, 0.5)

(ө,h)

ө

x = r cos 2y = r sin 2z = h

34

Cylindrical Mapping

parametric cylinder explicit cylinder

x = r cos 2 uy = r sin 2uz = hv

maps rectangle in u,v space to cylinderof radius ө and height h in world coordinates

s = ut = v

maps from texture space

h(0, 0)

(0, 0.5)

(0, 1)

(ө,h)

ө

x = r cos 2y = r sin 2z = h

Page 18: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 18

35

Cylindrical Mapping

parametric cylinder explicit cylinder

x = r cos 2 uy = r sin 2uz = hv

maps rectangle in u,v space to cylinderof radius ө and height h in world coordinates

s = ut = v

maps from texture space

h(0, 0)

(0, 0.5)

(0.5,0)

(0, 1)

(ө,h)

ө

x = r cos 2y = r sin 2z = h

36

Cylindrical Mapping

parametric cylinder explicit cylinder

x = r cos 2 uy = r sin 2uz = hv

maps rectangle in u,v space to cylinderof radius ө and height h in world coordinates

s = ut = v

maps from texture space

h(0, 0)

(0, 0.5)

(0.5,0)

(0, 1)(0.5,1)

(ө,h)

ө

x = r cos 2y = r sin 2z = h

Page 19: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 19

37

Cylindrical Mapping

parametric cylinder explicit cylinder

x = r cos 2 uy = r sin 2uz = hv

maps rectangle in u,v space to cylinderof radius ө and height h in world coordinates

s = ut = v

maps from texture space

h(0, 0)

(0, 0.5)

(0.5,0)(1, 0)

(0, 1)(0.5,1)

(ө,h)

ө

x = r cos 2y = r sin 2z = h

38

Cylindrical Mapping

parametric cylinder explicit cylinder

x = r cos 2 uy = r sin 2uz = hv

maps rectangle in u,v space to cylinderof radius ө and height h in world coordinates

s = ut = v

maps from texture space

h(0, 0)

(0, 0.5)

(0.5,0)

(1, 1)

(1, 0)

(0, 1)(0.5,1)

(ө,h)

ө

x = r cos 2y = r sin 2z = h

Page 20: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 20

39Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Spherical Map

We can use a parametric sphere

x = r cos 2uy = r sin 2u cos 2vz = r sin 2u sin 2v

in a similar manner to the cylinderbut have to decide where to putthe distortion

Spheres are used in environmental maps

40Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Spherical Map

ө

ø

(0.5,1)

(0,0.5)

(ө, 1)

(ө,0)

(ө,ø)

(1,0.5)

Page 21: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 21

41Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Box Mapping

•Easy to use with simple orthographic projection

•Also used in environment maps

Gerri’s Game

Page 22: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 22

43

Texture Mapping

What if we don’t have a cylinder or sphere?

44Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Two-part mapping

•One solution to the mapping problem is to first map the texture to a simple intermediate surface

•Example: map to cylinder

Page 23: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 23

45Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Two-part mapping

•One solution to the mapping problem is to first map the texture to a simple intermediate surface

•Example: map to cylinder

46Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Second Mapping

• Map from intermediate object to actual object

- Normals from intermediate to actual

- Normals from actual to intermediate

- Vectors from center of intermediate

intermediateactual

Page 24: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 24

47Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005Utah School of Computing

More Examples

http://astronomy.swin.edu.au/~pbourke/texture/texturemapping

Texture Mapping, Paul Bourke (1987)

Planar Cubic Cylindrical

48Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

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

Page 25: Texture Mapping - University of Utah College of Engineeringcs4600/lectures/Wk10_TextureMapping.pdf-Where the final image is really produced. CS 4600 Fall 2015 12 ... •Point sampling

CS 4600 Fall 2015 25

49Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005

Area Averaging

A better but slower option is to use area averaging

Note that preimage of pixel is curved

pixelpreimage


Recommended