terrain level of detail john tran computer science department university of virginia

32
Terrain Level of Terrain Level of Detail Detail John Tran John Tran Computer Science Computer Science Department Department University of Virginia University of Virginia <[email protected]> <[email protected]>

Upload: jacob-cobb

Post on 17-Dec-2015

218 views

Category:

Documents


1 download

TRANSCRIPT

Terrain Level of DetailTerrain Level of Detail

John TranJohn Tran

Computer Science Computer Science DepartmentDepartment

University of VirginiaUniversity of Virginia

<[email protected]><[email protected]>

2

Why Terrain LOD?Why Terrain LOD?

• ““It seems you can’t shake a It seems you can’t shake a stick in the world of terrain stick in the world of terrain visualization without hitting a visualization without hitting a reference to LOD Terrain reference to LOD Terrain Algorithms” Algorithms” –Bryan Turner –Bryan Turner (gamasutra.com)(gamasutra.com)

3

The DataThe Data

• Tradeoffs?Tradeoffs?

• Triangulated Irregular Triangulated Irregular Networks (TIN)Networks (TIN)

• Regular Grid Regular Grid Height FieldHeight Field

4

Terrain LOD vs Traditional Terrain LOD vs Traditional LODLOD

• EasierEasier– Constrained geometry (generally)Constrained geometry (generally)– More specialized and simpler algorithmsMore specialized and simpler algorithms

• HarderHarder– Continuous and large modelsContinuous and large models– Simultaneously very close and far awaySimultaneously very close and far away– Necessitates view-dependent LODNecessitates view-dependent LOD– Out-of-coreOut-of-core

From Martin Reddy’s 2002 SIGGRAPH course

5

A Discrete LOD A Discrete LOD approachapproach

• View-Independent, camera View-Independent, camera location-dependentlocation-dependent

• Still involves subdividing terrainStill involves subdividing terrain– Render closer subdivisions at Render closer subdivisions at

higher resolutionhigher resolution

• PoppingPopping• Will get cracks and T-junctionsWill get cracks and T-junctions

6

Terrain LOD BasicsTerrain LOD Basics

• Cracks, T-junctionsCracks, T-junctions

• How do we solve this?How do we solve this?

7

Terrain LOD Basics 2Terrain LOD Basics 2

• Can’t use edge/vertex collapse Can’t use edge/vertex collapse techniques from last lecture – Why techniques from last lecture – Why not?not?

• What What cancan you do? you do?– Ensure common vertices on edge of Ensure common vertices on edge of

subdivisionsubdivision• Looks awkwardLooks awkward

– Draw a triangle to fill that spotDraw a triangle to fill that spot– Force a crack into a T-junctionForce a crack into a T-junction

• There must be an easier way…There must be an easier way…– Subdivide the terrain such that this is Subdivide the terrain such that this is

easier or done for freeeasier or done for free

8

Terrain LOD Basics 3Terrain LOD Basics 3

• Quadtrees and BinTreesQuadtrees and BinTrees

9

QuadtreesQuadtrees

• Easy to Easy to implementimplement

• Each quad is Each quad is actually two actually two trianglestriangles

• Still have cracks Still have cracks and T-junctionsand T-junctions

10

BinTrees BinTrees (Binary Triangle Trees)(Binary Triangle Trees)

• A little harder to A little harder to implementimplement

• Forced SplittingForced Splitting

• Cracks and Cracks and T-junctions are T-junctions are solved!solved!

• Any two Any two triangles differ triangles differ by no more than by no more than one resolution one resolution levellevel

11

Several AlgorithmsSeveral Algorithms

• Lindstrom’s Continuous LODLindstrom’s Continuous LOD• ROAM ROAM (Duchaineau)(Duchaineau)

– 3D Bounding Isosurfaces (Blow)3D Bounding Isosurfaces (Blow)– Caching geometry (Vis2002)Caching geometry (Vis2002)

• Visualization of Large Terrains Visualization of Large Terrains Made EasyMade Easy– SOARSOAR

12

Continuous LOD for Continuous LOD for Height FieldsHeight Fields

• Peter Lindstrom et al., 1996Peter Lindstrom et al., 1996• Used a binary vertex treeUsed a binary vertex tree• Frame-to-frame coherence Frame-to-frame coherence

• Introduced user-Introduced user-controllable controllable screen space screen space error thresholderror threshold

13

ROAMROAM

