# Terrain Level of Detail

## Presentation on theme: "Terrain Level of Detail"— Presentation transcript:

Terrain Level of Detail
John Tran Computer Science Department University of Virginia

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)

The Data Regular Grid Height Field Tradeoffs?

Easier Constrained geometry (generally) More specialized and simpler algorithms Harder Continuous and large models Simultaneously very close and far away Necessitates view-dependent LOD Out-of-core From Martin Reddy’s 2002 SIGGRAPH course

A Discrete LOD approach
View-Independent, camera location-dependent Still involves subdividing terrain Render closer subdivisions at higher resolution Popping Will get cracks and T-junctions

Terrain LOD Basics Cracks, T-junctions How do we solve this?

Terrain LOD Basics 2 Can’t use edge/vertex collapse techniques from last lecture – Why not? What can you do? Ensure common vertices on edge of subdivision Looks awkward Draw a triangle to fill that spot Force a crack into a T-junction There must be an easier way… Subdivide the terrain such that this is easier or done for free

Terrain LOD Basics 3 Quadtrees and BinTrees

Still have cracks and T-junctions Easy to implement

BinTrees (Binary Triangle Trees)
Cracks and T-junctions are solved! Any two triangles differ by no more than one resolution level A little harder to implement Forced Splitting

Several Algorithms Lindstrom’s Continuous LOD ROAM (Duchaineau)
3D Bounding Isosurfaces (Blow) Caching geometry (Vis2002) Visualization of Large Terrains Made Easy SOAR

Continuous LOD for Height Fields
Peter Lindstrom et al., 1996 Used a binary vertex tree Frame-to-frame coherence Introduced user-controllable screen space error threshold

ROAM Mark Duchaineau, 1997 (LLNL) Binary Triangle Tree Structure
Real-Time Optimally Adapting Meshes Mark Duchaineau, 1997 (LLNL) Binary Triangle Tree Structure No need to worry about cracks, etc Can specify the desired number of triangles Probably the most popular algorithm today

ROAM – Main Concepts Split and Merge Two priority queues
One for splits and one for merge Allows for frame-to-frame coherence Error Metrics for Splits and Merges Geomorphing – introduced, but rarely needed Incremental triangle stripping introduced

ROAM – Splitting and Merging diamonds

ROAM – Priority Queues One priority queue for splits, one for merges, and use a greedy algorithm to triangulate Priority = error metric Nested world space bounds Geometric screen distortion Line of site How do we calculate these error metrics?

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

ROAM – Splitting Algorithm
Let T = the base triangulation For all t in T, insert t into Q While T is too small or inaccurate Identify highest priority t in Q Force-split t Update split queue as follows: Remove t and other split triangles from Q Add any new triangles to Q Adapted from Duchaineau’s original ROAMing Terrain paper (96)

ROAM – Merging AND Splitting
Splitting is straightforward, but so is merging Make two priority queues, Qs and Qm Add another check: if T is too large or too accurate identify lowest priority elements T and TB in Qm Merge (T, TB) Update queues: Remove all merged children from Qs Add merge parents T, TB to Qs Remove T, TB from Qm Add all newly-mergeable diamonds to Qm

ROAM – Notes Also need to check if the previous frame is finished rendering and update priorities for all elements if not For more details on algorithm, read the ROAMing Terrain paper

ROAM – Demo Bryan Turner, gamasutra.com “Split-Only ROAM”
No frame to frame coherence, but still performs very well Seamus McNally, SMTerrain uses this same approach

Bounding ROAM with 3D Isosurfaces
Jonathon Blow (2000) ROAM doesn’t work well for densely sampled data – large number of unnecessary wedgie calculations Screen-space error metrics compress 3D geometric data into a 1D scalar value Instead, use all 3 dimensions, and have bounding volumes (spheres) determine visibility 65% less triangles than ROAM

Caching Geometry Josh Levenberg, Vis2002
“Fast View-Dependent Level-of-Detail Rendering Using Cached Geometry” Not yet published Uses ROAM, but also caches geometry of “aggregate triangles” on the video card (VAR) Claim 4x faster with caching

Visualization of Large Terrains Made Easy
P. Lindstrom and V. Pascucci (Vis2001) Few dozen lines of C-code Uses regular grid bintree Now implemented as SOAR (Stateless, One-pass adaptive Refinement)

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 call Let the OS take care of paging

Visualization of Large Terrains Made Easy (3)
“Longest edge bisection” Monotonic! Implicit parent-child relationships – no need for priority queues Represent this mesh using a DAG of the vertices They used a nested sphere hierarchy for object space and screen space testing (similar to Blow)

Visualization of Large Terrains Made Easy (4)
Separate threads for rendering and geometry updates Mesh refinement, view frustum culling, and FULL triangle stripping All done in one pass over the mesh No Frame-to-frame coherence needed!

Visualization of Large Terrains Made Easy
τ = 2 pixels 79,382 triangles τ = 4 pixels 25,100 triangles τ = screen space error threshold

Implementing a terrain in your Scene Graph
Anyone have tips? Most games use a modified ROAM algorithm Although a static approach may be easy, it will be inaccurate and it will show Keep the terrain fairly small if possible i.e. Don’t have a 10k x 10k grid if you only want to show a single mountain

Implementing a terrain in your Scene Graph
Where to go for more info? LODbook.com Virtual Terrain Project ( Duchaineau’s ROAM homepage ( SOAR ( There are other basic algorithms ie TIN-based algorithms

More Problems with Terrain LOD
QuadTIN (VIS2002) Large Textures Paging/Streaming and Out-of-core Techniques

Summary Any questions?