Texture Mapping Motivation: Add interesting and/or realistic detail - - PDF document

texture mapping motivation add interesting and or
SMART_READER_LITE
LIVE PREVIEW

Texture Mapping Motivation: Add interesting and/or realistic detail - - PDF document

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

Textures and Shading

http://www.3drender.com/jbirn/hippo/hairyhipponose.html

4

slide-5
SLIDE 5

Texture Mapping – Simple Example

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

Simple parametrization

slide-9
SLIDE 9

Mapping is not unique

slide-10
SLIDE 10

Bump Mapping

slide-11
SLIDE 11

Bump Mapping

slide-12
SLIDE 12

Surface Parametrization

Most slides courtesy of Pierre Alliez, Craig Gotsman, and Noam Aigerman

slide-13
SLIDE 13

13

Triangle mesh

 Discrete surface representation  Piecewise linear surface (made of triangles)

slide-14
SLIDE 14

14

Triangle mesh

 Geometry:

 Vertex coordinates

(x1, y1, z1) (x2, y2, z2)

. . .

(xn, yn, zn)

 Connectivity (the graph)

 List of triangles

(i1, j1, k1) (i2, j2, k2)

. . .

(im, jm, km)

slide-15
SLIDE 15

15

What is a parameterization?

S  R3 - given surface D  R2 - parameter domain s : D  S 1-1 and onto

           ) , ( ) , ( ) , ( ) , ( v u z v u y v u x v u s

slide-16
SLIDE 16

16

Example – flattening the earth

slide-17
SLIDE 17

Mesh Parameterization

slide-18
SLIDE 18

World Atlas

18

slide-19
SLIDE 19

Parameterizations are atlases

slide-20
SLIDE 20

World Atlas

20

slide-21
SLIDE 21

World Atlas

21

slide-22
SLIDE 22

World Atlas

22

slide-23
SLIDE 23

The true size of Africa

23

slide-24
SLIDE 24

Another view of the same idea

24

slide-25
SLIDE 25

There are many possible maps

Is one of them “correct”?

slide-26
SLIDE 26

Can’t flatten without distorting

slide-27
SLIDE 27

27

  • 1

1

  h

Another example:

Parameters: , h D = [0,][–1,1]

x(, h) = cos() y(, h) = h z(, h) = sin()

slide-28
SLIDE 28

28

Triangular Mesh

slide-29
SLIDE 29

29

Triangular Mesh

slide-30
SLIDE 30

30

Mesh Parameterization

 Uniquely defined by mapping mesh vertices

to the parameter domain:

U : {v1, …, vn}  D  R2 U(vi) = (ui, vi)

 No two edges cross in the plane (in D)

Mesh parameterization  mesh embedding

slide-31
SLIDE 31

31

Mesh parameterization

Parameter domain

D  R2

Mesh surface

S  R3

Embedding U Parameterization s

s = U -1

slide-32
SLIDE 32

32

2D parameterization

3D space (x,y,z) 2D parameter domain (u,v) boundary boundary

slide-33
SLIDE 33

33

Application - Texture mapping

slide-34
SLIDE 34

34

Requirements

 Bijective (1-1 and onto): No triangles fold over.  Minimal “distortion”

 Preserve 3D angles  Preserve 3D distances  Preserve 3D areas  No “stretch”

slide-35
SLIDE 35

35

Distortion minimization

Kent et al ‘92 Floater 97 Sander et al ‘01

Texture map

slide-36
SLIDE 36

36

More texture mapping

slide-37
SLIDE 37

37

Resampling problems

Cat mesh Distorting embedding Resampling

  • n regular grid
slide-38
SLIDE 38

Remeshing

slide-39
SLIDE 39

39

Remeshing examples

slide-40
SLIDE 40

40

Remeshing

slide-41
SLIDE 41

41

Remeshing

slide-42
SLIDE 42

42

More remeshing examples

slide-43
SLIDE 43

43

Conformal parametrization

Texture map Tutte Shape-preserving Conformal

slide-44
SLIDE 44

44

Non-simple domains

slide-45
SLIDE 45

45

Cutting

slide-46
SLIDE 46

46

Parameterization of closed genus-0 triangle meshes

Non-Constrained Planar Spherical

slide-47
SLIDE 47

47

Introducing seams (cuts)

slide-48
SLIDE 48

48

Partition

slide-49
SLIDE 49
slide-50
SLIDE 50

50

Introducing seams (cuts)

slide-51
SLIDE 51

51

Introducing seams (cuts)

slide-52
SLIDE 52

52

Bad parameterization

slide-53
SLIDE 53

53

Better…(free boundary)

slide-54
SLIDE 54

54

Partition – problems

 Discontinuity of parameterization  Visible artifacts in texture mapping  Require special treatment

 Vertices along seams have several (u,v)

coordinates

 Problems in mip-mapping

Make seams short and hide them

slide-55
SLIDE 55

55

Summary

“Good” parameterization = non-distorting

 Angles and area preservation  Continuous param. of complex surfaces cannot avoid distortion.

“Good” partition/cut:

 Large patches, minimize seam length  Align seams with features (=hide them)

slide-56
SLIDE 56

56

Mesh parameterization

s and U are piecewise-linear Linear inside each mesh triangle

In 2D In 3D

U s

A mapping between two triangles is a unique affine mapping

slide-57
SLIDE 57

57

A B C P

Barycentric coordinates

, , , , , , , , , , , , , , denotes the (signed) area of the triangle P B C P C A P A B P A B C A B C A B C A B C          

slide-58
SLIDE 58

58

Mapping triangle to triangle

s

p1 p2 p3 q1 q2 q3

3 3 2 1 2 1 2 3 2 1 1 3 1 3 2 1 3 2

, , , , , , , , , , , , ) ( q p p p p p q p p p p p q p p p p p p p p p s   

slide-59
SLIDE 59

Some techniques

slide-60
SLIDE 60

60

Convex mapping (Tutte, Floater)

 Works for meshes equivalent to a disk  First, we map the boundary to a convex polygon  Then we find the inner vertices positions v1, v2, …, vn – inner vertices; vn, vn+1, …, vN – boundary vertices

slide-61
SLIDE 61

61

Inner vertices

 We constrain each inner vertex to be a weighted

average of its neighbors:

n i ,

i N j j j i i

, , 2 , 1

) ( ,

   

v v 

1 ) neighbours ( ) , ( neighbors not are ,

) ( , ,

      

 i N j j i j i

E j i j i  

i,j

i j

slide-62
SLIDE 62

62

Linear system of equations

n i , n i 0,

B i N k k k i B i N j j j i i i N j j j i i

, , 2 , 1 , , 2 , 1

) ( , \ ) ( , ) ( ,

 

     

  

  

v v v v v   

                                                    

n n j n j j j

d

      

2 1 2 1 , , 4 , 1 , 1

1 1 1 1

5 1 1 1

v v v  

slide-63
SLIDE 63

63

Shape preserving weights

To compute 1, …, 5, a local embedding of the patch is found:

1) || pi – p || = || xi – x || 2) angle(pi, p, pi+1) = (2 /i ) angle(vi, v, vi+1)

