3d surfaces - cs.cmu.edu
TRANSCRIPT
3D SurfacesAdrien Treuille
Carnegie Mellon University
source: http://iparla.labri.fr/publications/2007/BS07b/sketch_teaser.jpg
Outline
• Homework 1
• Height Fields- Normals
• Implicit and Explicit Surfaces- Numerical vs. Analytic- Implicit vs. Explicit- Conversions
• Subdivision Surfaces
source: http://www.cs.umd.edu/class/spring2005/cmsc828v/thumbnails/thMPU.gif
source: http://graphics.cs.lth.se/theses/projects/projgrid/demo11.jpg
source: http://iparla.labri.fr/publications/2007/BS07b/sketch_teaser.jpg
Outline
• Homework 1
• Height Fields- Normals
• Implicit and Explicit Surfaces- Numerical vs. Analytic- Implicit vs. Explicit- Conversions
• Subdivision Surfaces
source: http://www.cs.umd.edu/class/spring2005/cmsc828v/thumbnails/thMPU.gif
source: http://graphics.cs.lth.se/theses/projects/projgrid/demo11.jpg
source: http://iparla.labri.fr/publications/2007/BS07b/sketch_teaser.jpg
Homework 1
Due on Thursday.
No late days!
Outline
• Homework 1
• Height Fields
• Normals
• Implicit and Explicit Surfaces- Numerical vs. Analytic- Implicit vs. Explicit- Conversions
• Subdivision Surfaces
source: http://www.cs.umd.edu/class/spring2005/cmsc828v/thumbnails/thMPU.gif
source: http://graphics.cs.lth.se/theses/projects/projgrid/demo11.jpg
source: http://iparla.labri.fr/publications/2007/BS07b/sketch_teaser.jpg
2D Scalar Field2D Scalar Field
• z = f(x,y)
How do you visualize this function?
!"# <+!!
=1 if ,1
),(
2222yxyx
yxf 0
Height FieldHeight Field
• Visualizing an explicit function
• Adding contour curves
z = f(x,y)
f(x,y) = c
MeshesMeshes
• Function is sampled (given) at xi, yi, 0 ! i, j ! n
• Assume equally spaced
• Generate quadrilateral or triangular mesh
• [Asst 1]
Height Field Normals
how to compute them?
Outline• Homework 1
• Height Fields
• Normals
• Implicit and Explicit Surfaces
• Numerical vs. Analytic
• Implicit vs. Explicit
• Conversions
• Subdivision Surfaces
source: http://www.cs.umd.edu/class/spring2005/cmsc828v/thumbnails/thMPU.gif
source: http://graphics.cs.lth.se/theses/projects/projgrid/demo11.jpg
source: http://iparla.labri.fr/publications/2007/BS07b/sketch_teaser.jpg
Outline• Homework 1
• Height Fields
• Normals
• Implicit and Explicit Surfaces
• Numerical vs. Analytic
• Implicit vs. Explicit
• Conversions
• Subdivision Surfaces
source: http://www.cs.umd.edu/class/spring2005/cmsc828v/thumbnails/thMPU.gif
source: http://graphics.cs.lth.se/theses/projects/projgrid/demo11.jpg
source: http://iparla.labri.fr/publications/2007/BS07b/sketch_teaser.jpg
Outline• Homework 1
• Height Fields
• Normals
• Implicit and Explicit Surfaces
• Numerical vs. Analytic
• Implicit vs. Explicit
• Conversions
• Subdivision Surfaces
source: http://www.cs.umd.edu/class/spring2005/cmsc828v/thumbnails/thMPU.gif
source: http://graphics.cs.lth.se/theses/projects/projgrid/demo11.jpg
source: http://iparla.labri.fr/publications/2007/BS07b/sketch_teaser.jpg
(Dis)Advantages?• shape matching
• morphing
• implementation in the opengl pipeline
• CSG
• surface reflection
• fluid simulation
Outline• Homework 1
• Height Fields
• Normals
• Implicit and Explicit Surfaces
• Numerical vs. Analytic
• Implicit vs. Explicit
• Conversions
• Subdivision Surfaces
source: http://www.cs.umd.edu/class/spring2005/cmsc828v/thumbnails/thMPU.gif
source: http://graphics.cs.lth.se/theses/projects/projgrid/demo11.jpg
source: http://iparla.labri.fr/publications/2007/BS07b/sketch_teaser.jpg
Implicit → Explicit 2D(Marching Squares Algorithm)
Marching SquaresMarching Squares
• Sample function f at every grid point xi, yj
• For every point fi j = f(xi, yj) either fi j ! c or fi j > c
Cases for Vertex LabelsCases for Vertex Labels
16 cases for vertex labels
4 unique mod. symmetries
Ambiguities of LabelingsAmbiguities of Labelings
Ambiguous labels
Different resulting
contours
Resolution by subdivision
(where possible)
Marching Squares ExamplesMarching Squares Examples
Can you do better?
Interpolating IntersectionsInterpolating Intersections
• Approximate intersection
– Midpoint between xi, xi+1 and yj, yj+1
– Better: interpolate
• If fi j = a is closer to c than b = fi+1 j then
intersection is closer to (xi, yj):
• Analogous calculation
for y directionfi j = a < c c < b = fi+1 j
xi xi+1x
Marching Squares ExamplesMarching Squares Examples
Marching Squares ExamplesMarching Squares Examples
Adaptive Subdivision
Implicit → Explicit 3D(Marching Cubes Algorithm)
3D Scalar Fields3D Scalar Fields
• Volumetric data sets
• Example: tissue density
• Assume again regularly sampled
• Represent as voxels
• Two rendering methods
–Isosurface rendering
–Direct volume rendering (use all values [next])
IsosurfacesIsosurfaces
• Generalize contour curves to 3D
• Isosurface given by f(x,y,z) = c
– f(x, y, z) < c inside
– f(x, y, z) = c surface
– f(x, y, z) > c outside
Marching CubesMarching Cubes
• Display technique for isosurfaces
• 3D version of marching squares
• How many possible cases?
28 = 256
…
Marching CubesMarching Cubes
• 14 cube labelings (after elimination symmetries)
Marching Cube TessellationsMarching Cube Tessellations
• Generalize marching squares, just more cases
• Interpolate as in 2D
• Ambiguities similar to 2D
Marching Squares ExamplesMarching Squares Examples
Marching Squares ExamplesMarching Squares Examples
Explicit → Implicit 3D(Fast Marching Algorithm)
Signed Distance Field
What a line’s SDF?
(interior)
(exterior)
+
-
(y = 0)
φ(x, y) = y∇φ = [0, 1]T ||∇φ|| = 1
What a circle’s SDF?
+
-
1
||∇φ|| = 1
φ(x, y) =�
x2 + y2 − 1
∇φ =1�
x2 + y2[x, y]T
What do these cases have in common?
11−1
−1
1
||∇φ|| = 1
What about General Case?
http://www.cse.ohio-state.edu/~chenyis/Markerless_Motion_Capture/
(sorry for change in color scheme)
Fast Marching Algorithm
Fast Marching Algorithm
Start Along the Boundary
Boundary Cases
D. Adalsteinsson, J. A. Sethian. The Fast Construction of Extension Velocities in Level Set Methods. Journal of
Computational Physics (1999)
Push Adjacent Cells
Estimating The Distance||∇φ|| = 1Use:
�φi,j − φi−1,j
h
�2
+�
φi,j − φi,j−1
h
�2
= 1
φi,jφi−1,j
φi,j−1
Pop Nearest Cell
Add It’s Neighbors to the Heap
Continue Propogating...
Further and Further...
Until All Cells Have Been Processed
Reminder: Why would we want to do this?
Outline• Homework 1
• Height Fields
• Normals
• Implicit and Explicit Surfaces
• Numerical vs. Analytic
• Implicit vs. Explicit
• Conversions
• Meshes
source: http://www.cs.umd.edu/class/spring2005/cmsc828v/thumbnails/thMPU.gif
source: http://graphics.cs.lth.se/theses/projects/projgrid/demo11.jpg
source: http://iparla.labri.fr/publications/2007/BS07b/sketch_teaser.jpg
Mesh Representations & Subdivision Surfaces
Tom FunkhouserPrinceton University
COS 426, Spring 2007
Polygon Meshes• How should we represent a mesh in a computer?
oEfficient traversal of topologyoEfficient use of memoryoEfficient updates
• Mesh RepresentationsoIndependent facesoVertex and face tablesoAdjacency listsoWinged-EdgeoHalf-Edgeoetc.
Zorin & Schroeder, SIGGRAPH 99, Course Notes
Independent Faces• Each face lists vertex coordinates
oRedundant verticesoNo adjacency information
Vertex and Face Tables• Each face lists vertex references
oShared verticesoStill no adjacency information
Possible Queries
•Which faces use this vertex?
•Which edges use this vertex?
•Which faces border this edge?
•Which edges border this face?
•Which faces are adjacent to this face?
Adjacency Lists• Store all vertex, edge, and face adjacencies
oEfficient adjacency traversaloExtra storage
Partial Adjacency Lists• Can we store only some adjacency relationships
and derive others?
Winged Edge• Adjacency encoded in edges
oAll adjacencies in O(1) timeoLittle extra storage (fixed records)oArbitrary polygons
Winged Edge• Example:
Half Edge• Adjacency encoded in edges
oAll adjacencies in O(1) timeoLittle extra storage (fixed records)oArbitrary polygons
• Similar to winged-edge,except adjacency encoded in half-edges
e heinv
vbegin
Fleft
henext