Hull Shader: Control Point Construction
• All control points Pj are a weighted sum of
vertices:
Pj = ∑ wij Vi
• For each connectivity, pre-computes wij
and stores them in a stencil texture
• The hull shader invokes multiple threads.
Each thread computes one control point.
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Hull Shader: Control Point Construction
ACC_CONTROL_POINT SubDToParametricPatchHS(
InputPatch<CONTROL_POINT_OUTPUT, M> p,
uint tid : SV_OutputControlPointID,
uint pid : SV_PrimitiveID )
{
ACC_CONTROL_POINT output;
int topo = getPatchConnectivityID(pid); connectivity type ID
int num = getVertexCount(pid); the number of vertices in the patch primitive
float3 output.pos= float3(0,0,0);
for (int i=0; i< num; i++)
{ Compute
int idx = getVertexIDinPatch(pid,i); use index global ordering one control
point per
int index = fetchIndexInStencil(topo, idx, tid);
output.pos += p[i] * gStencil.Load(int3((index, 0,0)); thread
}
return output;
}
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Domain Shader
• One invocation per generated vertex
• Evaluate surface given parametric UV{W}
coordinates Vertex Shader
• Apply displacements
Hull Shader
Tessellator
Control U V {W}
points coordinates
Domain
Shader
one vertex
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Overview
This course section:
real-time rendering of
efficient substitutes for subdivision surfaces.
– Recent theoretical results
– Leveraging DirectX 11
Topics:
– Introduction to DirectX 11 Tessellation
– Implementation on DirectX 11 pipeline
– Implementation on current hardware
– Practical implementation issues
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Tessellation Process
Regular
Extraordinary
+
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Patch Construction Schemes
• PN Triangles
by Alex Vlachos, Jörg Peters, Chas Boyd, and Jason Mitchell
“Curved PN Triangles”, I3D 2001: Proceedings of the 2001 Symposium on
Interactive 3D Graphics, pages 159-166, 2001.
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
PN Triangles on Direct3D 11 Pipeline
HS input:
Hull Shader Tessellation factors
Tessellator
control points
Domain Shader
DS Input from Tessellator:
• uvw coordinates for one vertex
DS Output:
• one tessellated vertex
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Patch Construction Schemes
• ACC Patches
by Charles Loop and Scott Schaefer
“Approximating Catmull-Clark Subdivision Surfaces with Bicubic Patches” ,
ACM Transactions on Graphics, Vol. 27 No. 1 Article 8 March 2008.
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
ACC Patch on Direct3D 11 Pipeline
HS input:
Hull Shader
Tessellation factors
Tessellator
control points Domain Shader
DS Input from Tessellator:
• uv coordinates for one vertex
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Patch Construction Schemes
• Pm Patches
by Ashish Myles, Tianyun Ni and Jörg Peters
“Fast Parallel Construction of Smooth Surfaces from Meshes with
Tri/Quad/Pent Facets”, Symposium on Geometry Processing (SGP),
Copenhagen, Denmark, January 2 - 4, 2008.
m Pm-sectors
m=3
m=4
… Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Pm – Patch on Direct3D 11 Pipeline
HS input:
Hull Shader
Tessellation factors
Tessellator
control points
Domain Shader
DS Input from Tessellator:
• uv, or uvw coordinates for one vertex
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Overview
This course section:
real-time rendering of
efficient substitutes for subdivision surfaces.
– Recent theoretical results
– Leveraging DirectX 11
Topics:
– Introduction to DirectX 11 Tessellation
– Implementation on DirectX 11 pipeline
– Implementation on current hardware
– Practical implementation issues
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Instanced Tessellation on Current Hardware
Input Assembler
Vertex Shader • In the vertex shader
- Load patch index from
Hull Shader bucket’s patch list
Pass 4:
Surface - Load edge tessellation
Tessellator
Evaluation level to stitch boundaries
+DM
Domain Shader - Load control points to
evaluate surface
Vertex Shader
Geometry Shader - Apply Displacement
Setup/Raster Mapping
Setup/Raster
Pixel Shader Pixel Shader
Output Merger Output Merger
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Overview
This course section:
real-time rendering of
efficient substitutes for subdivision surfaces.
– Recent theoretical results
– Leveraging DirectX 11
Topics:
– Introduction to DirectX 11 Tessellation
– Implementation on DirectX 11 pipeline
– Implementation on current hardware
– Practical implementation issues
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Watertight Tessellation
• Floating point precision issue
- Addition is neither commutative nor associative
- Special care has to be taken to obtain watertight results
to prevent cracks
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Watertight Patch Construction
• Control Points Construction
- Control points type: corner, edge, face
- In all cases we can compute a control point as
weighted sum: Pj = ∑ wij Vi
- Needs consistent ordering of the summation
V8
V7 V6
V9
V5
V0
V1
V3 V4
V2
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Watertight Surface Evaluation
Inconsistent
Consistent
Positions: orientations
P(u,v) = ∑ bi Bi(u,v)
Problem:
a+b+c != c+b+a
Solution 1:
All computations need to
done in consistent
parametric orientation
Solution 2:
Symmetric evaluation
Courtesy of Valve
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Watertight Displacement
• Displacement Mapping
- Sample displacement value from a texture
- Displace vertex along its normal
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Watertight Displacement
• Watertight normals
- Cross product of a pair of tangent, bitangent vectors
- All three vectors should be co-planar
- Problem: cross(tanU,tanV) ≠cross(tanV, tanU)
- Solution: Define corner and edge ownership
tanV
tanU tanU
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Watertight Displacement
Problem:
Non-watertight Texture Seams due to
- Bilinear discontinuities
- Varying floating point precision on different regions of the
texture map
- Seamless parameterization removes bilinear artifacts, but
does not solve floating point precision issues
Solution:
Define patch ownership of the seams
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Watertight Displacement
• Store 4 texture coordinates per
vertex (0: interior, 1,2: edges, 3:
corner) tx3 tx1 ty2 ty3
– 16 per quad patch, 12 per triangle
tx2 tx0 ty3
ty0 ty1
patch
– The corresponding texture ty1
coordinate can be selected using
the value of the parametric tw1 tw0 tz0 tz2
tw2
coordinate UV
– Compute Barycentric interpolation tw3 tw2 tz1 3 tz3
tw
of texture coordinates
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Watertight Surface Evaluation
Suggested Reading:
• Tessellation of Subdivision Surfaces in DirectX 11
(Gamefest 08)
http://developer.nvidia.com/object/gamefest-2008-
subdiv.html
• Next-Generation Rendering of Subdivision Surfaces
(Siggraph08)
http://developer.nvidia.com/object/siggraph-2008-
Subdiv.html
• Course Notes (Siggraph09)
http://www.nitianyun.com/sigcourse09.html
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Live Demo
Instanced Tessellation
GPU Patch Construction
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
Q&A
Tianyun Ni Ignacio Castaňo
tni@nvidia.com icastano@nvidia.com
Efficient Substitutes for Subdivision Surfaces – SIGGRAPH Course 2009
This slide deck is from Part 4 of this course, deta more
This slide deck is from Part 4 of this course, detailing a real-time implementation using DirectX 11.
Course description: The goal of this course is to familiarize attendees with the practical aspects of subdivision surfaces for which we introduce substitutes for increased efficiency in real-time applications. The course starts by highlighting the properties that make SubD modeling attractive and introduces some recent techniques to capture these properties by alternative surface representations with a smaller foot-print. We list and compare the new surface representations and focus on their implementation on current and next-generation GPUs. Among the advantages and disadvantages of each approach, we address crucial practical issues, such as watertight evaluation, creases and corners, and seamless displacement mapping. Finally and most importantly, Valve and Industrial Light Magic will present a few breathtaking practical examples and demonstrate how these advanced techniques have been adopted into their gaming and movie production pipelines. less
0 comments
Post a comment