Post on 28-Oct-2014
transcript
Direct3D 11 Tessellation
Speaker: Kevin Gee
Research: Charles Loop / Scott SchaferSlides: Shanon Drone, Matt Lee, Michael Oneppo
Design BackgroundProgrammable pipeline can target any surface approach.One primary scenario facilitates subdivision surfaces as a primitive type.Charles Loop and Scott Schaefer provided a reference approximation to Catmull-Clark.Converts Sub-D surface into Bezier patches.Other approaches are possible too.
Why Tessellate?Many reasons including
Reduced asset memory sizeMore morph targetsCheap / free LODs
Reduced asset creation time
Improved pixel shader utilizationReduced GPU skinning costsRun faster simulationsMove Sub-D costs to GPU
Pre-Tesselated Mesh: ~5500 kb
Asset Size: Comparison
Sub-D Mesh: ~130 kb
Morph Targets
Huge potential memory / size winsMorph targets in Sub-D take up less space than fully-tessellated \ sparse morph targetsEnable richer animations for the same memory cost
Level of Detail
Continuous LOD becomes possible.Reduces content creation time
Cheaper than building & testing explicit LODs
Improves pixel shader quad utilization
Faster SimulationSkin at the control mesh level
Saves skinning costs
Cloth in Sub-DReduces the resolution of the simulationKeeps a smooth surface for renderingThe more complex the simulation, the bigger the savings
Compute surface constraints at a lower frequency
Limit high-frequency positions to avoid penetrations
DIRECT3D 11 PIPELINE OVERVIEW
InputAssembler
VertexShader
Vertex Buffer
Index Buffer
Texture
GeometryShader
Texture
Stream Output
Rasterizer/Interpolator
PixelShader
OutputMerger
Depth/Stencil
Texture
Render Target
HullShader
Texture
DomainShader
Texture
Tessellator
New Primitives
Hull ShaderOperates per input primitive
E.g. patch
Computes control point transformsE.g. Basis Change
Computes tessellation factors per edge of generated patches
Hull Shader Syntax[patchsize(12)][patchconstantfunc(MyPatchConstantFunc)]MyOutPoint main(uint Id : SV_ControlPointID, InputPatch<MyInPoint, 12> InPts){ MyOutPoint result; …
result = TransformControlPoint( InPts[Id] );
return result;}
TessellatorInputs
Takes in “Tessellation Factors” provided by the Hull shader Tess factors per-side in the range of [2.0..64.0]
OutputsUV or UVW domain pointsConnectivity of those points (tris, lines)No adjacency information
Many possible partitioning schemes
Tessellation Scheme
demo
Domain Shader
Operates on each point generated by the tessellatorGets ALL control points as input
Control points and patch constant data are passed directly to the domain shader
Evaluate primitive surface to compute position of points
Convert from U,V space into positions, tangents
Domain Shader Syntaxvoid main( out MyDSOutput result,
float2 myInputUV : SV_DomainPoint, MyDSInput DSInputs,
OutputPatch<MyOutPoint, 12> ControlPts, MyTessFactors tessFactors ){
…
result.Position = EvaluateSurfaceUV( ControlPoints, myInputUV );
}
APPLYING SUBDIVISION SURFACES TO THE PIPE
What Are Subdivision Surfaces?
Surfaces defined by iterative refinementMany different techniques
Catmull-Clark (1978)Doo-Sabin (1978)Loop (1987)
Techniques differ primarily in edge cases and fixing trouble spots in previous techniques
Catmull-Clark Subdivision
Start with a quad meshFaces and edges are split in the centerVertices are averaged with their surrounding neighborsInfinite iteration results in the “limit surface”
Why Catmull-Clark?
Broad support from industry and modeling packagesParametric evaluation introduced in 1998 (Stam) at Alias|wavefrontFurther refinements added edges and creasesPixar adopted Catmull-Clark early
Facilitates rich character animation
Sub-D’s In Current SystemsBuild the model in
Sub-D’sModeling, texturing, rigging
Configure & preview displacement mapsAt export time
Tessellate into a poly meshApply displacement mapsWrite to disk
Game engineApply skinning transformRasterize
Proposed Future SystemBuild the model in Sub-D’sConfigure & preview displacement mapsExport Sub-D meshGame engine
Convert Sub-D mesh into parametric surfaceTessellate to desired LOD levelApply displacement maps and skinningRasterize
Catmull-Clark Terminology
Vertex, edge, quadValence is number of incident edges to a vertexRegular vertex has a valence of 4, otherwise it is an extraordinary vertex
Regular
VertexExtraordina
ryVertex
Loop/Schaefer ResearchRepresent each quad’s limit surface as a bicubic patch (16 knots, 4x4)Add two biquadratic patches that create a U and V tangent field
12 knots, 3x4 eachCross-product is the normal vector
Adjust the U and V patch edges to account for surface discontinuities around extraordinary vertices
Implementation OverviewInitialization time
Load Sub-D mesh (quad mesh)Build adjacency-based patches
Use 1-ring of vertices around each quad
Compute texture tangent space for each vertex
Run timeSkin the quad mesh in the vertex shader (VS)Convert Sub-D mesh into patches in the Hull shader (HS)Evaluate patches using the domain shader (DS)
Quad Mesh
Input Quads
Each patch consists of 4 inner quad vertices and a 1-ring neighborhood
Sub-D Patch
1-Ring Neighborhood
D3D11 Sub-D Pipeline Overview
Hull Shader
VS
Tessellator
Sub-D Patch Buffer
PS
Domain Shader
Draw
GS
o Single passo No additional memoryo Avoids 16 fetches per vertexo Variable tessellation within a draw
o Subsets of HS can operate in parallel
Skin
Regular and ExtraordinaryRegular patches
All vertices have 4 edge-adjacent neighbors
Valence 4
Predictable amount of data and work
Extraordinary patchesAny irregular patchNot quite as predictableRequire a little more workDraw call per valence supported
Direct3D 10 SDK SampleSubdivision Surfaces
demo
Handling CreasesAdd redundant geometry
Defined crease
Redundant geometry
More Loop/Schaefer ResearchLatest version:
Modified Approximate Catmull-Clark Patches (ACC2)Outputs a Bezier patch consisting of 16 control vertices for regular patchesOutputs a Gregory patch consisting of 20 control vertices for extraordinary patches
New Research (ACC2)Collapse position and tangent into a single bicubic patch
Fewer control points, less memory
Modification of a Gregory patch
Bicubic patch with 2 sets of interior knots (20 knots total)
b10b00 b20
b30
b01
b11v
b11u
b21v
b21u
b02
b03
b13 b23b33
b32
b31
b12v
b12u
b22v
b22u
ACC2 Patch
ACC2 Patch - Position
Average the inner point pairs and evaluate the resulting 4x4 bicubic patch for position
ACC2 Patch - Tangents
ACC2 Math
vpi
pi+1
pi-1
qi
b00 b10,i
b10,i+1
b20,i
b20,i+1
b11v,ib11u,i
qi-1
This is a lot…There’s a lot of complexity here, but it’s worth itD3D11 can target almost any surface algorithm you want
BezierNURBsDynamic and static tessellationDisplacementSubdivision (using Loop transforms)
and more…
Call to Action!
Experiment with the D3D10 Subdivision Surface Sample from the DirectX SDK NOW!Build support for Sub-D meshes into your pipelines, tools, and engines.
Look for a future Community Tech Preview (CTP) of Direct3D 11.
www.xnagamefest.com
© 2008 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only.
Microsoft makes no warranties, express or implied, in this summary.