daned Computer Graphis (Spring 23) CS 283, Leture 5: Mesh Simplifiation Rai Ramamoorthi http://inst.ees.berkeley.edu/~s283/sp3 To Do ssignment, Due Feb 22 Start reading and working on it now. This leture starts disussing early parts of assignment, followed by mesh simplifiation Outline Basi assignment oeriew Detailed disussion of mesh simplifiation Progressie meshes Quadri error metris ssignment Oeriew Implement omplete system for mesh simplifiation Plus maybe progressie meshes Possibly hallenging assignment: start ery early and proeed in inremental fashion Choie of data struture for meshes is the key (read the assignment) This inoles fairly reent work. No one answer Think about the best way of proeeding, use reatiity Mesh Viewer (3.) Deliberately, no skeleton ode for assignment Think about and implement full system from srath First step: Mesh iewer Read meshes (in simple OFF file format), iew them Can reuse ode from 84 (if stuk, try hw in 84) Shading: must aerage fae normals per ertex (this may gie you a start in implementing a mesh data struture) Debugging modes for shading (olor eah triangle separately with an indiidual olor) Software Design Define mesh lass with display method et. Use C++ STL data strutures where appropriate (see assn) Mesh Connetiity (3.2) Build up mesh onnetiity data struture Input is erties and faes from input file Goal is to do edge ollapses in onstant time No iteration oer whole mesh Most of mesh unhanged Important uestions for your data struture to answer: What erties neighbor my urrent ertex? and What faes neighbor my urrent ertex Think about updating your data struture. Collapsing an edge may reuire more than just the edge itself. You must update eery ertex or fae that has hanged
Mesh Deimation (edge ollapse) Can you handle this orretly and effiiently? Debugging examples in testpath and plane (do these first) Mesh Deimation (edge ollapse) Can you handle this orretly and effiiently? Debugging examples in testpath and plane (do these first) Mesh Deimation (edge ollapse 3.3) Create new ertex (based on appropriate rule) Find all faes/edges neighbor ertex (suh as ) Change them to use instead of. Do the same for Depend on data struture, you need to fix all faes, edges Mesh Data Struture Hints Simplest (I think): Faes store onstituent erties [indexed fae set as in OFF], erties store adjaent faes (how do you reate ertexfae adjaeny?) To simplify, first reate new ertex. djaent faes are those adjaent to or For eah of those faes, update to point to instead of or Mesh Deimation (edge ollapse 3.3) Mesh Deimation (edge ollapse 2.3) Create new ertex (based on appropriate rule like aerage) Find all faes that neighbor ertex (suh as ) Simple use of ertex to fae adjaeny Change them to use instead of. Do the same for Find faes neighboring edge - (suh as ) Remoe from mesh This may inole updating fae/ertex adjaeny relationships et. E.g. what is adjaeny for (faes adjaent to ertex?) re other erties affeted in terms of adjaent faes? Worry about triangle fins (extra redit, not disussed) 2
Mesh Data Struture Hints Mesh Deimation (edge ollapse 3.3) With indexed fae set plus ertex to fae adjaeny, remoing a fae should just work (remember to delete fae from ertex adjaeny lists) In general, winged edge, half-edge may be (slightly) more effiient, but also harder to implement Ultimately, your hoie and work out the details Good luk!! Find faes neighboring edge - (suh as ) Union of adjaent faes to ertex and ertex Update adjaeny lists For all erties, remoe that fae from their adjaeny list Remoe fae from mesh Triky Implementation When you remoe something, need to update appropriately Work out on paper first (e.g. indexed fae set plus adjaent faes for eah ertex) Depends on hoie of data struture (pik easy to do) Start with simple debugging ases (make sure not just that it looks right, but all adjaenies remain orret) Outline Basi assignment oeriew Detailed disussion of mesh simplifiation Progressie meshes Quadri error metris Suessie Edge Collapses ppearane Presering We hae disussed one edge ollapse, how to do that In pratie, seuene of edge ollapses applied Order et. based on some metri (later in leture) So, we gradually redue omplexity of model Progressie meshes is opposite: gradually inrease omplexity 3,95 tris,95 tris 488 tris 975 tris 7,89 tris Calteh & Stanford Graphis Labs and Jonathan Cohen 3
Progressie Meshes (3.5) GeoMorph (may not play in ppt) Write edge ollapses to file Read in file and inert order Key idea is ertex-split (opposite of edge-ollapse) Inlude some ontrol to make model oarser/finer E.g. Hoppe geomorph demo Vertex splits Can you handle this orretly and effiiently? Debugging examples in testpath and plane (do these first) Triky Implementation What info do you need to add something? Work out on paper first (e.g. indexed fae set plus adjaent faes for eah ertex) Start with simple debugging ases (make sure not just that it looks right, but all adjaenies remain orret) View-Dependent Simplifiation Simplify dynamially aording to iewpoint Visibility Silhouettes Lighting Outline Basi assignment oeriew Detailed disussion of mesh simplifiation Progressie meshes Quadri error metris Hoppe 4
Quadri Error Metris Garland & Hekbert, SIGGRPH 97 Greedy deimation algorithm Pair ollapse (allow edge + non-edge ollapses) Quadri error metris: Ealuate potential ollapses Determine optimal new ertex loations Bakground: Computing Planes Eah triangle in mesh has assoiated plane ax + by + z + d = For a triangle, find its (normalized) normal using ross produts Plane euation? n = n = B C B C a b n i i n = d = i n Quadri Error Metris Based on point-to-plane distane Better uality than point-to-point d d a d b a b Quadri Error Metris Sum of suared distanes from ertex to planes: Δ = Dist(,p) 2 = x y z p, p = a b d Dist(,p) = ax + by + z + d = p T Quadri Error Metris Δ = (p T ) 2 p = T pp T p = T pp T p = T Q Using Quadris pproximate error of edge ollapses Eah ertex has assoiated uadri Q Error of ollapsing and 2 to is T Q + T Q 2 Quadri for new ertex is Q =Q +Q 2 Common mathematial trik: uadrati form = symmetri matrix Q multiplied twie by a etor Initially, distane to all planes, net is for all erts 5
Using Quadris Find optimal loation after ollapse: 2 3 4 Q' = 2 22 24 3 33 34 4 24 34 44 min ' T Q'' : = = = ' x y z Using Quadris Find optimal loation after ollapse: 2 3 4 2 22 24 ' = 3 33 34 2 3 4 ' = 2 22 24 3 33 34 Results Original k tris Quadris tris Quadri Visualization Ellipsoids: iso-error surfaes Smaller ellipsoid = greater error for a gien motion Lower error for motion parallel to surfae Lower error in flat regions than at orners Elongated in ylindrial regions Results Summary Original 25 tris Quadris 25 tris, edge ollapses only First, implement basi mesh simplifiation on one edge Helps to hae right data struture Triky sine needs to be effiient and properly update Then, implement uadri error metris Triky; we will spend most of another leture on this Put edge ollapses in priority ueue Problem is that when you do one, you hae to update all the neighbors as well (just as for standard edge ollapse) nd re-insert in ueue (use appropriate data struture) 6