Download presentation
Published byPrudence Webster Modified over 9 years ago
0
Bing-Yu Chen National Taiwan University
Computer Graphics Bing-Yu Chen National Taiwan University
1
Geometry Graph and Meshes Surface Properties Bounding Volumes
Level-of-Details
2
Standard Graph Definitions
G=<V,E> V=vertices={A,B,C,D,E,F,G,H,I,J,K,L} E=edges= {(A,B),(B,C),(C,D),(D,E),(E,F),(F,G), (G,H),(H,A),(A,J),(A,G),(B,J),(K,F), (C,L),(C,I),(D,I),(D,F),(F,I),(G,K), (J,L),(J,K),(K,L),(L,I)} Vertex degree (valence)=number of edges incident on vertex Ex. deg(J)=4, deg(H)=2 k-regular graph=graph whose vertices all have degree k Face: cycle of vertices/edges which cannot be shortened F=faces= {(A,H,G),(A,J,K,G),(B,A,J),(B,C,L,J),(C,I,J),(C,D,I), (D,E,F),(D,I,F),(L,I,F,K),(L,J,K),(K,F,G)}
3
Meshes Mesh: straight-line graph embedded in R3
Boundary edge: adjacent to exactly one face Regular edge: adjacent to exactly two faces Singular edge: adjacent to more than two faces Corners V x F Half-edges E x F Closed Mesh: mesh with no boundary edges Manifold Mesh: mesh with no singular edges
4
Manifold Non-Manifold Closed Manifold Open Manifold
5
1-Manifolds What is 1-manifolds ?
every point on a 1-manifold has some arbitrarily small neighborhood of points around it that can be considered topologically the same as a line
6
2-Manifolds What is 2-manifolds ?
every point on a 2-manifold has some arbitrarily small neighborhood of points around it that can be considered topologically the same as a disk in the plane every edge is shared by exactly two triangles and every triangle shares an edge with exactly three neighboring triangles
7
1-Manifold & 2-Manifold Examples
1-Manifolds line circle ... 2-Manifolds sphere torus cylinder
8
Euler’s Formula Polyhedron Simple Polyhedron Euler’s Formula
a solid that is bounded by a set of polygons whose edges are each a member of an even number of polygons Simple Polyhedron a polyhedron that can be deformed into a sphere Euler’s Formula a simple polyhedron satisfies
9
Simple Polyhedra Example
10
Euler’s Formula states necessary but not sufficient conditions for a simple polyhedron additional constraints are needed 1 edge must connect 2 vertices 1 edge must be shared by exactly 2 faces at least 3 edges must meet at 1 vertex faces must not interpenetrate
11
Euler’s Formula Applies to 2-Manifolds with Holes
: the number of holes in the faces : the number of holes that pass through the object : the number of separate components if is its genus
12
Orientability Orientation of a face is clockwise or anticlockwise order in which its vertices and edges are lists This defines the direction of face normal Straight line graph is orientable if orientations of its faces can be chosen so that each edge is oriented in both directions x z G H E C B A D F Oriented F={(L,J,B),(B,C,L),(L,C,I), (I,K,L),(L,K,J)} Not Oriented F={(B,J,L),(B,C,L),(L,C,I), (L,I,K),(L,K,J)} Back Face Culling = Front Facing
13
Definitions of Triangle Meshes
{f1} : { v1 , v2 , v3 } {f2} : { v3 , v2 , v4 } … connectivity geometry {v1} : (x,y,z) {v2} : (x,y,z) … face attributes {f1} : “skin material” {f2} : “brown hair” … In computer graphics, geometric models are commonly represented as triangle meshes. As shown here, a mesh consists of a set of triangular faces pasted together along their edges and meeting at a common set of vertices. In a traditional representation, a mesh is represented as a set of vertices containing xyz coordinates, and a set of faces containing indices referring back to the vertices. Besides geometry, other appearance attributes are often present in a mesh, such as vertex normals, vertex colors, material attributes, and texture maps. These appearance attributes are also associated with the vertices and faces of the mesh. [Hoppe 99’]
14
Definitions of Triangle Meshes
{v2,f1} : (nx,ny,nz) (u,v) {v2,f2} : (nx,ny,nz) (u,v) … corner attributes {f1} : { v1 , v2 , v3 } {f2} : { v3 , v2 , v4 } … connectivity geometry {v1} : (x,y,z) {v2} : (x,y,z) … face attributes {f1} : “skin material” {f2} : “brown hair” … [Hoppe 99’]
15
Definitions of Triangle Meshes
vertex face boundary corner wedge edge A geometric 3D model is usually represented as triangular meshes. If either an edge is a boundary edge, or its adjacent vertices have different normal vectors, or its two adjacent faces have different material properties, this edge is called a sharp edge, like the blue lines in this figure. 3次元モデルは通常三角形メッシュにより表現されています。[ENTER]もし、あるエッジが境界エッジであるか、[ENTER]このエッジに隣接する2つの頂点が異なる法線ベクトルをもつか、あるいは[ENTER]このエッジに隣接する2つの面が異なる材質属性をもつならば、[ENTER]そのエッジはシャープエッジと定義します。例えば、画面上の青い線です。[ENTER] different normal vectors (corner attributes) different material properties (face attributes)
16
Data Structure Mesh : Wedge : Vertex : Face : Material : Vertex array
Wedge array Face array Material array Wedge : Vertex index Wedge attributes Vertex : Vertex attributes Face : Wedge index x 3 Material index Material : Material attributes
17
Data Structure Mesh : Vertex : Face : Material : Vertex array
Face array Material array Vertex : Vertex attributes Face : Vertex index x 3 Material index Material : Material attributes
18
Mesh Data Structures Uses of mesh data: Storage of generic meshes
Rendering Geometry queries What are the vertices of face #3? Are vertices i and j adjacent? Which faces are adjacent face #7? Geometry operations Remove/add a vertex/face Mesh simplification Vertex split, edge collapse Storage of generic meshes hard to implement efficiently Assume: orientable, manifold and triangular
19
Storing Mesh Data How “good” is a data structure?
Time to construct – preprocessing Time to answer a query Time to perform an operation update the data structure Space complexity Redundancy
20
1. List of Faces List of vertices (coordinates) List of faces Queries:
triplets of pointers to face vertices (c1,c2,c3) Queries: What are the vertices of face #3? O(1) – checking the third triplet Are vertices i and j adjacent? A pass over all faces is necessary – NOT GOOD
21
1. List of Faces Example vertex coordinate v1 (x1,y1,z1) v2 (x2,y2,z2)
vertices (ccw) f1 (v1,v2,v3) f2 (v2,v4,v3) f3 (v3,v4,v6) f4 (v4,v5,v6)
22
1. List of Faces Pros: Cons: Convenient and efficient (memory wise)
Can represent non-manifold meshes Cons: Too simple – not enough information on relations between vertices and faces
23
OBJ File Format (simple ver.)
v x y z vn i j k f v1 // vn1 v2 // vn2 v3 // vn3
24
2. Adjacency matrix View mesh as connected graph
Given n vertices build nxn matrix of adjacency information Entry (i,j) is TRUE value if vertices i and j are adjacent Geometric info list of vertex coordinates Add faces list of triplets of vertex indices (v1,v2,v3)
25
2. Adjacency matrix Example vertex coordinate v1 (x1,y1,z1) v2
f1 f2 f3 f4 v6 v5 v4 v2 v1 v3 vertex coordinate v1 (x1,y1,z1) v2 (x2,y2,z2) v3 (x3,y3,z3) v4 (x4,y4,z4) v5 (x5,y5,z5) v6 (x6,y6,z6) v1 v2 v3 v4 v5 v6 1 face vertices (ccw) f1 (v1,v2,v3) f2 (v2,v4,v3) f3 (v3,v4,v6) f4 (v4,v5,v6)
26
2. Adjacency matrix Queries: What are the vertices of face #3?
O(1) – checking the third triplet of faces Are vertices i and j adjacent? O(1) – checking adjacency matrix at location (i,j) Which faces are adjacent of vertex j? Full pass on all faces is necessary
27
2. Adjacency matrix Pros: Cons: Information on vertices adjacency
Stores non-manifold meshes Cons: Connects faces to their vertices, BUT NO connection between vertex and its face
28
3. DCEL (Doubly-Connected Edge List)
Record for each face, edge and vertex Geometric information Topological information Attribute information aka Half-Edge Structure
29
3. DCEL Vertex record: Face record: Half-edge record: Coordinates
origin(e) e next(e) twin(e) prev(e) IncFace(e) Vertex record: Coordinates Pointer to one half-edge that has v as its origin Face record: Pointer to one half-edge on its boundary Half-edge record: Pointer to its origin, origin(e) Pointer to its twin half-edge, twin(e) Pointer to the face it bounds, IncidentFace(e) face lies to left of e when traversed from origin to destination Next and previous edge on boundary of IncidentFace(e)
30
3. DCEL Operations supported: Queries:
Walk around boundary of given face Visit all edges incident to vertex v Queries: Most queries are O(1)
31
3. DCEL Example vertex coordinate IncidentEdge v1 (x1,y1,z1) e2,1 v2
f1 f2 f3 e1,1 e2,1 e3,1 e3,2 e4,1 e5,1 e4,2 e6,1 e7,1 Example vertex coordinate IncidentEdge v1 (x1,y1,z1) e2,1 v2 (x2,y2,z2) e1,1 v3 (x3,y3,z3) e4,1 v4 (x4,y4,z4) e7,1 v5 (x5,y5,z5) e5,1 face edge f1 e1,1 f2 e3,2 f3 e4,2
32
3. DCEL Example Half-edge origin twin IncidentFace next prev e3,1 v3
33
3. DCEL Pros: Cons: All queries in O(1) time
All operations are (usually) O(1) Cons: Represents only manifold meshes
34
Geometry Data Vertex position Vertex normal Vertex color
(x, y, z, w) in model space or screen space Vertex normal (nx, ny, nz) Vertex color (r, g, b) or (diffuse, specular) Texture coordinates on vertex (u1, v1), (u2, v2), … Skin weights (bone1, w1, bone2, w2, …) Tangent and bi-normal N T Bn
35
Topology Data Lines Indexed triangles Triangle strips/fans Surfaces
Line segments Polyline Open / closed Indexed triangles Triangle strips/fans Surfaces Non-Uniform Rational B-Spline (NURBS) Subdivision
36
Indexed Triangles Geometric data Topology Vertex data
polygon normal v0 vertex normal Geometric data Vertex data v0, v1, v2, v3, … (x, y, z, nx, ny, nz, tu, tv) or (x, y, z, cr, cg, cb, tu, tv, …) Topology Face v0 v3 v6 v7 right-hand rule for index Edge table v7 v3 v6
37
Triangle Strips/Fans v0 , v1 , v2 , v3 , v4 , v5 , v6 , v7
Get great performance to use triangle strips/fans for rendering on current hardware
38
Surface Properties Material Textures Shaders
39
Materials Material Local illumination Ambient Diffuse Emissive
Environment Non-lighted area Diffuse Dynamic lighting Emissive Self-lighting Specular with shineness Hi-light View-dependent Not good for hardware rendering Local illumination
40
Textures Textures Single texture Texture coordinate animation
Texture animation Multiple textures Alphamap Lightmap Base color texture Material or vertex colors
41
Shaders Programmable shading language
Vertex shader Pixel shader Procedural way to implement some process of rendering Transformation Lighting Texturing BRDF Rasterization Pixel fill-in Post-processing for rendering
42
Shader Pipeline Geometry Stage Rasterizer Stage Vertex Data
Topology Data Classic Transform & Lighting Vertex Shader Geometry Stage Clipping & Viewport Mapping Texturing Pixel Shader Rasterizer Stage Fog Alpha, Stencil, Depth Testing
43
Powered by Shaders Per-pixel lighting Motion blur Volume / Height fog
Volume lines Depth of field Fur rendering Reflection / Refraction NPR Shadow Linear algebra operators Perlin noise Quaternion Sparse matrix solvers Skin bone deformation Normal map Displacement map Particle shader Procedural Morphing Water Simulation
44
Motion Data Time-dependent data Transformation data Formats Position
Orientation Formats Pivot Position vector Quaternion Eurler angles Angular displacement
45
Bounding Volumes Bounding sphere Bounding cylinder
Axis-aligned bounding box (AABB) Oriented bounding box (OBB) Discrete oriented polytope (k-DOP) Bounding Sphere AABB k-DOP Bounding Cylinder OBB
46
Bounding Volume - Application
Collision detection Visibility culling Hit test Steering behavior in “Game AI”
47
Application Example – Bounding Sphere
Bounding sphere B1(c1, r1), B2(c2, r2) If the distance between two bounding spheres is larger than the sum of radius of the spheres, than these two objects have no chance to collide. D > Sum(r1, r2)
48
Application Example - AABB
Axis-aligned bounding box (AABB) Simplified calculation using axis-alignment feature But need run-timely to track the bounding box AABB
49
Application Example - OBB
Oriented bounding box (OBB) Need intersection calculation using the transformed OBB geometric data 3D containment test Line intersection with plane For games, OBB
50
Level-of-Details Discrete LOD Continuous LOD View-dependent LOD
Switch multiple resolution models run-timely Continuous LOD Use progressive mesh to dynamically reduce the rendered polygons View-dependent LOD Basically for terrain
51
Level of Detail: The Basic Idea
One solution: Simplify the polygonal geometry of small or distant objects Known as Level of Detail or LOD a.k.a. polygonal simplification, geometric simplification, mesh reduction, multiresolution modeling, …
52
Level of Detail: Traditional Approach
Create levels of detail (LODs) of objects: 69,451 polys 2,502 polys 251 polys 76 polys
53
Level of Detail: Traditional Approach
Distant objects use coarser LODs:
54
Traditional Approach: Discrete Level of Detail
Traditional LOD in a nutshell: Create LODs for each object separately in a preprocess At run-time, pick each object’s LOD according to the object’s distance (or similar criterion) Since LODs are created offline at fixed resolutions, this can be referred as Discrete LOD
55
Discrete LOD: Advantages
Simplest programming model; decouples simplification and rendering LOD creation need not address real-time rendering constraints Run-time rendering need only pick LODs
56
Discrete LOD: Advantages
Fits modern graphics hardware well Easy to compile each LOD into triangle strips, display lists, vertex arrays, … These render much faster than unorganized polygons on today’s hardware (3-5 x)
57
Discrete LOD: Disadvantages
So why use anything but discrete LOD? Answer: sometimes discrete LOD not suited for drastic simplification Some problem cases: Terrain flyovers Volumetric isosurfaces Super-detailed range scans Massive CAD models
58
Drastic Simplification: The Problem With Large Objects
Courtesy IBM and ACOG
59
Drastic Simplification: The Problem With Small Objects
Courtesy Electric Boat
60
Drastic Simplification: The Problem With Topology
Courtesy University of Utah
61
Drastic Simplification
For drastic simplification: Large objects must be subdivided Small objects must be combined Topology must be simplified Difficult or impossible with discrete LOD
62
Continuous Level of Detail
A departure from the traditional static approach: Discrete LOD: create individual LODs in a preprocess Continuous LOD: create data structure from which a desired level of detail can be extracted at run time.
63
Continuous LOD: Advantages
Better granularity better fidelity LOD is specified exactly, not chosen from a few pre-created options Thus objects use no more polygons than necessary, which frees up polygons for other objects Net result: better resource utilization, leading to better overall fidelity/polygon
64
Continuous LOD: Advantages
Better granularity smoother transitions Switching between traditional LODs can introduce visual “popping” effect Continuous LOD can adjust detail gradually and incrementally, reducing visual pops Can even geomorph the fine-grained simplification operations over several frames to eliminate pops [Hoppe 96, 98]
65
Continuous LOD: Advantages
Supports progressive transmission Progressive Meshes [Hoppe 97] Progressive Forest Split Compression [Taubin 98] Leads to view-dependent LOD Use current view parameters to select best representation for the current view Single objects may thus span several levels of detail
66
Methodology Sequence of local operations
Involve near neighbors - only small patch affected in each operation Each operation introduces error Find and apply operation which introduces the least error
67
Simplification Operations
Decimation Vertex removal v ← v-1 f ← f-2 Remaining vertices - subset of original vertex set
68
Simplification Operations
Decimation Edge collapse v ← v-1 f ← f-2 Triangle collapse v ← v-2 f ← f-4 Vertices may move
69
Simplification Operations
Contraction Pair contraction Cluster contraction (set of vertices) Vertices may move
70
Simplification Error Metrics
Measures Distance to plane Curvature Usually approximated Average plane Discrete curvature
71
The Basic Algorithm Repeat Until mesh size / quality is achieved
Select the element with minimal error Perform simplification operation (remove/contract) Update error (local/global) Until mesh size / quality is achieved
72
Implementation Details
Vertices/Edges/Faces data structure Easy access from each element to neighboring elements Use priority queue (e.g. heap) Fast access to element with minimal error Fast update
73
Progressive Meshes Collapse map Vertex list Triangle list
Render a model in different Level-of-Detail at run time User-controlledly or automatically change the percentage of rendered vertices Use collapse map to control the simplification process Index 1 2 3 4 5 6 7 8 Map Collapse map Vertex list Triangle list 1 2 3 4 5 6 7 8 2 5 1 3 8 6 4
74
View-dependent LOD for Terrain - ROAM
Real-time Optimal Adapting Meshes (ROAM) Use height map Run-timely to re-construct the active (for rendering) geometric topology (re-mesh) to get an optimal mesh (polygon count) to improve the rendering performance Someone calls this technique as the view-dependent level-of-detail Very good for fly-simulation-like application
75
Vertex Tree & Active Triangle List
The Vertex Tree represents the entire model a hierarchical clustering of vertices queried each frame for updated scene The Active Triangle List represents the current simplification list of triangle to be displayed
76
The Vertex Tree Each vertex tree node contains:
a subset of model vertices a representative vertex or repvert Folding a node collapses its vertices to the repvert Unfolding a node splits the repvert back into vertices
77
Vertex Tree Example Triangles in Active List Vertex Tree 8 7 R 2 I II
10 6 9 3 10 A B C 3 1 1 2 7 4 5 6 8 9 4 5 Triangles in Active List Vertex Tree
78
Vertex Tree Example Triangles in Active List Vertex Tree 8 7 R 2 A I
II 10 6 9 3 10 A B C 3 1 1 2 7 4 5 6 8 9 4 5 Triangles in Active List Vertex Tree
79
Vertex Tree Example Triangles in Active List Vertex Tree 8 R A I II 10
6 9 3 10 A B C 3 1 2 7 4 5 6 8 9 4 5 Triangles in Active List Vertex Tree
80
Vertex Tree Example Triangles in Active List Vertex Tree 8 R A I II 10
6 9 3 10 A B C 3 1 2 7 4 5 6 8 9 B 4 5 Triangles in Active List Vertex Tree
81
Vertex Tree Example Triangles in Active List Vertex Tree 8 R A I II 10
9 3 10 A B C 3 1 2 7 4 5 6 8 9 B Triangles in Active List Vertex Tree
82
Vertex Tree Example Triangles in Active List Vertex Tree 8 R C A I II
10 9 3 10 A B C 3 1 2 7 4 5 6 8 9 B Triangles in Active List Vertex Tree
83
Vertex Tree Example Triangles in Active List Vertex Tree R C A I II 10
3 10 A B C 3 1 2 7 4 5 6 8 9 B Triangles in Active List Vertex Tree
84
Vertex Tree Example Triangles in Active List Vertex Tree R C A I II II
10 3 10 A B C 3 1 2 7 4 5 6 8 9 B Triangles in Active List Vertex Tree
85
Vertex Tree Example Triangles in Active List Vertex Tree R A I II II
10 10 A B C 3 1 2 7 4 5 6 8 9 B Triangles in Active List Vertex Tree
86
Vertex Tree Example Triangles in Active List Vertex Tree R A I II II
10 I 10 A B C 3 1 2 7 4 5 6 8 9 B Triangles in Active List Vertex Tree
87
Vertex Tree Example Triangles in Active List Vertex Tree R I II II I
10 A B C 3 1 2 7 4 5 6 8 9 B Triangles in Active List Vertex Tree
88
Vertex Tree Example Triangles in Active List Vertex Tree R I II II I R
10 A B C 3 1 2 7 4 5 6 8 9 B Triangles in Active List Vertex Tree
89
Vertex Tree Example Triangles in Active List Vertex Tree R I II R 10 A
B C 3 1 2 7 4 5 6 8 9 Triangles in Active List Vertex Tree
90
The Vertex Tree: Folding & Unfolding
1 2 3 4 5 6 7 8 9 10 A Fold node A 3 4 5 6 8 9 10 A Unfold node A
91
The Vertex Tree: Tris & Subtris
8 7 Fold node A 3 4 5 6 8 9 10 A 2 10 6 9 3 1 Unfold node A 4 5 Tris: triangles that change shape upon folding Subtris: triangles that disappear completely
92
Level-of-detail Suggestion
Apply progressive mesh for multi-resolution model generation Use in-game discrete LOD for performance tuning Why ? For modern game API / platform, dynamic vertex update is costly on performance Lock video memory stall CPU/GPU performance
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.