Presentation on theme: "Terrain Level of Detail"— Presentation transcript:
1 Terrain Level of Detail John TranComputer Science DepartmentUniversity of Virginia
2 Why Terrain LOD?“It seems you can’t shake a stick in the world of terrain visualization without hitting a reference to LOD Terrain Algorithms” –Bryan Turner (gamasutra.com)
3 The Data Regular Grid Height Field Tradeoffs? Triangulated Irregular Networks (TIN)Tradeoffs?
4 Terrain LOD vs Traditional LOD EasierConstrained geometry (generally)More specialized and simpler algorithmsHarderContinuous and large modelsSimultaneously very close and far awayNecessitates view-dependent LODOut-of-coreFrom Martin Reddy’s 2002 SIGGRAPH course
5 A Discrete LOD approach View-Independent, camera location-dependentStill involves subdividing terrainRender closer subdivisions at higher resolutionPoppingWill get cracks and T-junctions
6 Terrain LOD BasicsCracks, T-junctionsHow do we solve this?
7 Terrain LOD Basics 2Can’t use edge/vertex collapse techniques from last lecture – Why not?What can you do?Ensure common vertices on edge of subdivisionLooks awkwardDraw a triangle to fill that spotForce a crack into a T-junctionThere must be an easier way…Subdivide the terrain such that this is easier or done for free
9 Quadtrees Each quad is actually two triangles Still have cracks and T-junctionsEasy to implement
10 BinTrees (Binary Triangle Trees) Cracks and T-junctions are solved!Any two triangles differ by no more than one resolution levelA little harder to implementForced Splitting
11 Several Algorithms Lindstrom’s Continuous LOD ROAM (Duchaineau) 3D Bounding Isosurfaces (Blow)Caching geometry (Vis2002)Visualization of Large Terrains Made EasySOAR
12 Continuous LOD for Height Fields Peter Lindstrom et al., 1996Used a binary vertex treeFrame-to-frame coherenceIntroduced user-controllable screen space error threshold
13 ROAM Mark Duchaineau, 1997 (LLNL) Binary Triangle Tree Structure Real-Time Optimally Adapting MeshesMark Duchaineau, 1997 (LLNL)Binary Triangle Tree StructureNo need to worry about cracks, etcCan specify the desired number of trianglesProbably the most popular algorithm today
14 ROAM – Main Concepts Split and Merge Two priority queues One for splits and one for mergeAllows for frame-to-frame coherenceError Metrics for Splits and MergesGeomorphing – introduced, but rarely neededIncremental triangle stripping introduced
16 ROAM – Priority QueuesOne priority queue for splits, one for merges, and use a greedy algorithm to triangulatePriority = error metricNested world space boundsGeometric screen distortionLine of siteHow do we calculate these error metrics?
17 ROAM – Wedgies! Wedgie – basically a bounding volume Covers the (x,y) extent of a triangle and extends over the height range z-eT through z+eT
18 ROAM – Splitting Algorithm Let T = the base triangulationFor all t in T, insert t into QWhile T is too small or inaccurateIdentify highest priority t in QForce-split tUpdate split queue as follows:Remove t and other split triangles from QAdd any new triangles to QAdapted from Duchaineau’s original ROAMing Terrain paper (96)
19 ROAM – Merging AND Splitting Splitting is straightforward, but so is mergingMake two priority queues, Qs and QmAdd another check:if T is too large or too accurateidentify lowest priority elements T and TB in QmMerge (T, TB)Update queues:Remove all merged children from QsAdd merge parents T, TB to QsRemove T, TB from QmAdd all newly-mergeable diamonds to Qm
20 ROAM – NotesAlso need to check if the previous frame is finished rendering and update priorities for all elements if notFor more details on algorithm, read the ROAMing Terrain paper
21 ROAM – Demo Bryan Turner, gamasutra.com “Split-Only ROAM” No frame to frame coherence, but still performs very wellSeamus McNally, SMTerrain uses this same approach
22 Bounding ROAM with 3D Isosurfaces Jonathon Blow (2000)ROAM doesn’t work well for densely sampled data – large number of unnecessary wedgie calculationsScreen-space error metrics compress 3D geometric data into a 1D scalar valueInstead, use all 3 dimensions, and have bounding volumes (spheres) determine visibility65% less triangles than ROAM
23 Caching Geometry Josh Levenberg, Vis2002 “Fast View-Dependent Level-of-Detail Rendering Using Cached Geometry”Not yet publishedUses ROAM, but also caches geometry of “aggregate triangles” on the video card (VAR)Claim 4x faster with caching
24 Visualization of Large Terrains Made Easy P. Lindstrom and V. Pascucci (Vis2001)Few dozen lines of C-codeUses regular grid bintreeNow implemented as SOAR (Stateless, One-pass adaptive Refinement)
25 Visualization of Large Terrains Made Easy (2) Focus on “the manner in which the data is laid out to achieve good memory coherency”Using mmap system callLet the OS take care of paging
26 Visualization of Large Terrains Made Easy (3) “Longest edge bisection”Monotonic!Implicit parent-child relationships – no need for priority queuesRepresent this mesh using a DAG of the verticesThey used a nested sphere hierarchy for object space and screen space testing (similar to Blow)
27 Visualization of Large Terrains Made Easy (4) Separate threads for rendering and geometry updatesMesh refinement, view frustum culling, and FULL triangle strippingAll done in one pass over the meshNo Frame-to-frame coherence needed!
28 Visualization of Large Terrains Made Easy τ = 2 pixels79,382 trianglesτ = 4 pixels25,100 trianglesτ = screen space error threshold
29 Implementing a terrain in your Scene Graph Anyone have tips?Most games use a modified ROAM algorithmAlthough a static approach may be easy, it will be inaccurate and it will showKeep the terrain fairly small if possiblei.e. Don’t have a 10k x 10k grid if you only want to show a single mountain
30 Implementing a terrain in your Scene Graph Where to go for more info?LODbook.comVirtual Terrain Project (Duchaineau’s ROAM homepage (SOAR (There are other basic algorithmsie TIN-based algorithms
31 More Problems with Terrain LOD QuadTIN (VIS2002)Large TexturesPaging/Streaming and Out-of-core Techniques