Computer Graphics:Computer Graphics:ModelingModeling
Franck HétroyFranck Hétroy
[email protected]://evasion.imag.fr/Membres/Franck.Hetroy/
Context We want to represent 3D objects
− Real objects− Virtual/created objects
Several ways for virtual object creation− Interactive by graphists− Automatic from real data
3D scanner, medical angiography, ...− Procedural (on the fly)
Complex scenes, terrain, ... Different uses
− Display, animation, physical simulation, ...
Course overview
Volume-based modeling− Next week
Point-based modeling Surface-based modeling
1. Meshes
2. Parametric surfaces
3. Subdivision surfaces
4. Implicit surfaces
(Tentative) pedagogy:problem-based learning
Objectives:− Learn more things− Remember more things− Know other students
How:− Individual work (papers to read)− Debate to answer a problem
In teams (4 or 5 students)
− Presentation of results
Planning
Today:− Introductive course
Boring => exercises
− Papers to read for next week (individually) Next week:
− I give you a problem− 1 hour to find an answer as a team− Presentation of your solution (10 minutes/team)− Structuring course (1 hour)
Teams (tentative) Team 1:
Reynald Arnerin, Azim Azma, Laurent Belcour, Robert Conceivo Da Silva, Adrien Gomez Espana Pecker
Team 2:Nicolas Esteves, Sylvain Guglielmi, Juan Alberto Lahera
Perez, Mohamed Riadh Trad, Xue Bing
Team 3:Pierre Arnaud, Varun Raj Kompella, Anja Marx, Jorge Pena,
Thibault Serot
Team 4:Antoine Bautin, Adrien Brilhault, Noura Faraj, Stefano
Sclaverano
Today's planning
1.Geometry representations: introduction
2.Point sets
3.Meshes
4.Splines and parametric surfaces
5.Subdivision surfaces
6.Implicit surfaces
Examples
Why not one good representation ?
Multiple applications, different constraints
− Powerful rep. To handle a large class of objects To create complex objects from simple ones
− Intuitive rep. To edit the model To animate some parts of it
− Efficient rep. Memory cost Display/process time cost
Classification: a proposal
Non structured rep.− Point set− Polygon soup
Surface rep.− Mesh− Parametric− Subdivision− Implicit
Volumetric rep.− Voxel line/plane/set− Octree− CSG
Procedural rep.− Fractal− Grammar/L-system− Particle system
Image-based rep.
Today's planning
1.Geometry representations: introduction
2.Point sets
3.Meshes
4.Splines and parametric surfaces
5.Subdivision surfaces
6.Implicit surfaces
Point set representation
Points are samples of the underlying surface 1 point corresponds to 1 surfel (surface
element)− Position− Color− Normal− Radius
Surfel = 2D !
Courtesy M. Zwicker
Surfel
Surfels are designed mostly for rendering
Advantage: no mesh reconstruction necessary
− Time saving No surface connectivity
information
Courtesy M. Zwicker
Point rendering pipeline
Credit: M. Zwicker 2002
Point set
Visibility
Framebuffer
Forwardwarping
Shading Imagereconstruction
Forward warping and shading
Forward warping = perspective projection of each point in the point cloud
Similar to projection of triangle vertices (mesh case)
Shading:− Per point− Conventional models for shading (Phong,
Torrance-Sparrow, reflections, etc.)− Cf. rendering course
Visibility and image reconstruction
Performed simultaneously Discard points that are occluded from the
current viewpoint Reconstruct continuous surfaces from
projected points
Image reconstruction
Goal: avoid holes in the image of the surface Use surfel radius to cover the surface More during the rendering course
Surface approximation
Almost all surface representations are based on points
− Meshes− Parametric rep. (splines)− Implicit rep.
A projection-based surface definition is also possible
− Local polynomial P around each point− Project P(0) onto a local reference plane
Today's planning
1.Geometry representations: introduction
2.Point sets
3.Meshes
4.Splines and parametric surfaces
5.Subdivision surfaces
6.Implicit surfaces
Meshes
Mesh = (V,E,F)− V = set of vertices− E = set of edges− F = connected set of (planar) faces
Not connected = polygon soup Faces can be
− Triangles− Planar quads− Any planar, convex polygon
2-Manifold
Def.: each vertex has a neighborhood on M homeomorphic to a disk
− Continuous bijection, distance does not matter 2-Manifold with boundary: to a [half-]disk 3-Manifold, n-manifold, ... No singularities:
Object topology
Any manifold's topology is defined by a small set of numbers:
− Surface: nb c of connected components + nb g of holes + nb b of boundaries
− Volume: nb of conn. comp. + nb of tunnels + nb of cavities (bubbles) + nb of boundaries
Euler formula for surface meshes:− V-E+F = = 2(c-g)-b
− = Euler characteristic− g = genus
(Easy) Exercise Find the Euler characteristic of the following 6
surfaces:
And for volumes ?
Mesh data structures
How to store geometry and connectivity ?− STL-like: store triangles, vertices duplicated
=> no connectivity− Shared vertex data structure (OBJ, OFF file
formats): vertex list, triangles = triples of indices
=> no neighborhood info− Half-edge and variants
=> all is based on oriented edges
Half-edge data structure Three main classes:
− Vertex Coord, [id,] pointer to one
outgoing half-edge
− Half-edge Pointers to the origin vertex, to
the next and to the opposite half-edge, to the incident face
− Face Pointer to one incident half-edge
You can add whatever attributes you want (normal, color, ...)
Example: browsing the 1-ring neighborhood of a vertex
Example: browsing the 1-ring neighborhood of a vertex
Exercise:− Write your own half-edge data
structure: class Vertex class Edge class Face
− Write a procedure browseOneRing(Vertex* v) which returns the 1-ring neighborhood of v as a list.
C++ libraries
CGAL http://www.cgal.org/ Developed by a consortium led by INRIA, lots of stuff Widely used by researchers, tutorials Somehow complicated (genericity)
OpenMesh http://www.openmesh.org/ Developed by Mario Botsch at RWTH Aachen Simpler, clearer Lack of documentation
GTS http://gts.sourceforge.net/ Why not ?
Today's planning
1.Geometry representations: introduction
2.Point sets
3.Meshes
4.Splines and parametric surfaces
5.Subdivision surfaces
6.Implicit surfaces
30
Parametric curves: splines
Motivations : interpolate/approximate points Pk
Easier to give a finite number of “control points”
The curve should be smooth in between
Why not polynomials? Which degree do we need?
u
31
Spline curves
Defined from control point Local control
− Joints between polynomial curve segments
− degree 3, C1 or C2 continuity
Spline curve
Control point
32
Interpolation vs. Approximation
P1P2
P3
P2
P3
P1
33
Splines curves
Mathematical formulation? Curve points = linear
combination of control points
C(u) =∑ Fk(u) Pk Curve’s degree of continuity = degree of
continuity of Fk
Desirable properties for the “influence functions” Fk?
34
Splines curvesSummary of desirable properties
C(t) =∑ Fk(t) Pk,
Interpolation & approximation− Affine invariance ∑ Fk(t) =1− Locality: Fk(t) with compact support− Parametric or geometric continuity
Approximation− Convex hull Fk(t) ≥0 − Variance reduction: no unwanted
oscillation
Tk Tk+1
u
35
Splines curvesMost important models
Interpolation− Hermite curves C1, cannot be local if C2 − Cardinal spline (Catmull Rom)
Approximation− Bézier curves− Uniform, cubic B-spline (unique definition,
subdivision)− Generalization to NURBS
36
Cardinal Spline, with tension=0.5
37
Uniform, cubic B-spline
38
Cubic splines: matrix equation
P1P2
P3 P4 P4
P2
P3
P1
Qi (u) = (u3 u2 u 1) Mspline [Pi-1 Pi Pi+1 Pi+2] t
Cardinal spline B-spline
−−−
−−
=
0020
0101
1452
1331
2
1CatmullM
−−
−−
=
0141
0303
0363
1331
6
1BsplineM
39
Splines surfaces
« Tensor product »: product of spline curves in u and v
Qi,j (u, v) = (u3 u2 u 1) M [Pi,j] Mt (v3 v2 v 1)
− Smooth surface?
− Convert to meshes?
− Locality?
40
Splines surfaces
• Expression with separable influence functions!
Qi,j (u, v) = ∑ Bi(u) Bj(v) Pij
u
v Historic example
Today's planning
1.Geometry representations: introduction
2.Point sets
3.Meshes
4.Splines and parametric surfaces
5.Subdivision surfaces
6.Implicit surfaces
42
Subdivision Curves & Surfaces
Start with a control polygon or mesh progressive refinement rule (similar
to B-spline) Smooth? use variance reduction!
− “corner cutting”
Chaikin
(½, ½)
43
How Chaikin’s algorithm works?
Qi = ¾ Pi + ¼ Pi+1
Ri = ¼ Pi + ¾ Pi+1
Ex: do Chaikin on a square
44
Subdivision Surfaces
Topology defined by the control polygon
Progressive refinement (interpolation or approximation)
Loop
Butterfly Catmull-Clark
= B-spline at regular vertices
45
Example : Butterfly Subdivision Surface
Interpolate Triangular Uniform &
Stationary Vertex insertion
(primal) 8-point
a = ½, b = 1/8 + 2w, c = -1/16 – w
w is a tension parameter
w = –1/16 => surface isn’t smooth
46
Example: Doo-SabinWorks on quadrangles;
Approximates
47
Comparison
Catmull-Clark
(primal)
Doo-Sabin
(dual)
48
49
50
At curve point / regular surface verticesSplines as limit of subdivision
schemes
Loop
Quartic uniform box splines
Catmull-Clark
Cubic uniform B-spline surface
Doo-Sabin
Quadratic uniform B-spline surface
Chaikin
Quadratic uniform B-spline curve
Today's planning
1.Geometry representations: introduction
2.Point sets
3.Meshes
4.Splines and parametric surfaces
5.Subdivision surfaces
6.Implicit surfaces
52
Implicit surfacesDefined by an Implicit Equation
S = { P(x,y,z) / f(x,y,z) = iso }
(f: R3→ R) is the «field function» Surface normal : N = - ∇ f Characterizes a volume! f (x,y,z) > iso
− “in/out test” (used for collisions, ray tracing…)
Smoothness: S and f have same degree of continuity
N
P
F>iso
F<iso
53
History: Solid Geometry
Volumetric primitives S = { P(x,y,z) / f(x,y,z) = iso }
Spheres, ellipsoids
Cylinders, cones
Super-ellipsoids
12
2
2
2
2
2
=++c
z
b
y
a
x
1=++n
n
n
n
n
n
c
z
b
y
a
x
54
Constructive Solid Geometry
Developed for CAGD Solid primitives Boolean operators
− Union (or)− Intersection (and)− Difference (not)
Construction tree
Describes the history of construction in a compact, intuitive way
-
∪
∩
55
Problem: limited shapes
Free form primitives ? S = { P(x,y,z) / f(x,y,z) = iso }
f polynomial (algebric surface), or other smooth function
What should the equation of f be to model this?
How can a user control an implicit shape?
− Intuitive control− Locality− Enable deformations
56
Idea (1982) Blinn Objects “Blobs”
Primitive generated by
points S− f decreasing function of the
distance
Union : f = max (f1,f2)
Intersection : f = min (f1,f2)
Blending : f = f1 + f2
sp
f
Distance
57
Idea (1982) Blinn Objects “Blobs”
Exponential field + Very smooth − No local control − Everything is to be recomputed if a point
moves
Extension to blend primitives of different
sizes
2
)( 2SiPd
i ef−−
=field
Distance to centre
2
2
)(
)(
i
i
SR
SPd
ii ekf−−
=
58
Displaying implicit surfaces?Ray Tracing [Blinn 82]
• Use dichotomy to compute ray/surface intersections
Later extensions• Analytical solutions for intersection• Sphere tracing
– adapt the step size based on Lipschitz constants
Several hours for rendering from a single view-point!
59
Make implicit surfaces local?(1985-1990)
Field function with compact support!
− piece-wise polynomial functions in d(P,Si)2
Metaballs [Nishimura 1985] − if 0<d<1/3 fi = 1- 3 d2
− if 1/3<d<1 fi = 3/2 (1-d2)
Soft Objects [Wyvill et al. 1986]- if 0<d<1 fi = -4/9 d6 + 17/9 d4 – 22/9 d2 +1
field
Distance to centre
60
Improving visualization?(1985-1990)
Marching cubes [Lorensen Cline 87]
– Space grid– Facetize voxels that cross the surface– Mesh can be viewed from different
viewpoints– Extension: file to follow the surface
61
Improving visualization?(1985-1990)
Marching cubes [Bloomenthal 1993-1994]
– Evaluation of implicit surface tilers [– An implicit surface polygonizer (paper +
code in C)
62
Extensions (1990-2000)
Skeleton-based Implicit Surfaces
Idea: Use any primitive Si as a skeleton
S = { P / ∑ fi (P) = iso }
fi decreasing function of d(P,Si)
Intuitive control, deformation, change of topology
fi
Distanceiso
e Point, segments, disc, cylinder
Appendix: internship proposals1. Animated mesh construction
from scans of articulated objects
2. Creation of dynamic hair strands from 2D linesWith Florence Bertails (BiPop team)
3. Classification of non-manifold objects based on topological propertiesWith Jean-Claude Léon
http://evasion.imag.fr/Membres/Franck.Hetroy/Students/internships.html
Proposal 1: animated mesh
Objective: from scans of an object under different poses, create a single animation
Matching between created meshes
Interpolation frames Related MoSIG courses:
Computer Graphics (modeling + animation)
(Computational Geometry) (Computer Vision)
Courtesy L. Belcour, E. Heitz and A. Masson-Sibut
Proposal 2: dynamic hair strands
Objective: from a 2D sketched curve + physical model, create a 3D model of a hair strand
Geometric reconstruction of a 3D curve
Attach physical parameters For realistic animation
Related courses: MoSIG Computer Graphics (animation) (Simple) geometry + mechanics
Proposal 3: non-manifolds
Objective: classify non-manifold surfaces based on topology Maths + algorithms
Applications in CAD, architecture, graphics, ...
Collaboration with Univ. Genova 3 weeks in Italy possible
Related MoSIG course: Computational Geometry
To do for next week
Read the papers Understand the papers Find, read and understand other papers/book
chapters− In case things are not clear
Next week: Problem to solve in teams
− Related to these papers