Professional Documents
Culture Documents
Design Background
Programmable 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 size More morph targets Cheap / free LODs
Reduced asset creation time
Improved pixel shader utilization Reduced GPU skinning costs Run faster simulations Move Sub-D costs to GPU
Morph Targets
Huge potential memory / size wins Morph targets in Sub-D take up less space than fully-tessellated \ sparse morph targets Enable richer animations for the same memory cost
Level of Detail
Continuous LOD becomes possible. Reduces content creation time
Cheaper than building & testing explicit LODs
Faster Simulation
Skin at the control mesh level
Saves skinning costs
Cloth in Sub-D
Reduces the resolution of the simulation Keeps a smooth surface for rendering The more complex the simulation, the bigger the savings
Input Assembler
V ertex Shader
T exture
T exture
O utput Merger
New Primitives
Hull Shader
Operates per input primitive
E.g. patch
Tessellator
Inputs
Takes in Tessellation Factors provided by the Hull shader Tess factors per-side in the range of [2.0..64.0]
Outputs
UV or UVW domain points Connectivity of those points (tris, lines) No adjacency information
demo
Tessellation Scheme
Domain Shader
Operates on each point generated by the tessellator Gets ALL control points as input
Control points and patch constant data are passed directly to the domain shader
Techniques differ primarily in edge cases and fixing trouble spots in previous techniques
Catmull-Clark Subdivision
Start with a quad mesh Faces and edges are split in the center Vertices are averaged with their surrounding neighbors Infinite iteration results in the limit surface
Why Catmull-Clark?
Broad support from industry and modeling packages Parametric evaluation introduced in 1998 (Stam) at Alias|wavefront Further refinements added edges and creases Pixar adopted Catmull-Clark early
Facilitates rich character animation
Game engine
Apply skinning transform Rasterize
Catmull-Clark Terminology
Vertex, edge, quad Valence is number of incident edges to a vertex Regular vertex has a valence of 4, otherwise it is an extraordinary vertex
Loop/Schaefer Research
Represent each quads limit surface as a bicubic patch (16 knots, 4x4) Add two biquadratic patches that create a U and V tangent field
12 knots, 3x4 each Cross-product is the normal vector
Adjust the U and V patch edges to account for surface discontinuities around extraordinary vertices
Implementation Overview
Initialization time
Load Sub-D mesh (quad mesh) Build adjacency-based patches
Use 1-ring of vertices around each quad
Run time
Skin 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
Draw
o Single pass o No additional memory o Avoids 16 fetches per vertex o Variable tessellation within a draw o Subsets of HS can operate in parallel
VS Hull Shader
Tessellator Domain Shader GS PS
Extraordinary patches
Any irregular patch Not quite as predictable Require a little more work Draw call per valence supported
demo
Direct3D 10 SDK Sample Subdivision Surfaces
Handling Creases
Add redundant geometry
Redundant Defined geometry crease
b22v b22u
b32
b21v b21u
b31
b00
b10
b20
b30
ACC2 Patch
Average the inner point pairs and evaluate the resulting 4x4 bicubic patch for position
ACC2 Math
pi+1
b20,i+1
v
b00
b10,i+1
b11u,i b11v,i
qi
b10,i
b20,i
pi
pi-1 qi-1
This is a lot
Theres a lot of complexity here, but its worth it D3D11 can target almost any surface algorithm you want
Bezier NURBs Dynamic and static tessellation Displacement Subdivision (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