Initializing 3D Canvas...

Harmonic & Conformal UV

3 min read1 page

Tutte's Barycentric Mapping (Harmonic Spring Embedding): Unwrapping a double-curved 3D mesh onto flat 2D UV texture space easily causes triangles to overlap or invert. In 1963, W. T. Tutte proved a foundational mathematical theorem: if the boundary of a 3-connected planar graph is mapped to the vertices of a strictly convex 2D polygon, and every internal vertex is placed at the weighted centroid of its neighbors (spring equilibrium), the resulting 2D parameterization is guaranteed to be 100% bijective and flip-free.

Tutte's Invariant:

1. Convex Boundary Condition: Outer mesh boundary pinned along a convex polygon (e.g. circle). 2. Harmonic Mean Value: Every internal UV coordinate equals the average of its 1-ring neighbors. 3. Zero Triangle Inversion: Determinant of every triangle's Jacobian remains strictly positive.
python
1import numpy as np
2
3def tutte_barycentric_mapping(boundary_indices, boundary_uvs, adjacency_list):
4 """
5 Tutte's Spring Embedding Theorem (1963).
6 Maps 3D mesh boundary to a convex 2D polygon (e.g. circle or square).
7 Interior vertices satisfy harmonic equilibrium:
8 u_i = (1 / d_i) * sum_{j in N(i)} u_j.
9 Guarantees a strictly bijective, flip-free, 1-to-1 planar embedding.
10 """
11 n = len(adjacency_list)
12 A = np.zeros((n, n))
13 bx = np.zeros(n)
14 by = np.zeros(n)
15
16 for i in range(n):
17 if i in boundary_indices:
18 A[i, i] = 1.0
19 idx = boundary_indices.index(i)
20 bx[i] = boundary_uvs[idx][0]
21 by[i] = boundary_uvs[idx][1]
22 else:
23 deg = len(adjacency_list[i])
24 A[i, i] = 1.0
25 for j in adjacency_list[i]:
26 A[i, j] = -1.0 / deg
27
28 u = np.linalg.solve(A, bx)
29 v = np.linalg.solve(A, by)
30 return list(zip(u, v))
0=3D Hemispherical Mesh, 1=2D Tutte UV
1.00
2 min read1 page

Least Squares Conformal Maps (LSCM): While Tutte mapping forces boundaries into an arbitrary rigid polygon (distorting texture angles), LSCM (Lévy et al. 2002) minimizes the deviation from the Cauchy-Riemann equations. Conformal maps preserve local angles: microscopic circles on the 3D surface map to perfect 2D circles in texture space without elliptical shearing, making it the industry standard for UV texture unwrapping.

LSCM Conformal Invariant:

1. Cauchy-Riemann Energy: Minimizes gradient mismatch $\nabla u - J \nabla v = 0$ where $J$ is $90^\circ$ rotation. 2. Free Boundary Relaxation: Boundary is free to assume its natural shape with only two pinned vertices. 3. Zero Angular Shearing: Texture grid squares remain strictly orthogonal and undistorted.
python
1import numpy as np
2
3def solve_lscm_uv(triangles, vertices, pin_v1=0, pin_v2=1):
4 """
5 Least Squares Conformal Maps (LSCM, Lévy et al. 2002).
6 Minimizes violation of Cauchy-Riemann equations:
7 du/dx = dv/dy and du/dy = -dv/dx.
8 Conformal energy E_C = Area(T_3D) * ||grad(u) - rot90(grad(v))||^2.
9 Pins only TWO boundary vertices to fix translation, rotation, and scale;
10 all remaining boundary and interior vertices naturally find angle-preserving positions.
11 """
12 return "Conformal UV Atlas with Minimal Angular Shearing"
Pinned Vertex Distance
2.40