World-Scale Terrain Rendering

42
World-Scale Terrain Rendering (Slides: cesium.agi.com / massiveworlds ) Kevin Ring Analytical Graphics, Inc.

description

World-Scale Terrain Rendering. (Slides: cesium.agi.com / massiveworlds ). Kevin Ring Analytical Graphics, Inc. Terrain in Cesium. Terrain in Cesium. Terrain in Cesium. Terrain in Cesium. Terrain in Cesium. Terrain in Cesium. Terrain in Cesium. Real-world d ata. - PowerPoint PPT Presentation

Transcript of World-Scale Terrain Rendering

Page 1: World-Scale Terrain Rendering

World-Scale Terrain Rendering(Slides: cesium.agi.com/massiveworlds)

Kevin RingAnalytical Graphics, Inc.

Page 2: World-Scale Terrain Rendering

Terrain in Cesium

Page 3: World-Scale Terrain Rendering

Terrain in Cesium

Page 4: World-Scale Terrain Rendering

Terrain in Cesium

Page 5: World-Scale Terrain Rendering

Terrain in Cesium

Page 6: World-Scale Terrain Rendering

Terrain in Cesium

Page 7: World-Scale Terrain Rendering

Terrain in Cesium

Page 8: World-Scale Terrain Rendering

Terrain in Cesium

Page 9: World-Scale Terrain Rendering

Real-world data

• Terrain and imagery collected by satellites and aerial instruments– Shuttle Radar Topography Mission (SRTM)– National Elevation Dataset (NED)– Landsat satellites– Digital Globe, SPOT, etc.

• Terrain usually provided as a heightmap

Page 10: World-Scale Terrain Rendering

Unfortunately…

• The best data is hidden:– Within private networks– Within classified networks– Behind pay walls– By strict terms of use restrictions

• Data is huge – up to hundreds of terabytes• We can’t access it ahead of time to transform it

to a different form.

Page 11: World-Scale Terrain Rendering

Terrain and imagery sources

• Web Map Service (WMS)• Web Map Tile Service (WMTS)• Tile Map Service (TMS)• ArcGIS Map and Image servers• OpenStreetMap• Bing Maps• Google Maps

Page 12: World-Scale Terrain Rendering

Layers are different

• Different:– Map projections– Extents– Tiling schemes

• May need on-the-fly adjustments:– Hue– Saturation– Gamma

Page 13: World-Scale Terrain Rendering

Agenda

• Overview of LOD algorithm – Chunked LOD• Mapping imagery to terrain• Map reprojection on the GPU• Horizon culling

Page 14: World-Scale Terrain Rendering

Agenda

• Overview of LOD algorithm – Chunked LOD• Mapping imagery to terrain• Map reprojection on the GPU• Horizon culling

Page 15: World-Scale Terrain Rendering

Chunked LOD

http://tulrich.com/geekstuff/chunklod.html

[Ulrich02]

Page 16: World-Scale Terrain Rendering

Tiles

Page 17: World-Scale Terrain Rendering

Screen-space error (SSE)

ε = geometric error of tile or level, in metersx = width of the screen, in pixelsd = distance to tile, in metersθ = camera field of view, in radians

Page 18: World-Scale Terrain Rendering

Geometric Error, ε

Geometric error is constant per level in the quadtree

[Klein96]

Page 19: World-Scale Terrain Rendering

Distance to tile, d

• Accurate approach: distance to closest triangle• Simple approach: distance to bounding sphere• Balanced approach: distance to

– Maximum height surface– East and West boundary planes– North and South approximate boundary planes

Page 20: World-Scale Terrain Rendering

Imagery TileImagery TileTerrain Tile

Load Pipeline

Request Upsample

Transform

Create Resources

Transform

Create Resources

Associate Imagery

Request

Create Texture

Reproject

Page 21: World-Scale Terrain Rendering

Agenda

• Overview of LOD algorithm – Chunked LOD• Mapping imagery to terrain• Map reprojection on the GPU• Horizon culling

Page 22: World-Scale Terrain Rendering

Mapping imagery to terrain

Page 23: World-Scale Terrain Rendering

Fragment Shader

Page 24: World-Scale Terrain Rendering

Texture Scale

scaleX = terrainWidth / imageryWidthscaleY = terrainHeight / imageryHeight

imageryWidth

terrainWidth

imageryHeight

terrainHeight