p4 p3 p5 p1 p p2 2D 3D

p =  i pi

i > 0  i = 1  use these  as edge weights.  i , v3 v2 v1 v4 v5 v 1

slide-64
SLIDE 64

64

Linear system of equations

 A unique solution always exists  Important: the solution is legal (bijective)  The system is sparse, thus fast numerical

solution is possible

 Numerical problems (because the vertices in the

middle might get very dense…)

slide-65
SLIDE 65

65

2D parameterization

3D space (x,y,z) 2D parameter domain (u,v) boundary boundary

slide-66
SLIDE 66

66

Harmonic mapping

 Another way to find inner vertices  Strives to preserve angles (conformal)  We treat the mesh as a system of springs.  Define spring energy:

where vi are the flat position (remember that the boundary vertices vn, vn+1, …, vN are constrained).

 

E j i j i j i harm

k E

) , ( 2 ,

2 1 v v

slide-67
SLIDE 67

67

Energy minimization – least squares

 We want to find such flat positions that the

energy is as small as possible.

 Solve the linear least squares problem!

 .

) ( ) ( 2 1 2 1 ) , , , , , ( ) , (

) , ( 2 2 , ) , ( 2 , 1 1

 

 

       

E j i j i j i j i E j i j i j i n n harm i i i

y y x x k k y y x x E y x v v v  

Eharm is function of 2n variables

slide-68
SLIDE 68

68

Energy minimization – least squares

 To find minimum: Eharm= 0  Again, xn+1,…., xN and yn+1, …, yN are constrained.

) ( 2 2 1 ) ( 2 2 1

) ( , ) ( ,

         

 

  i N j j i j i harm i i N j j i j i harm i

y y k E y x x k E x

slide-69
SLIDE 69

69

Energy minimization – least squares

 To find minimum: Eharm= 0  Again, xn+1,…., xN and yn+1, …, yN are constrained.

n i y y k n i x x k

i N j j i j i i N j j i j i

, , 2 , 1 , ) ( , , 2 , 1 , ) (

) ( , ) ( ,

       

 

 

slide-70
SLIDE 70

70

The spring constants ki,j

 The weights ki,j are chosen to minimize angles

distortion:

 Look at the edge (i, j) in the 3D mesh  Set the weight ki,j = cot  + cot 

 

i j

3D

slide-71
SLIDE 71

71

Discussion

 The results of harmonic mapping are better than those of

convex mapping (local area and angles preservation).

 But: the mapping is not always legal (the weights can be

negative for badly-shaped triangles…)

 Both mappings have the problem of fixed boundary –

it constrains the minimization and causes distortion.

 There are more advanced methods that do not require

boundary conditions.

slide-72
SLIDE 72

72

Convex weights for inner vertices

( , ) ( ) ( , ) ( )

s.t. 1 and

i ij j ij ij i j N i i j N i

w w w

 

  

 

v v

 If the weights are convex, the solution is always valid (no self-

intersections) [Floater 97]

 The cotangent weight in Harmonic Mapping can be negative 

sometimes there are triangle flips

 In [Floater 2003] new convex weights are proposed that

approximate harmonic mapping

slide-73
SLIDE 73

73

Angle-based Flattening (ABF)

[Sheffer and de Sturler 2001]

 Angle-preserving parameterization  The energy functional is formulated using the flat

mesh angles only!

 Allows free boundary

slide-74
SLIDE 74

74

Angle-based Flattening (ABF)

[Sheffer and de Sturler 2001]

 The goal: minimize the difference

where i are angles of original (3D) mesh and i are the unknowns (the flat mesh)

 

N i i i 1 2

 

slide-75
SLIDE 75

75

The angles equations (constraints) All angles are positive: Angles around an inner vertex in 2D sum up to 2 Angles in a triangle sum up to 

) 1 ( 

i

) 2 ( 2

around 

i j j

 

) 3 (

3 2 1

   

i i i

a a a

slide-76
SLIDE 76

76

The angles equations (constraints)

 Finally, something like the sine theorem must

hold:

1 ~ sin sin ) 4 (

) ( 1 ) ( 1

  

  j i N j j i N j

 

slide-77
SLIDE 77

77

The angles equations (constraints)

 Finally, something like the sine theorem must

hold:

slide-78
SLIDE 78

78

The final optimization:

 We minimize

under the 4 constraints

 It’s enough to fix one triangle in the plane to

define the whole flat mesh

 

N i i i 1 2

 

slide-79
SLIDE 79

79

Results

slide-80
SLIDE 80

80

Results

slide-81
SLIDE 81

81

Results

slide-82
SLIDE 82

82

Results

slide-83
SLIDE 83

83

Discussion

 Pros:

 Angle preserving  Always valid (at least internally)  No rigid boundary constraints

 Cons:

 Non-linear optimization

 Expensive (but now a multi-grid method exists)

 Building the mesh from angles can be unstable

slide-84
SLIDE 84

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

slide-85
SLIDE 85

Solid Textures

slide-86
SLIDE 86
slide-87
SLIDE 87
slide-88
SLIDE 88
slide-89
SLIDE 89
slide-90
SLIDE 90

Thanks