Presentation on theme: "Geometry Clipmaps: Terrain Rendering Using Nested Regular Grids"— Presentation transcript:
1Geometry Clipmaps: Terrain Rendering Using Nested Regular Grids Frank LosassoStanford UniversityHugues HoppeMicrosoft ResearchThank you for the introduction
2Terrain Rendering Challenges Mount RainierPrimary Dataset:United States at 30m spacing 20 Billion samplesOlympic MountainsThe rendering of terrains in real-time pose several challengesThe difficulty comes from the large number of samples (often billions) that need to be stored, manipulated and rendered.This means that any terrain rendering system should incorporate the following elements:A concise storage scheme not susceptible to paging hick-upsThe data must be rendered efficiently such that high framerates can be sustained (preferably 60 fps or higher)And lastly, it’s important to ensure temporal continuity.Concise storage No paging hick-upsReal-Time frame rates 60 fpsVisual continuity No temporal pops
3Previous Work Irregular Meshes (e.g. [Hoppe 98]) Fewest polygonsExtremely CPU intensiveBin-trees (e.g. [Lindstrom et al 96])Simpler data structures / algorithmsStill CPU intensiveBin-tree Regions (e.g. [Cignoni et al 03])Precomputed regions Decreased CPU costTemporal continuity difficultThere has been lots of work done in the terrain rendering field.I’m going to divide the state of the art into 3 different categories:Irregular Meshes, which render the fewest number of polygons while still faithfully representing the terrain. They achieve this by performing several expensive preprocess operations combined with a very CPU intensive runtime system.Bin-trees (also known as longest-edge bisection or restricted quadtrees), which use more restrictive data structures making the algorithms cheaper. But they have to traverse these tree based structures and as such are still relatively CPU intensive.Lastly, Bin-tree regions, which use precomputed regions to further optimize the standard bintres. This means the runtime cost is significantly smaller, but temporal continuity is difficult when using these pre-cached blocks.
4Previous Work Texture Clipmaps [Tanner 1998] ‘Infinitely’ large texturesClipped mipmap hierarchyModeling for the Plausible Emulation of Large Worlds [Dollins 2002]Quadtree LOD around viewerTerrain synthesisOther related work includeTexture clipmaps, which were invented by Tanner in 98 to support arbitrarily large mipmaps efficiently without having to have the whole hierarchy in hardware.Since they are a generalization on mipmaps, no transitions were considered, and LOD is performed per pixel.Also, Dollins’ thesis in 2002 considered a similar refinement scheme to ours, and, he also considered terrain synthesis using stochastic subdivision. Their method does differ significantly from ours however especially due to their usage of quadtrees for storage.
5Geometry Clipmaps Store data in uniform 2D grids Level-of-Detail from nesting of gridsRefine based on distanceMain AdvantagesSimplicityCompressionSynthesisLets delve into some more details about the geometry clipmap method:As I mentioned earlier, we store data in a set uniform 2D gridsThe LOD comes from nesting these grids around the viewer.We refine purely based on distance from the viewer, where the grids differ by a factor of two in resolution at each refinement transition.This structure brings many advantages:First and foremost, the method is simple!Since we store data in a highly regular fashion, we enjoy very high compression ratios.The successive powers of two for refinement also allows for very promising terrain synthesis techniques.
6Terrain as a Pyramid Terrain as mipmap pyramid LOD using nested grids Coarsest LevelThe clipmap hierarchy itself can be seen as a pyramid similar to a mipmap pyramid.The full hierarchy is a prefiltered sequence of power-of-two sized grids, where the finest level contains the whole terrain at the finest resolution.<click> The clipmap is a clipped version of this pyramid consisting of windows at each level.Each cached and rendered level is of a predetermined size centered around the viewer.<click> Here we see the finest level closest to the viewer<click> The next coarser level, which has a region cut out where the next finer level would be rendered.<click> <click> Which is the way it looks for all of the other levelsAt the coarsest level, the entire terrain extents have been rendered.Top right shows a coarse example.As the viewer moves, clipmap levels incrementally updated and shifted.Finest Level
7Puget SoundHere is a higher resolution example of the clipmaps in action. The dataset is a 10meter horizontal spacing map for the Puget Sound region. The mountain is Mount Rainier
8Individual Clipmap Levels Uniform 2D gridIndexed triangle stripEfficient caching60 M triangles/second255-by-255 gridExpected Soon:Vertex TexturesThe individual clipmaps are very simple. As I mentioned earlier, they are uniform 2D grids, which allows us to render and process them very efficiently.By using indexed triangle strips for rendering, the graphics card can perform efficient caching of vertices, allowing for rendering rates of approximately 60M tris/sec on an ATI R300.The grid size that we used for the main examples in the paper were 255 by 255 which was chosen due to screen space error analysis and rendering efficiencyWe expect that vertex textures will become common place in the future. This feature will allow textures to be interpreted as vertex data, which should increase rendering rates significantly in fact, betas forms of such an extension are already available from the major vendors.
9Inter-Level Transitions Between respective power-of-2 gridsDue to the nesting of grids that we use to get LOD, we need to consider the boundaries between these levels in order to ensure both spatial continuity and temporal continuity
10Inter-Level Transitions BLOW UP PICTURESLuckily, the regular structure of our terrain samples allows us to perform blending between levels very efficiently.On the left, we show an example where there are no transitions. This yields the expected gaps in geometry.In the middle, we show the result of just morphing vertices to close gaps. The texturing is still discontinuous thoughAnd on the right, the same morphing parameter is used for both the vertices and the textures. Which yields the expected smooth transition.No transitionGeometry transitionGeometry & texture transitionGaps in geometryGaps in texturing/shading
11Inter-Level Transitions Vertex shader blend geometryPixel shader blend texturesBoth are inexpensiveTo perform this morphing efficiently, we pass both the height value and texture for both the finer and the next coarser level to the graphics card.A distance based morphing parameter is then calculated based on the viewers position and the extents of the clipmap level.The blue regions in the pictures show the morphing parameter, with a coarse wireframe example on the rightThe morphing for the vertices is done in the vertex shader, and the morphing for textures is done in the pixels shaders.Because of this, both are very inexpensive to perform and add negligible cost to our method.
12Clipmap Update For each level Calculate new clipmap region Fill new L-shaped regionUse toroidal arrays for efficiencyLets see how clipmap levels are updated as the viewer moves.When the viewer moves <click>,We have to update the clipmap levels. To do so, we go through each level, <click> calculate the new clipmap region<click> Then fill the exposed L-shaped region<click> To prevent data copying, we use toroidal arrays.
13Clipmap Update Update levels coarse-to-fine Use limited update budget Only render updated dataFine levels may be croppedRendering load decreases as update load becomes to large for the budgetThe levels themselves are updated coarse-to-fine.This order is required due to the finer levels dependence on the next coarser level, both when rendering and when updating (as we’ll see shortly).It’s possible for the update load to get too high for the allowed frame time, especially if the viewer is moving fast.To prevent this from adversely affecting the frame rate, we can use a limited update budged. This is done by updating only a limited number of vertices per frame.It may mean that levels may not have up to date data though, and in this case, we fall back on the next coarser level in those regions.It’s interesting to note that if the update budget gets excessive, then some parts of the finer levels may not be up to date, forcing us to fall back on coarser data in those areas, which contains less triangles hence leading to a smaller rendering load.Note that this only happens when the viewer is moving quickly however, and as such the dropped details are unlikely to be noticed.
14‘Filling’ New Regions Two Sources: Computed on-demand at 60 frames/secondThere are two sources of data for the updating of the terrain.On the left we see explicit terrain. This terrain is stored in compressed form, then decompressed as needed.On the right is synthesized data that is generated on the fly.Decompressed explicit terrainSynthesized new terrain
15Clipmap Update Fine level from coarse level U is a 16 point C1 smooth interpolantFor synthesized terrain, X = Gaussian noiseFor explicit terrain, X = compression residualTo better understand how each of these two sources of data work, lets look at the update procedure in more detail.The fine level (T_l) is calculated from next coarser level (T_l-1).U is an upsampling function which performs one level of refinement, for which we use a 16 point C^1 smooth interpolant.It is important that this interpolant is C^1 for the synthesis, as we’ll see later.After upsampling, we add eitherGaussian noise for synthesized terrainOr decompressed inter-level residuals for explicit terrain.
16Terrain Synthesis Adds high frequency detail Upsample then add Gaussian noisePrecomputed 50-by-50 noise texturePer-octave amplitude from real terrainLets consider terrain synthesis in slightly more detailGeometry clipmaps provide for a natural structure in which to generate synthesized detail.Stochastic subdivision [Fournier et al 82] or multiresolution texture synthesis [Wei and Levoy 2000] are two examples of promising synthesis methods that should be explored further.We used a very simple scheme as a demonstration:On the left, There are three levels with explicit decompressed terrain, followed by another 8 levels of only the 16 point upsampling filter.On the right, the same 3 explicit levels are used, but they are then followed by gaussian noise.The noise comes from a precomputed texture (for speed).We found that the result is not very sensitive to the size of this texture as long as it’s not too small, and sizes of powers of two should of course be avoidedThe noise function must also be spatially deterministic (so that the same terrain is generated every time).The amplitude of displacement at each level comes from statistical analysis of real terrain.
17Texture Synthesis Here is a demo showing first the smooth terrain Then the same terrain with the noise added.Only 3 levels of explicit data is used followed by 8 levels of synthesized data.
18Subdivision Interpolant As I mentioned earlier, the choice of which up-sampling function to use is very important.As an example,On the left were using a Bilinear Interpolant. Creases visible at every refinement levelOn the right, we are using the 16 point subdivision interpolant which does not have the crease causing derivative discontinuities.Bilinear Interpolant (C0)16-point Interpolant (C1)
19Terrain Compression Create mipmap fine-to-coarse D found from data such that:The second source of data is the compressed explicit terrain.Before I show how we insert the compression residuals into the refinement operation, I would like to discuss the compression itself.To create the compressed hierarchy,we use downsampling filter, D, to create a coarser level (creating a mipmap pyramid).An optimal filter of size 11X11 is found s.t. U(D(T_l)) gives the best approximation of T_l.This is done by simply solving linear system over a subset of the terrain.
20Terrain Compression Calculate residuals coarse-to-fine Upsample and compute inter-level residualQuantize and compress residualReplace approximation Prevent error accumulationResiduals are then calculated going back from coarse to fine.This is done by calculating an approximation of T_l from T_l-1 using the prior upsampling filter U.We can then Quantize and Compress the residual and store that.For the compression, we use the PTC image coder which has several nice properties:It uses overlapping basis function which means that there won’t be any blocking artifacts.And the basis functions are spatially localized which allows for efficient regional compression and decompression.To prevent error accumulation, we replace the approximation for T_l by using the result from decompressing the quantized and compressed residual.
21Compression Results U.S height map 30m horizontal spacing 1m vertical resolution216,000-by-93,600 grid40GB uncompressed350MB compressed factor of over 100rms error 1.8m (6% of sample spacing)To demonstrate the effectiveness of our compression scheme, we have tested it on the US geological survey height map of the United States of America.The data takes up 40 GB of space uncompressed, but by using our compression scheme it consumes only 350MB. This is a factor of about 115:1The rms error of this amount of compression is 1.8m, or only 6% of the sample spacing.
22Compression Results LOD scheme Number of samples Runtime space Bytes per sampleHoppe 8 M50 MB6.0Lindstrom 256 M5.0 GB19.5Cignoni et al 64 M115 MB1.8Geometry Clipmaps20 G375 MB0.02To see how this scheme compares to other leading LOD schemes:
23Level-of-detail Error Analyzed statistically See paperFor U.S. terrain (640-by-480 resolution)rms error = 0.15 pixelsmax error = 12 pixels99.9th percentile = 0.90 pixelsThe error introduced by the LOD is analyzed statistically, and I would like to refer anyone interested to the paper for the detailsI would like to summarize the results however:Using the same main dataset,The rms errror is only .15 pixels.Max error is 12 pixels… BUT happens very infrequently as the99.9th percentile is still less than one pixel.
24United States of America This is a video clip showing our system using the full U.S dataset.The framerate of program is a consistent 60 frames per second, but the video is only captured at 30 frames per second.Washington -> Oregon -> Nevada -> Arizona. Grand Canyon.Zoom out to see the entire US.The jagged edges are due to the map data ending there.
25Graphics Hardware Friendly Can be implemented in hardwareClipmap levels as high-precision texturesSubdivision and normal calculation [Losasso et al 03]Morphing already done in hardwareNoise from Noise() or from textureUploaded on-demandDecompressed terrainGeometry Clipmaps can be implemented in hardware.Clipmap levels can be stored as high-precision texturesThe subdivision and normal calculations can be performed on the GPU as demonstrated by us in 2003The morphing of geometry and textures is already done in hardware,And adding the noise can be done either through a hardware noise function or by pre-computing and storing it in a textureThe only aspect that can currently not be performed by the hardware is the decompression, but this could present an interesting avenue for future work.
26Limitations Statistical error analysis Unnecessarily many triangles Assumes bounded spectral densityUnnecessarily many trianglesAssumes uniformly detailed terrainbut, allows for optimal rendering throughputAs I mentioned earlier, we perform statistical analysis of the error, which assumes that the spectral density of the rendered terrain is uniform everywhere.We also render nested uniform grids, which means that it is not sensitive to the data being rendered.This means that we may render unnecessarily many triangles (especially in flat areas).In a sense, we are optimizing for the worst case, and handling the easier cases in a uniform manner. Since computer technology has reached a stage in which we can afford to render a lot of triangles, we still achieve 60 frames per second.
27Advantages Simplicity Optimal rendering throughput Visual continuity Steady renderingGraceful degradationCompressionSynthesisTo Summarize, here are the advantages of the geometry Clipmaps method:The method is simple.It allows us to achieve optimal rendering throughputVisual continuity is handled efficientlySteady rendering is guaranteed regardless of user inputIn the event of excessive update load, the method provides for graceful degradationAnd finally, we provide two new advantages,Very efficient compressionAnd finally terrain synthesis