“level of detail management for 3d games” martin reddy pixar animation studios terrain level of...
TRANSCRIPT
““Level of Detail Management Level of Detail Management for 3D Games”for 3D Games”
Martin ReddyPixar Animation Studios
Terrain Level Of DetailTerrain Level Of Detail
ContentsContents
BackgroundBackground– History, applications, data sizesHistory, applications, data sizes
Important ConceptsImportant Concepts– regular grids v TINs, quadtrees v bintrees, regular grids v TINs, quadtrees v bintrees,
out-of-core paging, web streamingout-of-core paging, web streaming ImplementationsImplementations
– Lindstrom 96, Duchaineau 97, RLindstrom 96, Duchaineau 97, Rööttger 98, ttger 98, Hoppe 98, DeFloriani 00, Lindstrom 01 Hoppe 98, DeFloriani 00, Lindstrom 01
Available softwareAvailable software
Gameplay Goals for TerrainGameplay Goals for Terrain
Large enough to travel around for hoursLarge enough to travel around for hours Detailed when seen at human scaleDetailed when seen at human scale Dynamic modification of terrain dataDynamic modification of terrain data Runs at high, stable frame ratesRuns at high, stable frame rates Need fast rotation of viewpointNeed fast rotation of viewpoint
From Jonathan Blow’s SIGGRAPH 2000 Course:
BackgroundBackground
One of the first real uses of LODOne of the first real uses of LOD Important for applications such asImportant for applications such as
– Flight simulatorsFlight simulators– Terrain-based computer gamesTerrain-based computer games– Geographic Information Systems (GIS)Geographic Information Systems (GIS)– Virtual tourism, real-estate, mission planningVirtual tourism, real-estate, mission planning
Sustained R&D since the 1970sSustained R&D since the 1970s Other terms includeOther terms include
– generalizationgeneralization (GIS) (GIS)
Terrain LOD ExampleTerrain LOD Example
Screenshot of Screenshot of the Grand the Grand Canyon with Canyon with debug view debug view using the using the Digital Dawn Digital Dawn Toolkit, now Toolkit, now incorporated incorporated into Crystal into Crystal SpaceSpace
Terrain LOD vs Generic LODTerrain LOD vs Generic LOD
Terrain is easier...Terrain is easier...– Geometry is more constrainedGeometry is more constrained– Normally uniform grids of height valuesNormally uniform grids of height values– More specialized and simpler algorithmsMore specialized and simpler algorithms
Terrain is more difficult...Terrain is more difficult...– Continuous and very large modelsContinuous and very large models– Simultaneously very close and far awaySimultaneously very close and far away– Necessitates view-dependent LODNecessitates view-dependent LOD– Often requires paging from disk (out-of-core) Often requires paging from disk (out-of-core)
Large Terrain DatabasesLarge Terrain Databases
USGS GTOPO30USGS GTOPO30– 30 arc-second (~1 km) resolution elevation30 arc-second (~1 km) resolution elevation– 43,200 x 21,600 = 1.8 billion triangles43,200 x 21,600 = 1.8 billion triangles
NASA EOS satellite ASTERNASA EOS satellite ASTER– 30-m resolution elevation data30-m resolution elevation data– from 15-m near infrared stereo imageryfrom 15-m near infrared stereo imagery
USGS National Elevation Dataset (NED)USGS National Elevation Dataset (NED)– 50,000 quads at around 50 GB50,000 quads at around 50 GB
Regular GridsRegular Grids
Uniform array of height valuesUniform array of height values Simple to store and manipulateSimple to store and manipulate Encode in raster formats (DEM, GeoTIFF)Encode in raster formats (DEM, GeoTIFF) Easy to interpolate to find elevationsEasy to interpolate to find elevations Less disk/memory (only store z value)Less disk/memory (only store z value) Easy view culling and collision detectionEasy view culling and collision detection Used by most implementers Used by most implementers
TINsTINs
Triangulated Irregular NetworksTriangulated Irregular Networks Fewer polygons needed to attain required Fewer polygons needed to attain required
accuracyaccuracy Higher sampling in bumpy regions and Higher sampling in bumpy regions and
coarser in flat onescoarser in flat ones Can model maxima, minima, ridges, Can model maxima, minima, ridges,
valleys, overhangs, cavesvalleys, overhangs, caves Used by Hoppe 98 & DeFloriani 00Used by Hoppe 98 & DeFloriani 00
LOD Hierarchy StructuresLOD Hierarchy Structures
QuadTree Hierarchy
BinTree Hierarchy
QuadtreesQuadtrees
Each quad is actually two trianglesEach quad is actually two triangles Produces cracks and T-junctionsProduces cracks and T-junctions Easy to implementEasy to implement Good for out-of-core operationGood for out-of-core operation
BintreesBintrees
TerminologyTerminology– binary triangle tree (bintree, bintritree, BTT)binary triangle tree (bintree, bintritree, BTT)– right triangular irregular networks (RTIN)right triangular irregular networks (RTIN)– longest edge bisectionlongest edge bisection
Easier to avoid cracks and T-junctionsEasier to avoid cracks and T-junctions Neighbor is never more than 1 level awayNeighbor is never more than 1 level away Used by Lindstrom 96 & Duchaineau 97Used by Lindstrom 96 & Duchaineau 97
Cracks and T-JunctionsCracks and T-Junctions
Avoid cracks:Avoid cracks:– Force cracks into T-junctions / remove floating vertexForce cracks into T-junctions / remove floating vertex– Fill cracks with extra trianglesFill cracks with extra triangles
Avoid T-junctions:Avoid T-junctions:– Continue to simplify ...Continue to simplify ...
Avoiding T-junctionsAvoiding T-junctions
Avoiding T-junctionsAvoiding T-junctions
Split(BinTri *tri) { if tri->BottomNeighbor is valid { if tri->BottomNeighbor->BottomNeighbor != tri { Split(tri->BottomNeighbor) } Split2(tri) Split2(tri->BottomNeighbor) tri->LeftChild->RightNeighbor = tri->BottomNeighbor->RightChild tri->RightChild->LeftNeighbor = tri->BottomNeighbor->LeftChild tri->BottomNeighbor->LeftChild->RightNeighbor = tri->RightChild tri->BottomNeighbor->RightChild->LeftNeighbor = tri->LeftChild } else { Split2(tri) tri->LeftChild->RightNeighbor = 0; tri->RightChild->LeftNeighbor = 0; }}
Split2(tri) { tri->LeftChild = AllocateBinTri(); tri->RightChild = AllocateBinTri(); tri->LeftChild->LeftNeighbor = tri->RightChild tri->RightChild->RightNeighbor = tri->LeftChild tri->LeftChild->BottomNeighbor = tri->LeftNeighbor if tri->LeftNeighbor is valid { if tri->LeftNeighbor->BottomNeighbor == tri { tri->LeftNeighbor->BottomNeighbor = tri->LeftChild } else { tri->LeftNeighbor->RightNeighbor = tri->LeftChild } } tri->RightChild->BottomNeighbor = tri->RightNeighbor if tri->RightNeighbor is valid { if tri->RightNeighbor->BottomNeighbor == tri { tri->RightNeighbor->BottomNeighbor = tri->RightChild } else { tri->RightNeighbor->LeftNeighbor = tri->RightChild } } tri->LeftChild->LeftChild = 0 tri->LeftChild->RightChild = 0 tri->RightChild->LeftChild = 0 tri->RightChild->RightChild = 0}
Pseudo code to do triangle splitting and avoid T-junctions
Code by S. McNally on GameDev.net, optimized by A. Ögren
Out-of-core operationOut-of-core operation
Virtual memory solutionsVirtual memory solutions– mmap() used by Lindstrom 01mmap() used by Lindstrom 01– VirtualAlloc() / VirtualFree() used by Hoppe 98VirtualAlloc() / VirtualFree() used by Hoppe 98
Explicit paging from diskExplicit paging from disk– NPSNET (NPS): Falby 93NPSNET (NPS): Falby 93– VGIS (GVU): Davis 99VGIS (GVU): Davis 99– OpenGL Performer Active Surface Def (ASD)OpenGL Performer Active Surface Def (ASD)– SGI InfiniteReality (IR) ClipmappingSGI InfiniteReality (IR) Clipmapping
Streaming over the WebStreaming over the Web
TerraVision (SRI) – Leclerc 94, Reddy 99TerraVision (SRI) – Leclerc 94, Reddy 99
TerraVision MovieTerraVision Movie
Texture issuesTexture issues
Need to handle paging of imagery as well Need to handle paging of imagery as well as geometry (satellite imagery resolution as geometry (satellite imagery resolution is generally > than elevation resolution)is generally > than elevation resolution)
Hardware support for paging (clipmaps)Hardware support for paging (clipmaps) Detail textures for close-to-ground detailDetail textures for close-to-ground detail Texture compression useful?Texture compression useful?
Lindstrom et al. 1996Lindstrom et al. 1996
One of first real-time view-dependent algorithms, One of first real-time view-dependent algorithms, referred to as continuous LOD (CLOD)referred to as continuous LOD (CLOD)
Regular grid, bintree, quadtree blocksRegular grid, bintree, quadtree blocks– Mesh broken into rectangular blocks with a top-down Mesh broken into rectangular blocks with a top-down
coarse-grained simplificationcoarse-grained simplification– Then per-vertex simplification performed within each Then per-vertex simplification performed within each
blockblock
Frame-to-frame coherence:Frame-to-frame coherence:– Maintain an active cut of blocksMaintain an active cut of blocks– Only visit vertices if could change in frameOnly visit vertices if could change in frame
Lindstrom et al. 1996Lindstrom et al. 1996
Vertex removal schemeVertex removal scheme Merge based upon a Merge based upon a
measure of screen-measure of screen-space error between space error between the two surfaces, the two surfaces,
Used a nonlinear Used a nonlinear mapping of mapping of to to represent 0..65535 in represent 0..65535 in only 8 bitsonly 8 bits
Lindstrom et al. 1996Lindstrom et al. 1996
Hunter-Liggett US Army base
2-m res
8 x 8km
32 M polys
Lindstrom et al. 1996Lindstrom et al. 1996
Duchaineau et al. 1997Duchaineau et al. 1997
Real-time Optimally Adapting Meshes Real-time Optimally Adapting Meshes (ROAM)(ROAM)
Regular grid, bintree, 2 priority queues:Regular grid, bintree, 2 priority queues:– 1 priority-ordered list of triangle splits1 priority-ordered list of triangle splits– 1 priority-ordered list of triangle merges1 priority-ordered list of triangle merges
Frame coherenceFrame coherence– pick up from previous frame’s queue statepick up from previous frame’s queue state
Very popular with source code and Very popular with source code and implementation notes availableimplementation notes available
Duchaineau et al. 1997Duchaineau et al. 1997
““Split-Only” ROAM often used in gamesSplit-Only” ROAM often used in games– Used by Seumas McNally in TreadMarksUsed by Seumas McNally in TreadMarks
Removes the frame coherence portionRemoves the frame coherence portion– Don’t need 2 priority-sorted queuesDon’t need 2 priority-sorted queues
Implementation available as SMTerrain in Implementation available as SMTerrain in the vterrain.org VTP softwarethe vterrain.org VTP software
Good article on Split-Only ROAM at Good article on Split-Only ROAM at Gamasutra by Bryan TurnerGamasutra by Bryan Turner
Duchaineau et al. 1997Duchaineau et al. 1997
ROAM Split and Merge “Diamonds”
Duchaineau et al. 1997Duchaineau et al. 1997
Principal metric was Principal metric was screen-based screen-based geometric error with geometric error with guaranteed bound on guaranteed bound on the errorthe error
Hierarchy of volumes Hierarchy of volumes called called wedgieswedgies
Covers the Covers the (x,y)(x,y) extent extent of a triangle and of a triangle and extends over the extends over the height range height range z-ez-eTT through through z+ez+eTT
Duchaineau et al. 1997Duchaineau et al. 1997
RRöttger et al. 1998öttger et al. 1998
Extended Lindstrom’s CLOD workExtended Lindstrom’s CLOD work Regular grid, quadtree, top-downRegular grid, quadtree, top-down World space metric considered:World space metric considered:
– viewer distance & terrain roughnessviewer distance & terrain roughness Integrated vertex geomorphingIntegrated vertex geomorphing Deal with tears by skipping center vertex Deal with tears by skipping center vertex
of higher resolution adjacent edgeof higher resolution adjacent edge
RRöttger et al. 1998öttger et al. 1998
Hawai’i
Hoppe 1998Hoppe 1998
View-Dependent Progressive Meshes View-Dependent Progressive Meshes (VDPM) from Hoppe 97 applied to terrain(VDPM) from Hoppe 97 applied to terrain
TIN-based, out-of-core (VirtualAlloc/Free)TIN-based, out-of-core (VirtualAlloc/Free) Integrated vertex geomorphingIntegrated vertex geomorphing Tears between blocks avoided by not Tears between blocks avoided by not
simplifying at block boundariessimplifying at block boundaries Notes that larger errors can occur Notes that larger errors can occur
between grid points and precomputes between grid points and precomputes maximum height deviationsmaximum height deviations
Hoppe 1998Hoppe 1998
Grand Canyon, Arizona
4,097 x 2,049
8 x 4 blocks of 513 x 513
Hoppe VideoHoppe Video
QuickTime™ and a YUV420 codec decompressor are needed to see this picture.
DeFloriani et al. 2000DeFloriani et al. 2000
VARIANT. Uses Multi-Triangulation (MT)VARIANT. Uses Multi-Triangulation (MT) General TIN approach applied to terrainGeneral TIN approach applied to terrain Plug in different simp. & error routinesPlug in different simp. & error routines Supports analyses: visibility, elevation Supports analyses: visibility, elevation
along a path, contour extraction, viewshedalong a path, contour extraction, viewshed Frame coherence (use previous state)Frame coherence (use previous state) Freely available C++ library for MTFreely available C++ library for MT
DeFloriani et al. 2000DeFloriani et al. 2000
Lindstrom & Pascucci 2001Lindstrom & Pascucci 2001
Visualization of Large Terrains Made EasyVisualization of Large Terrains Made Easy Regular gridded, top-down, bintreeRegular gridded, top-down, bintree Out-of-core with mmap() and spatial org.Out-of-core with mmap() and spatial org. Fast hierarchical culling, triangle stripping, Fast hierarchical culling, triangle stripping,
and optional multithreading of refinement and optional multithreading of refinement and rendering tasksand rendering tasks
Uses a nesting of error metric terms Uses a nesting of error metric terms (bounding spheres) (bounding spheres)
Lindstrom & Pascucci 2001Lindstrom & Pascucci 2001
Puget Sound, Washington
16,385 x 16,385
512 MB
Lindstrom & Pascucci VideoLindstrom & Pascucci Video
Available SoftwareAvailable Software
Virtual Terrain Project (VTP)Virtual Terrain Project (VTP)– http://www.vterrain.org/http://www.vterrain.org/
TerraVisionTerraVision– http://terravision.sourceforge.net/http://terravision.sourceforge.net/
SOARSOAR– http://www.cc.gatech.edu/~lindstro/software/soar/http://www.cc.gatech.edu/~lindstro/software/soar/
ROAMROAM– http://www.cognigraph.com/ROAM_homepage/http://www.cognigraph.com/ROAM_homepage/
Source code links (ROAM, VTP, MT, etc.)Source code links (ROAM, VTP, MT, etc.)– http://www.LODBook.com/source/http://www.LODBook.com/source/
Terrain Data ResourcesTerrain Data Resources
Large Terrain DatabasesLarge Terrain Databases– http://www.cc.gatech.edu/projects/large_models/http://www.cc.gatech.edu/projects/large_models/
Terrain Models on LODBook.comTerrain Models on LODBook.com– http://www.LODBook.com/terrain/http://www.LODBook.com/terrain/
GeoVRML Data Resources PageGeoVRML Data Resources Page– http://www.geovrml.org/data/http://www.geovrml.org/data/
End of Presentation
End of Presentation