DX11 Tessellation - nVIDIA

  • No tags were found...

DX11 Tessellation - nVIDIA

The Problem of Geometric Realism in GamesPixels are meticulously shaded,but geometric detail is modestImage from Far Cry® 2,courtesy of Ubisoft

Tessellation – What and WhyMemory footprint & BW savingsStore coarse geometry, expand on-demandEnables more complex animationsScalabilityDynamic LOD allows for performance/quality tradeoffsScale into the future – resolution, compute powerComputational efficiencyDynamic LODGPU animate and expand compact representation© Kenneth Scott, id Software 2008

Life of a patchFrom input assemblyVertexInput Mesh(a collection of patch primitives)Displacement MapNormal Map (optional)PatchAssemblyPatchRepresent the a face and its 1-ring.Only primitive type that is supportedwhen tessellation stages are enabled.Arbitrary number of vertices between 1and 32No implied topology.ControlpointsHullTessellatorDomainPrimitiveAssemblyGeometry

Life of a patchFrom input assemblyVertexInput Mesh(a collection of patch primitives)Displacement MapNormal Map (optional)PatchAssemblyHullSkinning,…struct VERTEX{float3 vPositionfloat2 vUVfloat3 vTangentuint4 vBonesfloat4 vWeights};: POSITION;: TEXCOORD0;: TANGENT;: BONES;: WEIGHTS;ControlpointsTessellatorDomainPrimitiveAssemblyGeometry

Life of a patchFrom input assemblyVertexInput Mesh(a collection of patch primitives)Displacement MapNormal Map (optional)PatchAssemblyHull ShaderControl Point Phase (optional)Compute Control points (optional)Explicitly parallelConstant PhaseCompute LODsCompute per patch informationPseudo parallel (fxc dependent)ControlpointsHullTessellatorDomainPrimitiveAssemblyGeometry

Life of a patchTessellatorWhere expansion happensLet lod be the TessFactor at eachedge and interiorFrom input assemblyVertexPatchAssemblyHullNumber of triangles on a triangledomain1+6*∑ i=1lod/2(2*i), If lod is odd6*∑ i=1lod/2(2*i-1), If lod is evenNumber of triangles on a quaddomain2*lod*lodControlpointsTessellatorDomainPrimitiveAssemblyGeometry

Life of a patchFrom input assemblyVertexInput Mesh(a collection of patch primitives)Displacement MapNormal Map (optional)PatchAssemblyDomain ShaderSurface EvaluationDisplacement mappingImplicitly parallel (on threadper vertex)Vertex shader tasksVertex projectionNormal transformation…Patch SurfaceHigh-detailed MeshControlpointsHullTessellatorDomainPrimitiveAssemblyGeometry

Tessellation schemesVarious tessellation schemes differ atNumber of vertices in the patch primitiveControl points computations (in Hull Shader)Pass through or higher order parametric patchSurface evaluation (in Domain Shader)Barycentric interpolation or higher order parametric patchLinear/FlatPhongTessellationPN TrianglesCatmull-Clark(approximated)Local Construction Schemes

PN TrianglesKey features:Cubic Bezier patchesQuadratic normal variationGeometrypatchEasy to implementHard edges not handledOne input triangleNormalpatch“Curved PN Triangles”, by Alex Vlachos, Jörg Peters, Chas Boyd, and JasonMitchell, I3D 2001.“PN Quads”, by Jörg Peters, 2008.

Phong TessellationKey features:Quadratic geometry interpolationLinear normal variation (phong shading)Simpler than PN TrianglesCan not handle inflection pointsNeeds a relatively dense mesh to start withPaper Siggraph 2008 Asia, by Tamy Boubekeur & Marc Alexa

Catmull-Clark Subdivision SurfacesProvides movie-quality surfacesCatmull-Clark subdivision surfaces are extensively usedin movie production and modeling & sculpting toolsSuitable for quadrilateral meshes with few trianglesApproximation (ACC)Approximation rather than interpolationRequires the mesh info of a facet and its1-ringneighborhood

ACC referencesApproximating Catmull-Clark Subdivision Surface with BicubicPatches” by Charles Loop and Scott Schaefer, ACM Transactionson Graphics, Vol. 27 No. 1 Article 8 March 2008.http://research.microsoft.com/en-us/um/people/cloop/msrtr-2007-44.pdf“Approximating Subdivision Surface with Gregory Patches forhardware Tessellation” by Charles Loop, Scott Schaefer, TianyunNi, Ignacio Castano, Siggraph Asia 2009.http://research.microsoft.com/en-us/um/people/cloop/sga09.pdfExtends previous work to a more general mesh that contain quads, trianglesand meshes with boundary.Reduces number of control points for faster surface construction andevaluation.