• RReal-Time eal-Time OOptimally ptimally AAdapting dapting MMesheseshes

• Mark Duchaineau, 1997 (LLNL)Mark Duchaineau, 1997 (LLNL)• Binary Triangle Tree StructureBinary Triangle Tree Structure

– No need to worry about cracks, etcNo need to worry about cracks, etc

• Can specify the desired number Can specify the desired number of trianglesof triangles

• Probably the most popular Probably the most popular algorithm todayalgorithm today

14

ROAM – Main ROAM – Main ConceptsConcepts

• Split and MergeSplit and Merge• Two priority queuesTwo priority queues

– One for splits and one for mergeOne for splits and one for merge– Allows for frame-to-frame coherenceAllows for frame-to-frame coherence

• Error Metrics for Splits and MergesError Metrics for Splits and Merges• Geomorphing – introduced, but rarely Geomorphing – introduced, but rarely

neededneeded• Incremental triangle stripping Incremental triangle stripping

introducedintroduced

15

ROAM – Splitting and ROAM – Splitting and Merging diamondsMerging diamonds

16

ROAM – Priority ROAM – Priority QueuesQueues

• One priority queue for splits, one for One priority queue for splits, one for merges, and use a greedy algorithm merges, and use a greedy algorithm to triangulateto triangulate

• Priority = error metricPriority = error metric– Nested world space boundsNested world space bounds– Geometric screen distortionGeometric screen distortion– Line of siteLine of site

– How do we calculate these error metrics?How do we calculate these error metrics?

17

ROAM – Wedgies!ROAM – Wedgies!

• Wedgie – Wedgie – basically a basically a bounding bounding volumevolume– Covers the Covers the (x,y)(x,y)

extent of a extent of a triangle and triangle and extends over extends over the height the height range range z-ez-eTT through through z+ez+eTT

18

ROAM – Splitting ROAM – Splitting AlgorithmAlgorithm

Let T = the base triangulationLet T = the base triangulationFor all t in T, insert t into QFor all t in T, insert t into QWhile T is While T is too smalltoo small or or inaccurateinaccurateIdentify highest priority t in QIdentify highest priority t in QForce-split tForce-split tUpdate split queue as follows:Update split queue as follows:

Remove t and other split Remove t and other split triangles triangles from Qfrom Q

Add any new triangles to QAdd any new triangles to Q

Adapted from Duchaineau’s original ROAMing Terrain paper (96)

19

ROAM – Merging AND ROAM – Merging AND SplittingSplitting

• Splitting is straightforward, but so is mergingSplitting is straightforward, but so is merging• Make two priority queues, QMake two priority queues, Qss and Q and Qmm

• Add another check: Add another check: if T is if T is too largetoo large or or too accuratetoo accurate

identify lowest priority elements T and Tidentify lowest priority elements T and TBB in Qin Qmm

Merge (T, TMerge (T, TBB))Update queues:Update queues:

Remove all merged children from QRemove all merged children from Qss

Add merge parents T, TAdd merge parents T, TBB to Q to Qss

Remove T, TRemove T, TBB from Q from Qmm

Add all newly-mergeable diamonds to QAdd all newly-mergeable diamonds to Qmm

20

ROAM – NotesROAM – Notes

• Also need to check if the Also need to check if the previous frame is finished previous frame is finished rendering and update priorities rendering and update priorities for all elements if notfor all elements if not

• For more details on algorithm, For more details on algorithm, read the ROAMing Terrain paperread the ROAMing Terrain paper

21

ROAM – DemoROAM – Demo

• Bryan Turner, gamasutra.comBryan Turner, gamasutra.com• ““Split-Only ROAM”Split-Only ROAM”• No frame to frame coherence, No frame to frame coherence,

but still performs very wellbut still performs very well

• Seamus McNally, SMTerrain Seamus McNally, SMTerrain uses this same approachuses this same approach

22

Bounding ROAM with Bounding ROAM with 3D Isosurfaces3D Isosurfaces

• Jonathon Blow (2000)Jonathon Blow (2000)• ROAM doesn’t work well for densely ROAM doesn’t work well for densely

sampled data – large number of sampled data – large number of unnecessary wedgie calculationsunnecessary wedgie calculations

• Screen-space error metrics compress 3D Screen-space error metrics compress 3D geometric data into a 1D scalar valuegeometric data into a 1D scalar value