Page 25: World-Scale Terrain Rendering

Texture Translation

translationX = scaleX * offsetX / terrainWidthtranslationY = scaleY * offsetY / terrainHeight

offsetX

offsetY

Page 26: World-Scale Terrain Rendering

Texture Extent

extentMinX = offsetX / terrainWidthextentMinY = offsetY / terrainHeightextentMaxX = (offsetX + imageryWidth) /

terrainWidthextentMaxY = (offsetY + imageryHeight) /

terrainHeight

offsetX

offsetY

Page 27: World-Scale Terrain Rendering

Fragment Shader

Page 28: World-Scale Terrain Rendering

Agenda

• Overview of LOD algorithm – Chunked LOD• Mapping imagery to terrain• Map reprojection on the GPU• Horizon culling

Page 29: World-Scale Terrain Rendering

Map Reprojection

Web Mercator (EPSG:3857)Geographic / Plate Carrée (EPSG:4326)

Page 30: World-Scale Terrain Rendering

Web Mercator ReprojectionmercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude))mercatorOffset = mercatorY – southMercatorYmercatorT = mercatorOffset * oneOverMercatorHeight

Page 31: World-Scale Terrain Rendering

GPU Reprojection Gotchas

Problem: Limited floating-point precision

Solution: Texel spacing cutoff

Page 32: World-Scale Terrain Rendering

Texel Spacing Cutoff0 2 4 6 8 10 12 14 16 18 20

0.000001

0.00001

0.0001

0.001

0.01

0.1

1

Level of Detail

Max

. Err

or (t

extu

re-1

)

1 texel

1/10 texel

Page 33: World-Scale Terrain Rendering

GPU Reprojection Gotchas

Problem: Many mobile GPUs have limited fragment shader precision.

Solution: Reproject in the vertex shader instead of the fragment shader.

Page 34: World-Scale Terrain Rendering

Agenda

• Overview of LOD algorithm – Chunked LOD• Mapping imagery to terrain• Map reprojection on the GPU• Horizon culling

Page 35: World-Scale Terrain Rendering

Horizon Culling

Page 36: World-Scale Terrain Rendering

Ellipsoid-scaled space

Ellipsoid

x, y, z is any position on the surface of the ellipsoida, b, c are ellipsoid semi-axis lengths

Ellipsoid-scaled space:• Is centered on the ellipsoid• Axes are aligned with ellipsoid axes• Ellipsoid is a unit sphere.

WGS84 Length (meters)

a 6,378,137.0

b 6,378,137.0

c 6,356,752.314245

Scale to ellipsoid-scaled space:

[Cozzi10]

Page 37: World-Scale Terrain Rendering

Horizon occlusion point

[Ring13b]

Page 38: World-Scale Terrain Rendering

Horizon occlusion point

[Ring13b]

Page 39: World-Scale Terrain Rendering

Testing the occlusion point

Plane Test:

Cone Test:

[Ring13a]

Page 40: World-Scale Terrain Rendering

Acknowledgements

• Frank Stoner• Scott Hunter

Page 41: World-Scale Terrain Rendering

Final Thoughts

Open source implementation of everything I presented:http://cesium.agi.com

Find more information in the course notes:http://cesium.agi.com/massiveworlds

Thanks for listening!

Page 42: World-Scale Terrain Rendering

References• [Cozzi10] Patrick Cozzi and Frank Stoner. 2010.

GPU ray casting of virtual globes . In ACM SIGGRAPH 2010 Posters (SIGGRAPH '10). ACM, New York, NY, USA, , Article 128 , 1 pages.

• [Klein96] Reinhard Klein, Gunther Liebich, and Wolfgang Straßer. 1996. Mesh reduction with error control . In Proceedings of the 7th conference on Visualization '96 (VIS '96), Roni Yagel and Gregory M. Nielson (Eds.). IEEE Computer Society Press, Los Alamitos, CA, USA, 311-318.

• [Ring13a] Kevin Ring, Frank Stoner. Horizon culling. 2013.• [Ring13b] Kevin Ring, Frank Stoner. Computing the horizon occlusion point .

2013.• [Ulrich02] Thatcher, Ulrich.

Rendering Massive Terrains Using Chunked Level of Detail Control . In SIGGRAPH 2002 Super-Size It! Scaling Up to Massive Worlds Course Notes. New York: ACM Press, 2002.