Tessellation Schemes Comparison# of vertices in apatch primitive# of controlpointsBasemeshSurface fairnessPhong 3Or 46Or 9Artifacts at inflection points andhigh curvature areaPN 3Or 410+6Or 16+9Gregory ACC 16 to 32 15Or 20Artifacts at high curvature areaSimilar to CC surfacesChoose appropriate schemes for your art assets.Tradeoff between performance and visual quality

Water TightnessControl Points cracksProblem: floating point precision issues a+b+c != c+b+aRequire consistent evaluations at corners and edgesDisplacement cracksProblem: Bilinear discontinuitiesDefine patch ownership of the texture coordinatesNormalsProblem: cross(tanU,tanV) ≠cross(tanV, tanU)Discontinuities occur at shared corners and edges

LOD computationLOD heuristicsObject to camera distanceScreen resolutionSilhouetteDisplacement densityPerformance/quality balance controlSmooth LOD transitions

Screen Space LOD ComputationGenerate exactly the amount of geometryneeded for a given viewNo under/oversamplingUniform sampling of the surface improvesshadingTriangles of roughly the same size => hwefficiency4-8 pixels/tri on screen for high end

Optimization tipsPer-object culling (based on bounding box)FrustumOcclusionPer-patch culling (in the hull shader, based on tight-boundDisplaced Bezier patches)Frustum, Backface, Occlusion (?)Set tessellation factor to 0Do not use tessellation factor = 1

Metro 2033: Tessellation in charactersDisplacement mapping enables film-levelgeometric complexity in real-timeScreenshots from Metro 2033© THQ and 4A Games

Metro 2033 tessellationReuse of DX9/DX10 assetsPhong Tessellation + Displacement mapsLOD criteria:TESS_FACT = LEN * NP * Q / DISTWhere LEN is edge length in world spaceNP is number of pixels on the screenQ is quality constantDIST is distance from observer to edge center

Metro 2033: Tessellation in characters

Metro 2033: Artifacts on Hard Edges

Transitional Polygons

Terrain TessellationFlat quads; regular gridHeight map; vertical displacement; sample in DSChallenges:Existing data from DX9/DX10A wide range of LODs

Data Solution: Fractal “Amplification”Coarse height map defines topographic shapeUpsample with bicubicFractal detail map adds high-LOD detail (fBm)BicubicNoiseCheap memory requirementsCan reuse coarse assets from DX9 or DX10 engine

Fractal “Amplification” - ResultsNo hw tessellation

Fractal “Amplification” - ResultsBicubic filtered heights

Fractal “Amplification” - ResultsTessellationBicubic + 5 octaves fBm

Screen-space-based LOD (hull shader)Enclose quad patch edge in bounding sphereProject into screen-spaceScreeneyeΔ sizeProjectedspherediameterΔs per edge = diameter / target Δ size(diameter & target size in pixels)Fully independent of patch size

Fractal “Amplification” - ResultsNo hw tessellation

Fractal “Amplification” - ResultsTessellationBicubic + 5 octaves fBm

HAWX 2 ResultsNo Hardwre Tessellation

HAWX 2 ResultsTessellationBicubic + 5 octaves

HAWX 2 ResultsNo Hardwre Tessellation

HAWX 2 ResultsTessellationBicubic + 5 octaves

HAWX 2 ResultsNo Hardwre Tessellation

HAWX 2 ResultsTessellationBicubic + 5 octaves

Shading at different frequenciesHoist lower-frequency computation from PS to DSE.g. ambient/volumetric lightingShading in object space sometimes betterMore uniform surface samplingLess aliasing under animationIn general, compute complex things as early in the pipeline aspossibleVS possible? … HS possible? … DS possible? … If not, then PSTry to minimize number of attributes coming to PS stage

Shading in the Domain Shader

Conclusions on TessellationDirect3D11 Tessellation enables visual detailSeveral tessellation schemes with flexible LOD controlChanges to content creation pipelineTessellation HW is very powerful, but still need to use it wiselyIt is possible to re-use DX9/DX10 content with no extra workLocal schemes, Fractal noise functions,…Tessellation is not only about visual detail, but faster shadingShading in DSIt’s time to bring games to the next level!!!

ThanksTo all the people I borrowed material from: Miguel Sainz, KirillDmitriev, Yury Uralsky, Iain Cantlay, Jon Jansen, CemCebenoyan, Sarah Tariq, Tim Tcheblokov, Evgeny Makarov, THQ,4A Games, Ubisoft, ID, Pixar, Disney…For questions/comments please contact us:tni@nvidia.com

Other use cases: Grass

Other use cases: Hair

Content Creation PipelineModeling ToolsBase surface(control cage)Sculpting ToolsDetailed meshBaker ToolsNormal, displacement, occlusion, and othermaps…Some baker tools can be automated… talk to us!

More magazines by this user
Similar magazines