540 likes | 699 Views
Image Synthesis. Interactive Terrain Rendering. Motivation. Mobile Terrain Visualization. Mobile GPUs 250M pixels / second 5M triangles / second 6 Textures OpenGL ES / Direct3Dm Challenges 1,25 MB Video-RAM… Fixpoint formats Bandwidths Compression, streaming etc. Requirements.
E N D
Image Synthesis Interactive Terrain Rendering
Mobile Terrain Visualization • Mobile GPUs • 250M pixels / second • 5M triangles / second • 6 Textures • OpenGL ES / Direct3Dm • Challenges • 1,25 MB Video-RAM… • Fixpoint formats • Bandwidths • Compression, streaming etc.
Requirements • Games • High, constant frame rates • Quality advantageous but not priorized • Simulators • Constant frame rates (~30fps) • High degree of realism and detail, optionally stereo • GIS • Interactive frame rates advantageous (15+ fps) • High resolution and precision
Oberbayern and Alps Heightfield with texture ~ 350 MB Crater Lake, Oregon, US Heightfield with bathimetry and texture ~ 500 MB Puget Sound, WA, USA Heightfield with texture ~ 1.25 GB Challenges
Mars, MOLA mission Heightfield with texture ~ 4.5 GB USA complete, USGS data Heightfield ~ 40 GB Mars, MarsExpress mission Heightfield with texture (Video) ~ 175 GB Challenges
Challenges Data sets are: • Large to gigantic • Data volume is increasing rapidly • Sometimes multi-modal • Color, Albedo, Cloud coverage, Scattering properties, … • Sometimes annoted and commented • Additional layers with meta data Efficient Rendering ?
Terrain rendering • Terrain: • A height field over a rectangular domain • Given at discretesample points
Terrain rendering Rendering litandtexturedtriangles • Vertices, texturecoords, colors, normals
Terrain rendering • Ray-Tracing • Ray-tracing triangle meshes • Trace rays until a triangle is hit • Implicit occlusion culling
Terrain rendering • Ray-Tracing - performanceissues • Meshdatastructurehastobestored • Hierarchicalrepresentationnecessaryforimprovedintersectiontest OctreeorkD-tree max/min(H) max/min(H) max/min(H) Store max/min heightsforsubregions Skip regionsbelow minimal heightofray Employraycoherences
Terrain rendering • Rendering polygonal models – analysis • Aliasing due toundersamplingofsmallfeatures • Noexploitationofthe LOD-nature
Terrain rendering • Rendering techniquesforterrains • Render eachtriangleseparately • Draw: (v0,v1,vX), (v1,vX,vX+1), ... • Eachvertexisrendered (transmitted, transformed) sixtimes ... VX VX+1 VX+2 VX+3 ... VX-1 V0 V1 V2 V3
Terrain rendering • Rendering techniques for terrains • Render triangle strips: v0,vX,v1,vX+1,v2,vX+1, ... • Triangle defined by new point and previous two points • Each vertex is rendered only once ... VX VX+1 VX+2 VX+3 ... VX-1 V0 V1 V2 V3
Terrain rendering • Height fieldpre-processing • Reducenumberof primitives bymeshdecimation • Meshdecimationbased on anydecimationctriterion • Curvature („flatness“) • Usefewer but larger triangleswheretheheightfieldis flat
Terrain rendering • Even with mesh decimation there are still too many triangles • Some features might not be visible because they are too far from the viewer • Feature size is smaller than size of a pixel • Level-of-detail should be adapted to the size of details when displayed rather than to their size in world space
Terrain rendering • Approach: adaptively decimate the mesh with regard to the current view • General idea: • Top-down approach • Start with coarse resolution (2 triangles) and adaptively refine until desired level-of-detail is reached • Consider world space and screen space deviation • Re-build mesh for every frame
Terrain rendering • Recursive split operation (as in ROAM)
Terrain rendering • Error criterion for split operation • Deviation in world space • Difference between height value at center vertex and average of left and right vertex • Deviation in screen space • Determine upper bound for screen space length of world space difference vector (0,d,0)
Previous Work • Processand render Batches ofgeometry: (P-)BDAM • Hugepre-processingrequirements • Hardware requirements (SCSI Raid) • Average Quality • Hierarchical, regularGrids: (GeometryClipmaps) • Goodcompression, goodframerates • Error controlveryhard, qualitysuffers • Losasso & Hoppe SIGGRAPH 2004 • Vastbodyofliterature… seewww.vterrain.org • Key Insight: Dynamic remeshingtoo expensive
Geometry clipmaps • Terrain as mipmap pyramid- LOD using nested grids- LOD is shifted over domain, with varying height values Coarsest Level Finest Level
Geometry clipmaps • Advantages: • Regular structure of nested grids enables fast rendering using triangle strips • Only regular and continuous chunks of memory have to be read • Disadvantages: • Does not allow to control local world/pixel error • Renders more triangles than necessary • Introduces a significant higher pixel error in general
GPU-friendly terrain rendering • Tile-based, restrictedQuadtree • Lmaxerrormetricallowsforpreciseerrorcontrol • Low pre-processingtimes (15M vertices/min) • Nestedhierarchy • Pre-filtered, tiled S3TC-Mipmaps • High-qualityLanczospre-filtering • Reducesartifactsattileborders • S3TC virtuallyforfree • Precise Level of Detail Oracle • Based on theJacobianoftheprojection • Does not make linear approximations • Better anti-aliasingcontrol
Tile-based… • Partition dataintosquaretiles • Can bepre-processedindependently • Frustumculling per tile • Progressive datatransfer per tile • T-Vertices: Fix withzero-areatriangles • Onlydynamictriangulationduringrun-time.
Restricted Quadtree Hierarchy • Tiledmeshesaredecimated in a pre-process • Meshdecimationas in ROAM (Real-Time OptimallyAdaptingMeshes - seewww.vterrain.org) • Exploits a trianglebintreestructure: splitalongthebaseedge
Restricted Quadtree Hierarchy • The recursivesplitoperation • A triangleshouldbesplit but has a baseneighborfrom a coarserlevel • Force splitofbaseneighborfirst • Recursivelyforcefurthersplitsifnecessaryuntildiamondisfound • Diamond canbesplitwithoutfurthersplits
Restricted Quadtree Hierarchy • Recursive split operation
Restricted Quadtree Hierarchy • Vertices can be shared across levels • „Coarse“ Vertices used in all finer levels • Progressive encoding, less memory consumption
Restricted Quadtree Hierarchy • Bygeneratingapproximationsoftheheightfieldwithdecreasinglylowerapproximationerror, a meshhierarchythatrepresentsthe original terrainateverfinerscalesisconstructed • Togenerate a discretesetofhierarchylevels, an errorvector (e0; e1; … ;e(n-1)) ofexponentiallydecreasingentries ei:= 2(n-1-i)isspecified • Hierarchylevelsthatsatisfytheseerrorsareconstructed via adaptive triangulation
Restricted Quadtree Hierarchy • Eachhierarchylevelcanbe render as „recursivetrianglefans“ • Fans around „quadtreecenters“ • Exploit primitive restarts on nVidiaarchitectures • A flag in the primitive streamthatindicates a newfan • Usedtoavoidfrequentcallsfromapplicationprogram
Restricted Quadtree Hierarchy • Nested Mesh Hierarchy: • Quadtree refinement: • Automatically results in nested mesh • Each new triangle re-uses two old vertices • Elegant geomorphing possible • Requires only one height value per vertex & level • Can be implemented in vertex shader „The parameter domain of each triangle is a subset of the parameter domain of exactly one triangle at the coarser levels.“
Tiled, S3TC Mipmaps • Tiled Mipmaps: • Start with large 2D texture • Generate large Clipmap using Lanczos filter • Tile after filtering artifacts at boundaries reduced • S3 Texture Compression • Designed for Games Supported by virtually all GPUs • Fast encoding in driver • Decoding virtually for free • Block Truncation Code, 4x4 pixels per block • Lossy compression: 6:1 Quality ? • We are researching other GPU-friendly methods…
S3TC Quality ? Pros: „rough“ textures
S3TC Qualität And Cons… - „smooth“ textures
Texture compression • Vector quantization Input mapping Encoder in=E(Xn) Xn Codebook C with codewords Decoder in X‘n=C(in) Output mapping
Vector Quantization • Find centroids (representativevectors) towhich all elementsareassigned • Elements getassignedto „closest“ representative
Texture compression Vectorquantization: the LBG-Algorithm • Initalcodebook {Yi(0)}i=1..M; IRn: setofinputvectors; • Initialization k=0, D(0) =0, set • Find quantizationregionsVi(k) = {XI: d(X,Yi) < d(X,Yj) j≠i, j=1..M} • Computedistortion • Test: If (D(k)-D(k-1))/D(k) < ) stop elsecontinue • Update: increment k, find newcodebook{Yi(k)}i=1..MfromregionsVi(k-1); goto 3
Texture compression True-Color (3*8 Bit) vs. 12 Bit Quantization + Codebook
Texture compression 8 Bit 6 Bit 4 Bit 2 Bit
Texture compression Region quantization 2 bpp, 2x2 pixel encoding 2 bpp
Confocal scan 10242x64 RGBA 32 bpp 1 bpp
CT scan 2563 Original Hierarchical encoding 21:1
Engine CT scan 2562x128 Original Hierarchical encoding 21:1
Visible Male RGB slice 2048x1216 Original 24 bpp Hierarchical encoding 0.3 bpp
Vortex simulation 100 x 1283 Original, 200 MB Hierarchical encoding 11 MB
Shockwave simulation 96 x 2563 Original, 1.4 GB Hierarchical encoding 70 MB
Texture compression • Vector quantization for GPUs • Easy to decode in fragment shader • Only requires a dependent texture fetch (uses index to lookup the entry in the codebook) • Does not allow for texture filtering (so far) • Interpolation between indices gives errorenous results • Eventually larger regions can be decoded, rendered into texture render target and then used to texture the object • Functionality is available but mipmapping might be a problem
Scale of detail • Question: • Now that we have a geometry and a texture MipMap, how is the resolution determined at which a particular tile has to be rendered • Guess: • Depends on distance to viewer • Depends on projection used for rendering • Depends on orientation of tile
Scale of detail • Projectionis non-linear (hom. division) • Pixel coords s(v), where v vertex in objectspace • Objectspacescaletopixelcorrespondence • SimilartoMipmapping • Requires partial derivatives • Can beobtainedbythe inverse Jacobianof s(v): • Jacobian s(v) = ∂si/∂vi • Jacobian-1 s(v) = ∂vi/∂si
From scale to level of detail • Pre-process: levels L with errors 2L meters • LOD =log2() for bounding box corners of tiles • Tri-linear interpolation of in box • LOD per vertex for geomorphs • Find minimum of for each box • Finest detail determines used topology • Project vertices to appropriate level (geomorph) • Requires pre-computed height for each vertex & level • But only for coarser levels • And can be done in reduced precision (i.e. 8bits)