CPSC 695
Mesh OptimizationMarina L. Gavrilova
Brief Outline
Mesh Generation ApplicationsMesh OptimizationDynamic MeshesApplications
Terminology
DEM: Digital Elevation ModelViewer Dependent RefinementROAM: Realtime Optimally Adapting MeshCLOD: Continuous Level of Detail
What is mesh?It is often required to convert geometric objects in any other form to polygonal meshes of geometric simplexes (i.e. triangles) before renderingMeshes are used for computer modeling, biometric, GIS, cartographic, and animation applicationsMesh optimization techniques are used to reduce the mesh to an acceptable size (user defined), minimizing the loss of quality (subject to some form of error analysis).
Mesh definition
A mesh is defined as a pair (V,K) where V is the set of vertices and K is a simplicialcomplex specifying the connectivity of the mesh simplices (the adjacency of the vertices, edges and faces) [Hoppe].The 0-simplices are called vertices, the 1-simpices are called edges, and the 2-simplices are called faces. Triangulation is an example of mesh.
Example: 3D Terrain Rendering
• Uses DEM as input of the application
•Generates dynamic mesh to achieve frame coherent animated view in real-time
Mesh Optimization GoalsFor an arbitrary point (u,v) in the surface each goal contributes an
energy component to the energy function. The energy function E is defined as the weighted sum of all energy components where each corresponding weight pi is the priority of the energy component Ei:
In most optimization problems, the shape preservation is a majorgoal. Therefore, surface curvature index plays a significant role in the optimization process due to the fact that a curved surface requires greater number of simplexes compared to a planar (or less curved) surface to accommodate the same level of visual detail.
( , ) ( , )i iE u v p E u v= ∑
Mesh optimization problemsThere are three major categories for mesh optimization
problems:A fully detailed geometric mesh exists and the task is to
find an optimized mesh under the specified energy function and satisfying a user-defined level of detail (i.e. specified number of vertices).
A fully detailed geometric mesh exists and one has to find a hierarchical representation for rendering in dynamic multiple levels of detail (MLOD).
A surface is defined as a parametric function. One has to find an approximate mesh representation of that surface under specified goals and constraints in a framework for dynamic real-time continuous level of detail (CLOD).
Mesh optimization
Mesh optimization is the process of reducing a mesh M to a mesh M0, where M0contains less number of vertices and geometric primitives (i.e. triangles) than M. The goal is to find such mesh M0 that the no other mesh exists, which represent a better approximation of the mesh M0.
Methods for mesh optimization
Mesh optimization can be considered as is a compression method for geometric models with large details. In computer graphics, various processes are utilized such as:
regular tessellations,polygonized spline surfaces, polygonized parametric surfaces, polygonized implicit surfaces,range scanned surfaces and subdivision surfaces.
Basic ApproachThe entire optimization process can be viewed as an optimal spatial subdivision problem. There exist only two legal moves to achieve optimality: subdivide and merge. Models that are based on this concept do not require computationally extensive optimization process. Instead, the mesh progressively adapts to an optimal solution. These models usually define a multi-criteria based error metric to assess the energy of the mesh. Error metrics are more flexible than energy functions in a sense that they are capable of assessing an intermediate mesh both at a local and a global level.
Dynamic mesh conceptAt any given stage, one of the two following courses of action is chosen: subdivide or merge. If the number of vertices reaches the upper limit, details are reduced on the regions assessed with the lowest error contribution. At the same time, whenever the vertex count becomes lower than the upper limit, details are expanded on the region assessed with the highest error contribution. This greedy approach allows the intermediate mesh to optimally adapt to the minimal energy configuration, satisfying the specified set of constraints. This is the fundamental basis for a dynamic mesh algorithm.
Real-time terrain renderingUses a graphics Engine/LibraryCentral focus on efficient mesh representationView coherence and frame rate constancyLimited/Variable Level of DetailSpeed optimizationRepresenting layer data as textures or particles
Advantages of static modelsThere are various static mesh models used in GIS applications and computer games. They are regular tessellation, DelaunayTriangulation (DT) [ref], Triangulated Irregular Network (TIN). They provide the following advantages:
Well-known and well understood modelsEasy to implementOptimization is performed only once, so rendering application is simple to designEfficient for small scale objects
Disadvantages of static modelsDuring rendering of massive terrain or other GIS data:
Most of the geometry of a terrain is outside the view frustum due to its massive size. Static methods waste a lot of CPU cycles trying render the entire object. Although the enormous amount of detail is stored in memory for the entire object the visible area might constitute a tiny fraction of that detail. Consequently, static models are highly inefficient for terrain modeling.Viewpoint dependent refinement is not possible with static meshes. Have a bad triangle to screen pixel ration.Unable to obtain a steady performance.
Understanding Height FieldsDEM: Digital Elevation Model
• Contains only relative Height
• Regular interval
• Pixel color determine height
•Discrete resolution
Dynamic meshDynamic mesh generation is based on real-time adaptive models that allow local transformation of a given mesh to different levels of details and adapt progressively to the changes in the rendering environment. Dynamic models use some form of hierarchical data structure to store a mesh in multiple LOD.There are many different versions of dynamic mesh currently under research and development. Several patented technologies have been released in the industry (i.e. Intels MRM). The two most prominent approaches are Progressive Meshes (PM) and Real-time Optimally Adapting Mesh (ROAM).
PM vs. ROAM
PM can be seen as a bottom up approach where as ROAM is a top-down approach. PM starts with an arbitrary mesh in maximum detail. It requires a massive amount of computation for the generation of the multi resolution hierarchical data structure representing the mesh at different LOD.ROAM starts with a simple mesh and refines detail in real-time during the rendering cycle.
Converting Height field data into 3D topological mesh
200 255 150 100
100 255 255 200
200 150 200 100
• Pixel value (z) is used as Height Map
• Vertices are generated as points in 3D
• A Mesh is triangulated
Mesh Representation
Goals:
Speed
Quality
Constancy
Representations:
Progressive Meshes
ROAM: Real-time Optimally Adapting Mesh
Progressive MeshesDeveloped by Hugues Hoppe, Microsoft Research Inc. Published first in SIGGRAPH 1996.
How PM works…
ROAM :•Can Subdivide when more details necessary
•Merge & Split Queue
•Tree Structured
ROAM advantagesReal-time Optimally Adapting Mesh is an efficient top-down dynamic mesh model. In this model, real-time display of complex surfaces can be provided by dynamically computing a multi-resolution triangular mesh for each view.One can minimize geometric distortions on the screen while maintaining a fixed triangle count. Visual discontinuities could be minimized in several ways, and efficient mesh corrections can ensure selected lines of site, or object proximity are correctly represented.An incremental priority-queue based approach in ROAM allows exploiting frame-to-frame coherence for fast efficient computation of the adapting mesh.
Geometric subdivision
Problems with Geometric Subdivisions
ROAM principle
The basic operating principle of ROAM
Quadtree and Bintree for ROAM
Comparison between Quadtree (top) and Bintree (bottom)
ROAM Implementation and Improvements
Pre-process DEMReduce overhead for maintaining Split queueUse degenerated split queueReplace priority merge queue (HEAP) with a simple FIFO queue.Merge arbitrary obscured regions (outside visible frustum) only
Preprocessing of DEM input
Convolute the surface (2nd Difference)Efficient LOD distributionUsed in Advanced Shading (feature preservation)
Differentiating the Surface: Convolution
Original DEM of Kluane Park First differentiation. Blue area Shows steep mountains.
Final LOD distribution image Shows rocky areas require more details
Second Differentiation. Blue areas indicate steep mountain peaks.
Differentiating the Surface (cont’d)…
Take Weighted Average of neighboring pixel Gradients
2 passes gives us the rate of gradient changes
Statistical Analysis of ROAM
Bottleneck: Split and Merge Operation and visibility testOnly 2.7% triangles are merged within the visible frustum75% of split operations occurs on closest 5% region of the visible frustum
Proposed Priority Function for Split QueueDetermines RefinementDistribute LOD to preferred areaCan be changed
f=face, C=Camera U=Uniformity F=Frustum priorityD=Curvature priorityP=Distance priorityDET=Curvature (preprocessed)Lev(f)=Subdivision level of face f
( )UfLevCfCenterPfCenterDETDCfAngularityF
Cfiority)(1
)())((),(),(Pr
+
−×+×+×=
Speeding up the processAmortizing refinement
Updating the Split queue over multiple framesAllow split queue (heap) to degenerateRefine integrity using error threshold testRe-generate queue after constant number of framesDramatic gain in speed
Maintaining Degenerated S-Queue
Understanding Geo-MorphSmooth interpolation of vertex over subdivision
Requires maintenance of one additional queue (G-queue)
SmoothingCompute face normal Compute vertex normalLocal computation of normal during refinement (Geo-Morph)Apply vertex normal when renderingAdvanced shading: Linear combination of face and vertex normal (Hybrid)
Example of smoothing
Texturing
Compute uv coordinate during creation of each vertex (planar transform)
Load texture bitmap in the pipeline
Apply texture handle
Result with Texturing
Results (Output obtained)
Results (Runtime)Rendered Frame VS Time
020406080
100120140160180200
1 18 35 52 69 86 103
120
137
154
171
188
205
222
239
256
273
Frame
Tim
e of
Sim
ulat
ion
Results (Runtime) (Cont’d)Frames Per Second
0102030405060708090
100
0 50 100 150 200
Time of Simulation
FPS
Results (Runtime) (Cont’d)Mesh Face Counts
0
5000
10000
15000
20000
25000
0 50 100 150 200
Time of Simulation
Num
ber o
Fac
es
ROAM Face Rendered Faces
Results (Runtime) (Cont’d)
Geo Morph Load
0
100
200
300
400
500
0 50 100 150 200
Time of Simulation
# of
Ver
tices
in G
eo-m
oprh
Summary of Results
High Speed (45 FPS average)Continuity is achieved (Geo-Morph) Visual appeal (smoothing & Texture)Less variant Frame rateEfficient Understructure (amortized update)
Other Applications
Motion PlanningSpatial-Temporal AnalysisMassive Terrain RenderingComputer Games
Next: Photo Realistic 3D Terrain