Computer Graphics Texture mapping and parameterization By Olga Sorkine Some slides courtesy of Pierre Alliez and Craig Gotsman The plan for today � Reminder: triangle meshes � What is parameterization and what is it good for: � Texture mapping � Remeshing � Parameterization � Convex mapping � Harmonic mapping 2
Triangle mesh � Discrete surface representation � Piecewise linear surface (made of triangles) 3 Triangle mesh � Geometry: � Vertex coordinates (x 1 , y 1 , z 1 ) (x 2 , y 2 , z 2 ) . . . (x n , y n , z n ) � Connectivity (the graph) � List of triangles (i 1 , j 1 , k 1 ) (i 2 , j 2 , k 2 ) . . . (i m , j m , k m ) 4
2D parameterization 3D space ( x,y,z ) 2D parameter domain ( u,v ) boundary boundary 5 Application - Texture mapping 6
Requirements � Bijective (1-1 and onto): No triangles fold over. � Minimal “distortion” � Preserve 3D angles � Preserve 3D distances � Preserve 3D areas � No “stretch” 7 Distortion minimization Texture map Kent et al ‘92 Floater 97 Sander et al ‘01 8
More texture mapping 9 Applications � Texture Mapping � Remeshing � Surface Reconstruction � Morphing � Compression 10
Remeshing Remeshing examples 12
More remeshing examples 13 Conformal parametrization Tutte Shape-preserving Conformal Texture map 14
Non-simple domains 15 Cutting 16
Parameterization of closed genus-0 triangle meshes Spherical Non-Constrained Planar 17 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 v 1 , v 2 , …, v n – inner vertices; v n+1 , …, v N – boundary vertices 18
Inner vertices � We constrain each inner vertex to be a weighted average of its neighbors: j ∑ = λ = v v , i 1, 2, … , n i ij j λ i,j ∈ j N i ( ) i 0 i j , are not neighbors λ = > ij ∈ 0 ( , ) i j E (neighbours) ∑ λ = 1 ij ∈ j N i ( ) 19 Linear system of equations ∑ − λ = = v v 0, i 1, 2, … , n i ij j ∈ j N i ( ) ∑ ∑ − λ = λ = v v v , i 1, 2, … , n i ij j ik k ∈ ∈ j N i ( )\ B k N i ( ) ∩ B − λ − λ 1 σ v 1 , j 1 , j 1 1 1 d 1 1 σ v 2 2 1 = − λ � � 4 , j 1 − λ 1 σ v n , j n n 5 20
Shape preserving weights v θ 1 3D p 1 2D p 5 v 1 v 4 p 2 v 5 p p 4 v 3 v 2 p 3 To compute λ 1 , …, λ 5 , a local embedding of the patch is found : 1) || p i – p || = || x i – x || 2) angle ( p i , p , p i+1 ) = (2 π / Σ θ i ) angle ( v i , v , v i+1 ) p = Σ λ i p i ⇒ use these λ as edge weights . λ i > 0 ∃ λ i , Σ λ i = 1 21 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…) 22
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: 1 ∑ 2 = − E k v v harm i , j i j 2 ∈ ( i , j ) E where v i are the flat position (remember that the boundary vertices v n+1 , …, v N are constrained). 23 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! = v ( x , y ) i i i 1 ∑ 2 = − = E ( x , … , x , y , … , y ) k v v harm 1 n 1 n i , j i j 2 ∈ ( i , j ) E ( ) . 1 ∑ = − 2 + − 2 k ( x x ) ( y y ) i , j i j i j 2 ∈ ( i , j ) E E harm is function of 2n variables 24
Energy minimization – least squares � To find minimum: ∇ E harm = 0 ∂ 1 ∑ = − = E 2 k ( x x ) 0 harm i , j i j ∂ x 2 ∈ j N ( i ) i ∂ 1 ∑ = − = E 2 k ( y y ) 0 ∂ harm i , j i j y 2 ∈ j N ( i ) i � Again, x n+1 ,…., x N and y n+1 , …, y N are constrained. 25 Energy minimization – least squares � To find minimum: ∇ E harm = 0 ∑ − = = k ( x x ) 0 , i 1 , 2 , … , n i , j i j ∈ j N ( i ) ∑ − = = k ( y y ) 0 , i 1 , 2 , … , n i , j i j ∈ j N ( i ) � Again, x n+1 ,…., x N and y n+1 , …, y N are constrained. 26
The spring constants k i,j � The weights k i,j are chosen to minimize angles distortion: � Look at the edge ( i, j ) in the 3D mesh � Set the weight k i,j = cot α + cot β i β α 3D j 27 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. 28
See you next time
Recommend
More recommend