Presentation is loading. Please wait.

Presentation is loading. Please wait.

Level of Detail: Generating LODs David Luebke University of Virginia.

Similar presentations


Presentation on theme: "Level of Detail: Generating LODs David Luebke University of Virginia."— Presentation transcript:

1 Level of Detail: Generating LODs David Luebke University of Virginia

2 Review: Generating LODs Measuring error –Image-based ideas See Lindstrom & Turk, SIGGRAPH 2000

3 Review: Generating LODs Measuring error –Hausdorff distance One-sided: Two-sided: –Common approximations: Measure vertex-vertex distance, vertex-plane distance METRO: Sample H(A,B) by sprinkling points on triangles Quadrics: a variation of vertex-plane distance

4 Quadric Error Metric Goal: minimize distance to all planes at a vertex –Actually: minimize sum of squared distances to all planes Plane equation for each face: 0 :p  DCzByAx v           1 z y x DCBA T vp Distance to vertex v :

5 Squared Distance At a Vertex    )( ))(( vplanesp TT vppv    )( )( v p TT vppv v v vplanesp TT            )(    )( 2 )()( v p T vpv

6 Quadric Derivation (cont’d) pp T is simply the plane equation squared: The pp T sum at a vertex v is a matrix, Q:  vQvv T  )(              2 2 2 2 DCDBDAD CDCBCAC BDBCBAB ADACABA pp T

7 Q Construct a quadric Q for every vertex Q1Q1 Q2Q2 v2v2 v1v1 Q 1 T 1 Qvvcost edge  Sort edges based on edge cost –Suppose we contract to v 1 : –v 1 ’s new quadric is simply: Q 21 QQ  The edge quadric: Using Quadrics

8 Optimal Vertex Placement Each vertex has a quadric error metric Q associated with it –Error is zero for original vertices –Error nonzero for vertices created by merge operation(s) Minimize Q to calculate optimal coordinates for placing new vertex –Details in paper, involves inverting matrix –Authors claim 40-50% less error

9 Boundary Preservation To preserve important boundaries, label edges as normal or discontinuity For each face with a discontinuity, a plane perpendicular intersecting the discontinuous edge is formed. These planes are then converted into quadrics, and can be weighted more heavily with respect to error value.

10 Preventing Mesh Inversion Preventing foldovers: Calculate the adjacent face normals, then test if they would flip after simplification If foldover, that simplification can be weighted heavier or disallowed. 10 54 6 1 3 2 9 A 7 8 54 6 3 2 8 9 A merge

11 Quadric Error Metrics Pros: –Fast! (70K poly bunny to 100 polygons in seconds) –Good fidelity even for drastic reduction –Robust -- handles non-manifold surfaces –Aggregation -- can merge objects

12 Quadric Error Metrics Cons: –Introduces non-manifold surfaces (bug or feature?) –Needs further extension to handle color (e.g., use 7x7 matrices)

13 View-Dependent LOD: Algorithms l Many good published algorithms: –Progressive Meshes by Hoppe [SIGGRAPH 96, SIGGRAPH 97, …] –Merge Trees by Xia & Varshney [Visualization 96] –Hierarchical Dynamic Simplification by Luebke & Erikson [SIGGRAPH 97] –Multitriangulation by DeFloriani et al –Others…

14 l I’ll describe (surprise) my own work –Algorithm: VDS Implementation: VDSlib –Similar in concept to most other algorithms Overview: The VDS Algorithm

15 l Overview of the VDS algorithm: –A preprocess builds the vertex hierarchy, a hierarchical clustering of vertices –At run time, clusters appear to grow and shrink as the viewpoint moves –Clusters that become too small are collapsed, filtering out some triangles

16 Data Structures l The vertex hierarchy –Represents the entire model –Hierarchy of all vertices in model –Queried each frame for updated scene l The active triangle list –Represents the current simplification –List of triangles to be displayed –Triangles added and deleted by operations on vertex tree

17 The Vertex Hierarchy l Each node in vertex hierarchy supports a subset of the model vertices –Leaf nodes support a single vertex from the original full-resolution model –The root node supports all vertices l For each node we also assign a representative vertex or proxy

18 The Vertex Tree: Folding And Unfolding 3 1 2 9 87 10 54 6 A 9 8 54 6 A 3 Fold Node A Unfold Node A l Folding a node collapses its vertices to the proxy l Unfolding the node splits the proxy back into vertices

19 Vertex Tree Example 1 3 2 9 87 10 54 6 12745689 ABC D 3 E R Triangles in active list Vertex hierarchy

20 Vertex Tree Example 3 1 2 9 87 10 54 6 12745689 ABC D 3 E R A Triangles in active list Vertex hierarchy

21 Vertex Tree Example 9 8 10 54 6 12745689 BC D 3 E R A 3 A Triangles in active list Vertex hierarchy

22 Vertex Tree Example 9 8 10 54 6 12745689 BC D 3 E R A 3 B A Triangles in active list Vertex hierarchy

23 Vertex Tree Example 10 12745689 C D 3 E R A 3 B 8 9 AB Triangles in active list Vertex hierarchy

24 Vertex Tree Example 10 12745689 C D 3 E R A 3 B C 8 9 AB Triangles in active list Vertex hierarchy

25 Vertex Tree Example 10 12745689 D 3 E R A 3 B C ABC Triangles in active list Vertex hierarchy

26 Vertex Tree Example E 10 12745689 D 3 R A 3 B C E ABC Triangles in active list Vertex hierarchy

27 Vertex Tree Example 10 12745689 C D 3 R A B E AB E Triangles in active list Vertex hierarchy

28 Vertex Tree Example 12745689 C103 R B E D A AB DE Triangles in active list Vertex hierarchy

29 Vertex Tree Example 12745689 AC103 R B E D B DE Triangles in active list Vertex hierarchy

30 Vertex Tree Example 12745689 AC103 R R B E D B DE Triangles in active list Vertex hierarchy

31 Vertex Tree Example 12745689 ABC10 D 3 E R R Triangles in active list Vertex hierarchy

32 The Vertex Tree l At runtime, folds and unfolds create a cut or boundary across the vertex tree: This part of the model is represented at high detail This part in low detail

33 The Vertex Tree: Livetris and Subtris 3 1 2 9 87 10 54 6 9 8 54 6 A 3 Fold Node A Unfold Node A Node->Subtris : triangles that disappear upon folding Node->Livetris : triangles that just change shape l Two categories of triangles affected:

34 The Vertex Tree: Livetris and Subtris l The key observation: –Each node’s subtris can be computed offline to be accessed quickly at run time –Each node’s livetris can be maintained at run time, or lazily evaluated upon rendering

35 View-Dependent Simplification l Any run-time criterion for folding and unfolding nodes may be used l Examples of view-dependent simplification criteria: –Screenspace error threshold –Silhouette preservation –Triangle budget simplification –Gaze-directed perceptual simplification

36 Screenspace Error Threshold l Nodes chosen by projected area –User sets screenspace size threshold –Nodes which grow larger than threshold are unfolded

37 Silhouette Preservation l Retain more detail near silhouettes –A silhouette node supports triangles on the visual contour –Use tighter screenspace thresholds when examining silhouette nodes

38 Triangle Budget Simplification l Minimize error within specified number of triangles –Sort nodes by screenspace error –Unfold node with greatest error, putting children into sorted list Repeat until budget is reached

39 View-Dependent Criteria: Other Possibilities l Specular highlights: Xia describes a fast test to unfold likely nodes l Surface deviation: Hoppe uses an elegant surface deviation metric that combines silhouette preservation and screenspace error threshold

40 View-Dependent Criteria: Other Possibilities l Sophisticated surface deviation metrics: See Jon’s talk! l Sophisticated perceptual criteria: See Martin’s talk! l Sophisticated temporal criteria: See Ben’s talk!

41 Implementing VDS: Optimizations l Asynchronous simplification –Parallelize the algorithm l Exploiting temporal coherence –Scene changes slowly over time l Maintain memory coherent geometry –Optimize for rendering –Support for out-of-core rendering

42 l Algorithm partitions into two tasks: l Run them in parallel Simplify Task Render Task Active Triangle List … Asynchronous Simplification Vertex Tree

43 Asynchronous Simplification l If S = time to simplify, R = time to render: –Single process = (S + R) –Pipelined = max(S, R) –Asynchronous = R l The goal: efficient utilization of GPU/CPU –e.g., NV_FENCE extension for asynchronous rendering

44 Temporal Coherence l Exploit the fact that frame-to-frame changes are small l Three examples: –Active triangle list –Vertex tree –Budget-based simplification

45 Exploiting Temporal Coherence l Active triangle list –Could calculate active triangles every frame –But…few triangles are added or deleted each frame –Idea: make only incremental changes to an active triangle list n Simple approach: doubly-linked list of triangles n Better: maintain coherent arrays with swapping

46 Unfolded Nodes Boundary Nodes Exploiting Temporal Coherence l Vertex Tree –Few nodes change per frame –Don’t traverse whole tree –Do local updates only at boundary nodes

47 Temporal Coherence: Triangle Budget Simplification l Exploiting temporal coherence in budget- based simplification –Introduced by ROAM [Duchaineau 97] –Start with tree from last frame, recalculate error for relevant nodes –Sort into two priority queues n One for potential unfolds, sorted on max error n One for potential folds, sorted on min error

48 Temporal Coherence: Triangle Budget Simplification l Then simplify: –While budget is met, unfold max node n This is the node whose folding has created the most error in the model –While budget is exceeded, fold min node n This is the node that introduces the least error when folded –Insert parents and children into queues Repeat until error max < error min

49 Optimizing For Rendering l Idea: maintain geometry in coherent arrays Active trianglesInactive triangles Unfolded nodesInactive nodesBoundary nodes

50 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCDEFGHIJKLMNOPQ Fold node D:

51 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCDEFGHIJKLMNOPQ Fold node D: Swap D with F

52 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCDEFGHIJKLMNOPQ Fold node D: Swap D with F

53 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCFEDGHIJKLMNOPQ Fold node D: Swap D with F

54 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCFEDGHIJKLMNOPQ Fold node D: Move Unfolded/Boundary Marker

55 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCFEDGHIJKLMNOPQ Fold node D: Deactivate D’s children (swap w/ last boundary node)

56 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCFEDGHLJKIMNOPQ Fold node D: Deactivate D’s children (swap w/ last boundary node)

57 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCFEDGHLJKIMNOPQ Fold node D: Deactivate D’s children (swap w/ last boundary node)

58 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCFEDGHLJKIMNOPQ Fold node D: Deactivate D’s children (swap w/ last boundary node)

59 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCFEDGKLJHIMNOPQ Fold node D: Deactivate D’s children (swap w/ last boundary node)

60 Optimizing For Rendering l Idea: use swaps to maintain coherence Unfolded nodesInactive nodesBoundary nodes ABCFEDGKLJHIMNOPQ Fold node D: Deactivate D’s children (swap w/ last boundary node)

61 Optimizing For Rendering: Vertex Arrays l Biggest win: vertex arrays –Actually, keep separate parallel arrays for rendering data (coords, colors, etc) Unfolded nodesInactive nodesBoundary nodes Vertex array!

62 Optimizing For Rendering: Vertex Arrays on GeForce2 Plain old triangles Triangles using vertex arrays Vertex arrays in fast memory

63 Out-of-core Rendering l Coherent arrays lend themselves to out- of-core simplification and rendering: … These need to be in memory…These do not

64 Out-of-core Rendering l Coherent arrays lend themselves to out- of-core simplification and rendering: –Only need active portions of triangle and node arrays –Implement arrays as memory-mapped files n Let virtual memory system manage paging n A prefetch thread walks boundary nodes, bringing their children into memory to avoid glitches

65 Summary: VDS Pros l Supports drastic simplification! –View-dependent; handles the Problem With Large Objects –Hierarchical; handles the Problem With Small Objects –Robust; does not require (or preserve) mesh topology

66 Summary: VDS Pros l Rendering can be implemented efficiently using vertex arrays l Supports rendering of models much larger than main memory

67 Summary: VDS Cons l Increases CPU, memory overhead l Hard to map efficiently onto GPU for efficient utilization

68 Summary: VDS Cons l Be aware of mesh foldovers: 10 54 6 1 3 7 2 8 9

69 54 6 1 3 2 9 A 7 Summary: VDS Cons l Be aware of mesh foldovers: 8

70 Summary: VDS Cons l Be aware of mesh foldovers: 10 54 6 3 2 8 9 A

71 Summary: VDS Cons l Be aware of mesh foldovers: –These can be very distracting artifacts –Can prevent them at run-time n Add a normal-flipping test to fold criterion n Use a clever numbering scheme proposed by El- Sana and Varshney

72 View-Dependent Versus Discrete LOD l View-dependent LOD is superior to traditional discrete LOD when: –Models contain very large individual objects (e.g., terrains) –Simplification must be completely automatic (e.g., complex CAD models) –Experimenting with view-dependent simplification criteria

73 View-Dependent Versus Discrete LOD l Discrete LOD is often the better choice: –Simplest programming model –Reduced run-time CPU load –Easier to leverage hardware: n Compile LODs into vertex arrays/display lists n Stripe LODs into triangle strips n Optimize vertex cache utilization and such

74 View-Dependent Versus Discrete LOD l Applications that may want to use: –Discrete LOD n Video games (but much more on this later…) n Simulators n Many walkthrough-style demos –Dynamic and view-dependent LOD n CAD design review tools n Medical & scientific visualization toolkits n Terrain flyovers (much more later…)

75 Continuous LOD: The Sweet Spot? l Continuous LOD may be the right compromise on modern PC hardware –Benefits of fine granularity without the cost of view-dependent evaluation –Can be implemented efficiently with regard to n Memory n CPU n GPU

76 l Implementation: VDSlib –A public-domain view-dependent simplification and rendering package –Flexible C++ interface lets users: n Construct vertex trees for objects or scenes n Specify with callbacks how to simplify, cull, and render them –Available at http://vdslib.virginia.edu VDSlib

77 VDSlib: Ongoing Work l Ongoing research projects using view- dependent simplification: –Out-of-core LOD for interactive rendering of truly massive models –Perceptually-guided view-dependent LOD, including gaze-directed techniques –Non-photorealistic rendering using VDSlib as a framework


Download ppt "Level of Detail: Generating LODs David Luebke University of Virginia."

Similar presentations


Ads by Google