• Instead, use all 3 dimensions, and have Instead, use all 3 dimensions, and have bounding volumes (spheres) determine bounding volumes (spheres) determine visibilityvisibility

• 65% less triangles than ROAM65% less triangles than ROAM

23

Caching GeometryCaching Geometry

• Josh Levenberg, Vis2002Josh Levenberg, Vis2002– ““Fast View-Dependent Level-of-Fast View-Dependent Level-of-

Detail Rendering Using Cached Detail Rendering Using Cached Geometry”Geometry”

– Not yet publishedNot yet published• Uses ROAM, but also caches Uses ROAM, but also caches

geometry of “aggregate triangles” geometry of “aggregate triangles” on the video card (VAR)on the video card (VAR)

• Claim 4x faster with cachingClaim 4x faster with caching

24

Visualization of Large Visualization of Large Terrains Made EasyTerrains Made Easy

• P. Lindstrom and V. Pascucci P. Lindstrom and V. Pascucci (Vis2001)(Vis2001)

• Few dozen lines of C-codeFew dozen lines of C-code• Uses regular grid bintreeUses regular grid bintree

• Now implemented as SOAR Now implemented as SOAR (Stateless, One-pass adaptive (Stateless, One-pass adaptive Refinement)Refinement)

25

Visualization of Large Visualization of Large Terrains Made Easy (2)Terrains Made Easy (2)

• Focus on “the manner in which the Focus on “the manner in which the data is laid out to achieve good data is laid out to achieve good memory coherency”memory coherency”– Using Using mmapmmap system call system call– Let the OS take care of pagingLet the OS take care of paging

26

Visualization of Large Visualization of Large Terrains Made Easy (3)Terrains Made Easy (3)

• ““Longest edge bisection”Longest edge bisection”– Monotonic!Monotonic!– Implicit parent-child relationships – no need for priority Implicit parent-child relationships – no need for priority

queuesqueues

• Represent this mesh using a DAG of the verticesRepresent this mesh using a DAG of the vertices• They used a nested sphere hierarchy for object They used a nested sphere hierarchy for object

space and screen space testing (similar to Blow)space and screen space testing (similar to Blow)

27

Visualization of Large Visualization of Large Terrains Made Easy (4)Terrains Made Easy (4)

• Separate threads for rendering and Separate threads for rendering and geometry updatesgeometry updates

• Mesh refinement, view frustum Mesh refinement, view frustum culling, and FULL triangle strippingculling, and FULL triangle stripping

• All done in one pass over the meshAll done in one pass over the mesh– No Frame-to-frame coherence needed!No Frame-to-frame coherence needed!

28

Visualization of Large Visualization of Large Terrains Made EasyTerrains Made Easy

τ = 2 pixels

79,382 triangles

τ = 4 pixels

25,100 triangles

τ = screen space error threshold

29

Implementing a terrain Implementing a terrain in your Scene Graphin your Scene Graph

• Anyone have tips?Anyone have tips?• Most games use a modified ROAM Most games use a modified ROAM

algorithmalgorithm– Although a static approach may be easy, Although a static approach may be easy,

it will be inaccurate and it will showit will be inaccurate and it will show

• Keep the terrain fairly small if Keep the terrain fairly small if possiblepossible– i.e. Don’t have a 10k x 10k grid if you i.e. Don’t have a 10k x 10k grid if you

only want to show a single mountainonly want to show a single mountain

30

Implementing a terrain Implementing a terrain in your Scene Graphin your Scene Graph

• Where to go for more info?Where to go for more info?– LODbook.comLODbook.com– Virtual Terrain Project (Virtual Terrain Project (www.vterrain.orgwww.vterrain.org))– Duchaineau’s ROAM homepageDuchaineau’s ROAM homepage ( (

www.cognigraph.com/ROAM_homepage/www.cognigraph.com/ROAM_homepage/))

– SOAR SOAR ((www.cc.gatech.edu/~lindstro/software/soar/)www.cc.gatech.edu/~lindstro/software/soar/)

• There are other basic algorithmsThere are other basic algorithms– ie TIN-based algorithmsie TIN-based algorithms

31

More Problems with More Problems with Terrain LODTerrain LOD

• QuadTIN (VIS2002)QuadTIN (VIS2002)• Large TexturesLarge Textures• Paging/Streaming and Out-of-Paging/Streaming and Out-of-

core Techniquescore Techniques

32

SummarySummary

• Any questions?Any questions?