Marching Cubes - University of California, Berkeley
Transcript of Marching Cubes - University of California, Berkeley
![Page 1: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/1.jpg)
Marching CubesMarching Cubes
Sara McMains
ME 290-R
![Page 2: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/2.jpg)
Marching CubesMarching Cubes
Motivation• Visualization for medical aps
Input• Regular grid of points
• Density values at each point
![Page 3: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/3.jpg)
Data acquisitionData acquisition
• MRI (Magnetic Resonance Imaging)
•Excitation of water molecules
• CT scan (Computer Tomography)
•Absorption of x-rays
• Ultrasound
•Backscatter strength
![Page 4: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/4.jpg)
GoalGoal
Display “iso-surface”• Surface of constant density
•Assumption : sampling from a continuous such surface
• Medical visualization
•Bone, flesh, organ densities differ•Operator selects desired density
![Page 5: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/5.jpg)
DisplayDisplay
Outputs triangles• Graphics hardware optimized for triangles
•Today, everyone has graphics cards•Back in the “dark ages” had to do it in software
Surface normal for each vertex• Improve rendered appearance via Gouraud shading
![Page 6: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/6.jpg)
Gouraud ShadingGouraud Shading
A simple, effective computer graphics hackMake low-detail surfaces appear smooth
![Page 7: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/7.jpg)
Standard Flat ShadingStandard Flat Shading
material + lighting + viewing angle -> color
• Same color for whole triangle
![Page 8: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/8.jpg)
Phong ShadingPhong Shading
Pretend surface normal varies across triangle• Implementation
•Store a surface normal at each vertex•Interpolate them to calculate each pixel color
![Page 9: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/9.jpg)
Gouraud ShadingGouraud Shading
Simplification of Phong shading• Interpolate vertex colors instead of normals
![Page 10: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/10.jpg)
Gouraud ShadingGouraud Shading
![Page 11: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/11.jpg)
Back to Marching CubesBack to Marching Cubes
Basic idea:• Look at one “cube” of 8 samples at a time
• Determine if each corner inside or outside volume
•Density above threshold => 0 label•Density below threshold => 1 label
• Pattern of labels tells topology of intersection
Calculation of topology and geometry separated
![Page 12: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/12.jpg)
CasesCases
256 (2^8) cases total• Build a look-up table
•Index : ordered 8-bits of in/out labels from cube corners
•Output: which edges intersected, triangles formed
![Page 13: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/13.jpg)
CasesCases
Only 15 patterns
![Page 14: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/14.jpg)
CasesCases
Only 15 patterns• Use symmetry
![Page 15: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/15.jpg)
CasesCases
Only 15 patterns• Use symmetry
![Page 16: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/16.jpg)
Geometry calculationsGeometry calculations
Edge intersection positions• Linear interpolation of density values at corners
3
6
Isosurface density 5
![Page 17: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/17.jpg)
Geometry calculationsGeometry calculations
Edge intersection positions• Linear interpolation of density values at corners
3
6
Label = 1 (out)
Label = 0 (in)
![Page 18: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/18.jpg)
Geometry calculationsGeometry calculations
Edge intersection positions• Linear interpolation of density values at corners
3
6
Label = 1 (out)
Label = 0 (in)
Intersection position for isosurface density 5
![Page 19: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/19.jpg)
Geometry CalculationsGeometry Calculations
Vertex normals• Want to set to normal to iso-surface
• Gradient direction = normal direction for iso-surfaces
• Calculate gradient at each corner
•Look at 6 neighbors
• Interpolate to edge intersections
![Page 20: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/20.jpg)
EfficiencyEfficiency
Internal cube edges shared• 12 edges/cube
• 4 cubes/edge } 3 new edges per internal cube
![Page 21: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/21.jpg)
BooleansBooleans
Boolean evaluation also uses in/out labeling(and on)
• Implement Booleans on cube index
• Use truth tables to combine 0, 255, “in-between”
• For in-between/in-between, clip triangles
![Page 22: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/22.jpg)
Memory UsageMemory Usage
Just need four slices of data in memory• No problem for normal data sets
Small memory footprint good indicator of possible parallelism
![Page 23: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/23.jpg)
Topology ProblemsTopology Problems
E.g. non-manifold output
![Page 24: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/24.jpg)
Topology ProblemsTopology Problems
E.g. holes in output
![Page 25: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/25.jpg)
Topology ProblemsTopology Problems
E.g. holes in output
![Page 26: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/26.jpg)
Ambiguity of configurationsAmbiguity of configurations
2D Example
![Page 27: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/27.jpg)
FixesFixes
Simple approaches• Consider adjacent cubes
•Helps some, not all cases
• Divide into Tetrahedra
•Make consistent with adjacent elements•Correctness not guaranteed
![Page 28: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/28.jpg)
FixesFixes
Interpolation approachescalculate additional vertices or values• Add center point & tetrahedralize
• Subdivision•Down to pixel resolution, e.g.•Dividing Cubes [Cline et al. 1988]
• Fit higher order curves•Curve orientation disambiguates
![Page 29: Marching Cubes - University of California, Berkeley](https://reader031.fdocuments.in/reader031/viewer/2022021717/620c361819c9217c60590473/html5/thumbnails/29.jpg)
Questions?Questions?