Terrain GeometryHeight map based8Km x 8Km terrain patch around the cameraGeometry resolution down to 12.5cmBrute force rendering → 8,589,934,592 tri.
Terrain GeometryIts all about finding the right LOD techniqueWe use “Geometry Clipmaps” “Geometry clipmaps: Terrain rendering using nested regular grids.” Siggraph 2004, F. Losasso, H. Hoppe “Terrain rendering using GPU base geometry clipmaps.” 2005, A. Asirvathan, H. Hoppe, GPU Gems 2
Geometry ClipmapsNested regular grids (2n-2)2 quads eachRoughly centered aroundthe cameraGrid meshes must beprogressively updated asthe camera moves
Geometry ClipmapsKUFII World Terrain n = 8, 254x254 quads, 129.032 triangles each clipmap 8 Geometry clipmaps – From 32m x 32m with 12.5cm resolution – To 4km x 4km with 16m resolution Total: 774.192 triangles
Frustum CullingSplit each clipmapinto 12 nearly squarepatches4 different indexbuffers 2n-2-1 x 2n-2-1, 2n-2-1 x 2n-2 2n-2 x 2n-2-1 2n-2 x 2n-2
Geometry ClipmapsGeomorphing needed to avoid gaps betweenconsecutive clipmaps.Geometry Clipmap update This is the tricky part... Store vertex elevations in a texture Incremental texture updates as the camera moves Please check the reference docs for details...
Texture SplattingWhat if we want to use 64different tiles?We need 63 blendchannels...16 passes with 4 texturetiles each?!
Texture SplattingWhat if we want our tilesto also support bumpmapping?Too many passes, toomany texture fetches.
Conventional solutionSplit the terrain into smaller sections that use areasonable number of tiles.
Conventional solutionTradeoff between number of sections andnumber of tiles in each sectionTerrain artists need to be careful to disguise theseams between adjacent sections
Conventional solutionTradeoff between number of sections andnumber of tiles in each sectionTerrain artists need to be careful to disguise theseams between adjacent sectionsAnd most important: Geometry Clipmaps treatterrain as it was continuous!!! No easy way to divide in sections using independent draw calls each.
Texture Splatting Revisited Splatting with up to 256 tiles!What if we consider each texel in the blendclipmap as a separate terrain section using upto 2 tiles? Reminder: One blend texel in KUFII → ~10x10cm.
Texture Splatting Revisited Splatting with up to 256 tiles!What if we consider each texel in the blendclipmap as a separate terrain section using upto 2 tiles? Reminder: One blend texel in KUFII → ~10x10cm.Assign an index to each tileStore 2 indices and one alpha value per texel ofthe blend clipmapPack all the tiles in a texture Atlas.
Splatting with 2 indexed color tiles... ID1 ID2 f x
Texture Splatting RevisitedA total 6 texture fetches required: Blend ClipMap: 1 Normal ClipMap: 2 Color Atlas: 2 Bump Atlas: 1
Blend Clipmap FormatThe tile with the highest weight goes in ID1 Bump map uses only ID1 Blend weight range is 0.5 to 1.0Two possible formats 5551 RGBA => 32 tiles and 64 blend steps 8888 RGBA => 256 tiles and 512 blend stepsIf weight == 0 then make ID2 = ID1 to optimizetexture bandwidth
Blend Map FilteringProblem: HW texture filtering makes no sense.We need to filter in the PS Fetch the Blend clipmap 4 times Fetch the Color Atlas 2 x 4 = 8 times Fetch the Bump Atlas 4 times Do bi-linear filtering by interpolating in the PS
Layer Map Filtering18 texture fetches needed!So how expensive is it?...
Layer Map Filtering18 texture fetches needed!So how expensive is it?...…not that much actually Blend Map fetches are always 4 neighboring texels Atlas fetches usually end up sampling the same tile (and UV coords) several times E.g. The 8 color fetches very rarely correspond to more than 2 or 3 actual different tiles.~ 25% perf. decrease compared to the non-filtered version.
PS Dynamic Flow ControlThere are big areas in the Blend Map whereID0 and ID1 dont change across several texels. Green areas in the previous slide.In those areas HW bi-linear filter works just fine.Use dynamic flow control to skip PS bi-linearfilter.Pre-compute the condition expression and storeit in the blend map alpha channel.
Texture Memory Requirements888RGBX Blend Clipmap: 24 MB 6 slices x 1024x1024 Covering 128m to 4096m Closest clipmap texel size = 12.5cmDXT5 Normal Clipmap: 8MB 8 slices x 1024x1024 Covering 32m to 4096m Closest clipmap texel size = 3.125cmTotal: 32MB
Low Quality Settings Texture Memory Requirements888RGBX Blend Clipmap: 7 MB 7 slices x 512x512 Covering 64m to 4096m Closest clipmap texel size = 12.5cmDXT5 Normal Clipmap: 2.25MB 9 slices x 512x512 Covering 16m to 4096m Closest clipmap texel size = 3.125cmTotal: 9.25MB
Storage, Streaming & SynthesisTerrain divided into rectangular sectionsFor each section LOD chains of the elevationand layer data are stored independently.Section LODs are streaming on demand.The synthesis process can fill the gaps whensome LOD is temporally unavailable.Procedural synthesis is also use to generateextra high frequency detail.