25
Texture Mapping Fall 2012 (Slides mostly based on those of Voicu Popescu) Daniel G. Aliaga Department of Computer Science Purdue University

Sea of Images18 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

  • Upload
    others

  • View
    21

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Sea of Images18 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

Texture Mapping

Fall 2012

(Slides mostly based on those of Voicu Popescu) Daniel G. Aliaga

Department of Computer Science Purdue University

Page 2: Sea of Images18 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

2

Texture mapping

• Model surface-detail with images

– wrap object with photograph(s)

– graphics object itself is a simpler model but “looks” more complex

Page 3: Sea of Images18 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

3

Texture mapping

• Model surface-detail with images

– wrap object with photograph(s)

– graphics object itself is a simpler model but “looks” more complex

Page 4: Sea of Images18 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

4

Texture mapping

• Generic image to represent material

– e.g., tile pattern

bark

veneer

bricks

Page 5: Sea of Images18 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

5

Tiling

• Repeat pattern

Page 6: Sea of Images18 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

6

Tiling

• Repeat pattern

Page 7: Sea of Images18 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

7

Tiling

• Repeat pattern

• How can we improve?

Page 8: Sea of Images18 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

8

Tiling

• Repeat pattern

– reduce seems by mirroring

Page 9: Sea of Images18 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

9

Tiling

• Repeat pattern

– reduce seems by mirroring

Page 10: Sea of Images18 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

10

Tiling

• Repeat pattern

– reduce seems by mirroring

Page 11: Sea of Images18 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

11

Tiling

• Repeat pattern

– reduce seems by mirroring

– How we can further improve?

Page 12: Sea of Images18 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

12

Tiling

• Repeat pattern

– reduce seems by mirroring

– reduce seems by choosing tile that covers one period of repeated texture

Page 13: Sea of Images18 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

13

Tiling

Page 14: Sea of Images18 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

14

Texture mapping limitations do exist…

Page 15: Sea of Images18 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

15

Bricks are similar not identical

Page 16: Sea of Images18 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

16

Solution?

Page 17: Sea of Images18 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

17

Solution: Texture synthesis…

Page 18: Sea of Images18 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

18

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

Page 19: Sea of Images18 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

19

x

y

z

O

P2(0, 0)

P1(1, 0)

P4(1, 1)

P3(0, 1)

Texture coordinates

Page 20: Sea of Images18 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

20

Texture mapping

C

c

a

b

P1’

P2(0, 0)

P2’

P3’

P1(1, 0)

P4(1, 1)

P3(0, 1)

x

y

z

O

Page 21: Sea of Images18 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

21

Texels: texture elements

P1’(u1, v1, s1, t1)

P2’(u2, v2, s2, t2) P3’(u3, v3, s3, t3)

P’(u, v, s, t)

Page 22: Sea of Images18 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

22

Texture mapping

C

c

a

b

P1’

P2(s2, t2)

P2’

P3’

P1(s1, t1)

P3(s3, t3)

P (s, t)

P’

x

y

z

O

Problem: how to

compute the texture

coordinates for an

interior pixel?

Page 23: Sea of Images18 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

23

Texture mapping

C

c

a

b

P1’

P2(s2, t2)

P2’

P3’

P1(s1, t1)

P3(s3, t3)

P (s, t)

P’

x

y

z

O

Solution: interpolate

vertex texture coordinates

Page 24: Sea of Images18 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

Parameter Interpolation

• Texture coordinates, colors, normals, etc.

Page 25: Sea of Images18 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

25

Level of detail problem

aliasing anti-aliased

If curious, you can read more on this subject!