Computer Graphcs - Splne and Subdvson Surfaces - Hendrk Lensch
Overvew Last Tme Image-Based Renderng Today Parametrc Curves Lagrange Interpolaton Hermte Splnes Bezer Splnes DeCasteljau Algorthm Parameterzaton 2
B-Splnes Goal Splne curve wth local control and hgh contnuty Gven Degree: n Control ponts: P 0,..., P m (Control polygon, m n+1) Knots: t 0,..., t m+n+1 (Knot vector, weakly monotonc) The knot vector defnes the parametrc locatons where segments jon B-Splne Curve P( t) = m = 0 N n ( t) P Contnuty: C n-1 at smple knots C n-k at knot wth multplcty k
B-Splne Bass Functons Recursve Defnton ) ( ) ( ) ( otherwse 0 f 1 ) ( 1 1 1 1 1 1 1 0 t N t t t t t N t t t t t N t t t t N n n n n n n + + + + + + + + = < < = 0 1 2 3 4 5 0 1 2 3 4 5 N 0 0 N 1 0 N 2 0 N 3 0 N 4 0 N 0 1 N 1 1 N 2 1 N 3 1 Unform Knot vector
B-Splne Bass Functons Recursve Defnton Degree ncreases n every step Support ncreases by one knot nterval
B-Splne Bass Functons Unform Knot Vector All knots at nteger locatons UBS: Unform B-Splne Example: cubc B-Splnes B = N n n Local Support = Localzed Changes Bass functons affect only (n+1) Splne segments Changes are localzed P = n d n Degree 2
B-Splne Bass Functons Convex Hull Property Splne segment les n convex Hull of (n+1) control ponts Degree 2 (n+1) control ponts le on a straght lne curve touches ths lne n control ponts concde curve nterpolates ths pont and s tangental to the control polygon (e.g. begnnng and end)
Normalzed Bass Functons Bass Functons on an Interval n Partton of unty: N ( t) = 1 Knots at begnnng and end wth multplcty Interpolaton of end ponts and tangents there Converson to Bézer segments va knot nserton
deboor-algorthm Evaluatng the B-Splne Recursve Defnton of Control Ponts Evaluaton at t: t l < t < t l+1 : {l-n,..., l} Due to local support only affected by (n+1) control ponts Propertes Affne nvarance Stable numercal evaluaton All coeffcents > 0 r r n r r r n r r P t P t P t t t t t P t t t t t P = + = + + + + + + + + + ) ( ) ( ) ( ) (1 ) ( 0 1 1 1 1 1 n n d t P = ) (
Knot Inserton Algorthm smlar to deboor Gven a new knot t t l t < t l+1 : {l-n,..., l} T*= T {t} New representaton of the same curve over T* Applcatons Refnement of curve, dsplay Consecutve nserton of three knots at t=3 nto a cubc B-Splne Frst and last knot have multplcty n T=(0,0,0,0,1,2,4,5,6,6,6,6), l=5 + + = + = = + + = 1 1 0 1 ) (1 ) ( ) ( 1 * * 1 0 * l l n l n l t t t t a P a P a P P t N t P n m n
Converson to Bézer Splne B-Splne to Bézer Representaton Remember: Curve nterpolates pont and s tangental at knots of multplcty n In more detal: If two consecutve knots have multplcty n The correspondng splne segment s n Bézer from The (n+1) correspondng control polygon form the Bézer control ponts
NURBS Non-unform Ratonal B-Splnes Homogeneous control ponts: now wth weght w P =(w x, w y, w z, w )= w P = = = = = = = = = m n n n m n m n m n m n w t N w t N t R P w t R w t N P w t N P P t N t P 0 0 0 0 0 ) ( ) ( ) ( mt, ) ( ) ( ) ( ) ( ) (
NURBS Propertes Pecewse ratonal functons Weghts Hgh (relatve) weght attract curve towards the pont Low weghts repel curve from a pont Negatve weghts should be avoded (may ntroduce sngularty) Invarant under projectve transformatons Varaton-Dmnshng-Property (n functonal settng) Curve cuts a straght lne no more than the control polygon does
Examples: Cubc B-Splnes
Knots and Ponts multplcty = n at begnnng and end strctly monotonous knot vector knots or ponts replcated [00012345678999] [0123456789] [P 0, P 1,P 2,P 3,P 4,P 5,P 6, P 7,P 8,P 9,P 0,P 1,P 2 ]
Splne Surfaces
Parametrc Surfaces Same Idea as wth Curves P: R 2 R 3 P(u,v) = (x(u,v), y(u,v), z(u,v)) T R 3 (also P(R 4 )) Dfferent Approaches Trangular Splnes Sngle polynomal n (u,v) va barycentrc coordnates wth respect to a reference trangle (e.g. B-Patches) Tensor Product Surfaces Separaton nto polynomals n u and n v Subdvson Surfaces Start wth a trangular mesh n R 3 Subdvde mesh by nsertng new vertces Dependng on local neghborhood Only pecewse parameterzaton (n each trangle)
Tensor Product Surfaces Idea Create a curve of curves" Smplest case: Blnear Patch Two lnes n space P P 1 2 ( v) = (1 v) P ( v) Connected by lnes P( u, v) = (1 u) P (1 u)((1 v) P00 + vp10) + u((1 v) P Bézer representaton (symmetrc n u and v) P( u, v) = (1 v) P =, j= 0 Control mesh P j 1 B 1 00 01 1 ( u) B + vp + vp ( v) + up 1 j 10 11 ( v) P j 2 ( v) = P 10 01 v P 00 u P 01 + vp 11 ) P 11
Tensor Product Surfaces General Case Arbtrary bass functons n u and v Tensor Product of the functon space n u and v Commonly same bass functons and same degree n u and v P( u, v) = = 0 j= 0 Interpretaton Curve defned by curves P( u, v) = Symmetrc n u and v m n B m ( u) B m n B ( u) = 0 j= 0 n j P ( v) ( v) P j B j ( v) Pj 14243
Matrx Representaton Smlar to Curves Geometry now n a tensor (m x n x 3) Degree u: m v: n Along the dagonal (u=v): m+n Not nce Trangular Splnes ( ) T T V UV n n n nn m T monom V U v v G G G G u u V U v u P U B G B G 00 0 0 1 1 ), ( = = = M L M O M L L
Tensor Product Surfaces Propertes Derved Drectly From Curves Bézer Surface: Surface nterpolates corner vertces of mesh Vertces at edges of mesh defne boundary curves Convex hull property holds Smple computaton of dervatves Drect neghbors of corners vertces defne tangent plane Smlar for Other Bass Functons
Tensor Product Surfaces Modfyng a Bézer Surface
Tensor Product Surfaces Representng the Utah Teapot as a set contnuous Bézer patches http://www.holmes3d.net/graphcs/teapot/
Operatons on Surfaces decausteljau/deboor Algorthm Once for u n each column Once for v n the resultng row Due to symmetry also n other order Smlarly we can derve the related algorthms Subdvson Extrapolaton Dsplay...
Ray Tracng of Splne Surfaces Several approaches Tessellate nto many trangles (usng decasteljau or deboor) Often the fasted method May need enormous amounts of memory Recursve subdvson Smply subdvde patch recursvely Delete parts that do not ntersect ray (Prunng) Fxed depth ensures crack-free surface Bézer Clppng [Sederberg et al.] Fnd two orthogonal planes that ntersect n the ray Project the surface control ponts nto these planes Intersecton must have dstance zero Root fndng Can elmnate parts of the surface where convex hull does not ntersect ray Must deal wth many specal cases rather slow
Hgher Dmensons Volumes Splne: R 3 R Volume densty Rarely used Splne: R 3 R 3 Modfcatons of ponts n 3D Dsplacement mappng Free Form Deformatons (FFD) FFD
Subdvson Surfaces
Modelng How do we... Represent 3D objects n a computer? Construct such representatons quckly and/or automatcally wth a computer? Manpulate 3D objects wth a computer? 3D Representatons provde the foundatons for Computer Graphcs Computer-Aded Geometrc Desgn Vsualzaton Robotcs, Dfferent methods for dfferent object representatons
3D Object Representatons Raw data Range mage Pont cloud Polygon soup Surfaces Mesh Subdvson Parametrc Implct Solds Voxels BSP tree CSG
Range Image Range mage Acqured from range scanner E.g. laser range scanner, structured lght, phase shft approach Structured pont cloud Grd of depth values wth calbrated camera 2-1/2D: 2D plus depth
Pont Cloud Unstructured set of 3D pont samples Often constructed from many range mages
Polygon Soup Unstructured set of polygons
3D Object Representatons Raw data Pont cloud Range mage Polygon soup Surfaces Mesh Subdvson Parametrc Implct Solds Voxels BSP tree CSG
Mesh Connected set of polygons (usually trangles)
Parametrc Surface Tensor product splne patches Careful constrants to mantan contnuty
Subdvson Surface Coarse mesh & subdvson rule Defne smooth surface as lmt of sequence of refnements
Implct Surface Ponts satsfyng: F(x,y,z) = 0
3D Object Representatons Raw data Pont cloud Range mage Polygon soup Surfaces Mesh Subdvson Parametrc Implct Solds Voxels BSP tree CSG
Voxels Unform grd of volumetrc samples Acqured from CAT, MRI, etc.
BSP Tree Bnary space partton wth sold cells labeled Constructed from polygonal representatons
CSG Constructve Sold Geometry Herarchy of boolean set operatons (unon, dfference, ntersect) appled to smple shapes
Motvaton Splnes Tradtonally splne patches (NURBS) have been used n producton for character anmaton. Dffcult to sttch together Mantanng contnuty s hard Dffcult to model objects wth complex topology Subdvson n Character Anmaton Tony Derose, Mchael Kass, Ten Troung (SIGGRAPH 98) (Ger s Game, Pxar 1998)
Motvaton Splnes (Bézer, NURBS, ) Easy and commonly used n CAD systems Most surfaces are not made of quadrlateral patches Need to trm surface: Cut of parts Trmmng NURBS s expensve and often has numercal errors Very dffcult to stch together separate surfaces Very hard to hde seams
Why Subdvson Surfaces? Subdvson methods have a seres of nterestng propertes: Applcable to meshes of arbtrary topology (non-manfold meshes). No trmmng needed Scalablty, level-of-detal. Numercal stablty. Smple mplementaton. Compact support. Affne nvarance. Contnuty Stll less tools n CAD systems (but mprovng quckly)
Types of Subdvson Interpolatng Schemes Lmt Surfaces/Curve wll pass through orgnal set of data ponts. Approxmatng Schemes Lmt Surface wll not necessarly pass through the orgnal set of data ponts.
Example: Ger s Game Subdvson surfaces are used for: Ger s hands and head Clothes: Jacket, Pants, Shrt Te and Shoes (Ger s Game, Pxar 1998)
Subdvson Construct a surface from an arbtrary polyhedron Subdvde each face of the polyhedron The lmt wll be a smooth surface
Subdvson Curves and Surfaces Subdvson curves The basc concepts of subdvson. Subdvson surfaces Important known methods. Dscusson: subdvson vs. parametrc surfaces. Based on sldes Courtesy of Ad Levn, Tel-Avv U.
Curves: Corner Cuttng
Corner Cuttng 3 : 1 1 : 3
Corner Cuttng
Corner Cuttng
Corner Cuttng
Corner Cuttng
Corner Cuttng
Corner Cuttng
Corner Cuttng A control pont The lmt curve The control polygon
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme 1 : 1 1 : 1
The 4-Pont Scheme 1 : 8
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme
The 4-Pont Scheme A control pont The lmt curve The control polygon
Subdvson Curves Non nterpolatory subdvson schemes Corner Cuttng Interpolatory subdvson schemes The 4-pont scheme
Basc Concepts of Subdvson Defnton A subdvson curve s generated by repeatedly applyng a subdvson operator to a gven polygon (called the control polygon). The central theoretcal questons: Convergence: Gven a subdvson operator and a control polygon, does the subdvson process converge? Smoothness: Does the subdvson process converge to a smooth curve?
Surfaces Subdvson Schemes A control net conssts of vertces, edges, and faces. Refnement In each teraton, the subdvson operator refnes the control net, ncreasng the number of vertces (approxmately) by a factor of 4. Lmt Surface In the lmt the vertces of the control net converge to a lmt surface. Topology and Geometry Every subdvson method has a method to generate the topology of the refned net, and rules to calculate the locaton of the new vertces.
Subdvson Schemes There are dfferent subdvson schemes Dfferent methods for refnng topology Dfferent rules for postonng vertces Interpolatng versus approxmatng
Trangular Subdvson For control nets whose faces are trangular. Old vertces New vertces Every face s replaced by 4 new trangular faces. The are two knds of new vertces: Green vertces are assocated wth old edges Red vertces are assocated wth old vertces.
Loop Subdvson Scheme Works on trangular meshes Is an Approxmatng Scheme Guaranteed to be smooth everywhere except at extraordnary vertces.
Loop s Scheme Locaton of New Vertces Every new vertex s a weghted average of the old vertces. The lst of weghts s called the subdvson mask or the stencl A rule for new red vertces α n /n α n /n A rule for new green vertces 1 α n /n 1-α n 3 3 α n /n α n /n 1 2π αn = 40 3+ 2cos 64 n Orgnal 2 α n 3 n > 3 8 = 3 n = 3 16 Warren 1 n - the vertex valence
Loop Subdvson Boundares Subdvson Mask for Boundary Condtons 1 2 1 2 1 8 6 8 1 8 Edge Rule Vertex Rule
Subdvson as Matrces Subdvson can be expressed as a matrx S mask of weghts w. S mask s very sparse Never Implement ths way! Allows for analyss Curvature Lmt Surface = = 0 2 1 0 1 0 11 10 01 00 ˆ ˆ ˆ ˆ 0 0 0 0 0 ˆ p p p p p p p w w w w w P P S n nj mask M M L O M M L L S mask Weghts Old Control Ponts New Ponts
The Orgnal Control Net
After 1st Iteraton
After 2nd Iteraton
After 3rd Iteraton
The Lmt Surface The lmt surfaces of Loop s subdvson have contnuous curvature almost everywhere
Quadrlateral Subdvson Works for control nets of arbtrary topology After one teraton, all the faces are quadrlateral. Old vertces New vertces Old edge Old face Every face s replaced by quadrlateral faces. The are three knds of new vertces: Yellow vertces are assocated wth old faces Green vertces are assocated wth old edges Red vertces are assocated wth old vertces.
Catmull Clark s Scheme Step 1 Step 2 Step 3 1 Frst, all the yellow vertces are calculated 1 1 1 1 Then the green vertces are calculated usng the values of the yellow vertces 1 1 1 1 Fnally, the red vertces are calculated usng the values of the yellow vertces 1 1 1 1 1 1 w n 1 1 1 1 n - the vertex valence w n = n( n 2)
The Orgnal Control Net
After 1st Iteraton
After 2nd Iteraton
After 3rd Iteraton
The Lmt Surface The lmt surfaces of Catmull-Clarks s subdvson have contnuous curvature almost everywhere
Edges and Creases Most surface are not smooth everywhere Edges & creases Can be marked n model Weghtng s changed to preserve edge or crease Generalzaton to sem-sharp creases (Pxar) Controllable sharpness Sharpness (s) = 0, smooth Sharpness (s) = nf, sharp Achevable through hybrd subdvson step Subdvson ff s==0 Otherwse parameter s decremented
Adaptve Subdvson Not all regons of a model need to be subdvded. Idea: Use some crtera and adaptvely subdvde mesh where needed. Curvature Screen sze Make trangles < sze of pxel Vew dependence Dstance from vewer Slhouettes In vew frustum Careful! Must avod cracks subdv crack
Edges and Creases Increasng sharpness of edges
Edges and Creases Can be changed on a edge by edge bass
Texture mappng Sold color pantng s easy, already defned Texturng s not so easy Usng polygonal methods can result n dstorton Soluton Assgn texture coordnates to each orgnal vertex Subdvde them just lke geometrc coordnates Introduces a smooth scalar feld Used for texturng n Ger s jacket, ears, nostrls
Advanced Topcs Herarchcal Modelng Store offsets to vertces at dfferent levels Offsets performed n normal drecton Can change shape at dfferent resolutons whle rest stays the same Surface Smoothng Can perform flterng operatons on meshes E.g. (Wegthed) averagng of neghbors Level-of-Detal Can easly adjust maxmum depth for renderng
Wrapup: Subdvson Surfaces Advantages Smple method for descrbng complex surfaces Relatvely easy to mplement Arbtrary topology Local support Guaranteed contnuty Mult-resoluton Dffcultes Intutve specfcaton Parameterzaton Intersectons