Advanced Topics in GPU Tessellation: Algorithms and Lessons Learned Natalya Tatarchuk GGpraphics SW Architect Game Computing Applications, O-CTO AMD GPG Outline Benefits of tessellation Tessellation pipelines: Xbox 360 through Direct3D® 11 Rendering with tessellation Interpolative subdivision for object and character rendering Higher order surfaces on GPU Animated tessellated characters Terrain rendering with adaptive tessellation Tools and art pointers Conclusions Outline Benefits of tessellation Tessellation pipelines: Xbox 360 through Direct3D® 11 Rendering with tessellation Interpolative subdivision for object and character rendering Higher order surfaces on GPU Animated tessellated characters Terrain rendering with adaptive tessellation Tools and art pointers Conclusions The Benefits of Tessellation Tessellation reduces memory footprint and bandwidth Only store low resolution mesh Always relevant, especially for consoles
Polygons Total Memory Low resolution 5160 polygons VB/IB: 100K Froblin model 2K x 2K 16 bit displacement map: 10MB ZBrush High res >15M polygons ~270MB VB and 180MB IB storage Froblin model The Benefits of Tessellation Scalability Stable and predictable performance Performance Analysis: Terrain
Low Resolution with High Resolution, Tessellation No Tessellation
On-disk model 840 triangles 1,280,038 triangles polygon count (pre-tessellation)
Original model 1210 fps (0.83 ms) rendering cost
Actual rendered 1,008,038 triangles 1,280,038 triangles model polygon count
VRAM Vertex buffer 70 KB 31 MB size
VRAM Index buffer 23 KB 14 MB size
Rendering time 821.41 fps (1.22 ms) 301 fps (3.32 ms)
Both use the same displacement Rendering with tessellation is > 6X map (2K x 2K) faster and provides memory savings and identical pixel shaders over 44MB! Subtracting the cost of shading Tessellation Performance Analysis
Far Close- away up view view
Rendering Num faces: Mode ATI ATI ATI ATI N = 411 x N RadeonTM RadeonTM RadeonTM RadeonTM T L HD 4870 HD 2900 XT HD 4870 HD 2900 XT
Original low res 4,050 852 fps 359 fps850 fps275 mesh (NL) triangles
Continuously tessellated 1.6 M triangles 232 fps 143 fps213 fps101 mesh (NT)
Adaptively Dynamic, tessellated 1.6M > NA > 845 fps 356 fps574 fps207 mesh NA 4K triangles HigQgher Quality Animation and Simulations More complex computations Pass 1: Control at lower resolution cage animation Provide more animation data
per fewer vertices Animated object vertex buffer Higher fidelity physics (collisions, etc) Pass 2: Tessellate Separating control cage animated mesh animation pre tessellation gives higher overall performance 30% boost in the Froblins example The Benefits of Tessellation Provide data to GPU at coarse resolution Render at high resolution Displacement surfaces are first-class citizens
tessellate displace
Model concept courtesy of Valve Character LOD Management Character LOD Management
Combine tessellation, stream out and instancing features for level of detail management Direct3D® 10 / Direct3D® 10.1 / Direct3D® 11 Use tessellation to get maximum amount of details with stable performance Example: Render an army of instanced characters Get reallyyy close to any of them and see the details Regularly drawn Froblin No tessellation used High Detail Froblin with Tessellation and Displacement Mapping Froblin Close-up:
No tessellation Froblin With Tessellation and Displ acement Mapp ing Close-up Outline The benefits of tessellation Tessellation pipelines: Xbox 360 through Direct3® D11 Rendering with tessellation Interpolative subdivision for object and character rendering Higher order surfaces on GPU Animated tessellated characters Terrain rendering with adaptive tessellation Tools and art pointers Conclusions Direct3D 11 Direct3D 11 is a strict superset of Direct3D 10 & 10.1 Direct3D 11 adds support for features like multithreading, tessellation, and compute to Direct3D 10.1 The fastest way to move to Direct3D 11 is to start developing on Direct3D 10/10.1 today Direct3D 11 will be available on Vista and future Windows OS’s Direct3D 11 will run on downlevel hardware Multithreading! Direct3D 10.1, 10 and 9 hardware/drivers FllFull functi onalit y (for exampl e, tesse llti)llation) will require Direct3D 11 hardware Direct3D11 Pipeline
Input Assembler Direct3D 10.1 pipeline Vertex Sha der Plus Hull Shader 3 new s ta ges for Tessellator Tessellation Domain Shader Plus Geometry Shader Stream Output Compute Shader Rasterizer
Pixel Shader Compute Data Structure Shader Output Merger Tessellation Process
Evaluate surface Tessellator positions
Add displacement SuperSuper--primprim Mesh Tessellated Mesh Tessellated and Displaced Mesh
Displacement Map Domain Parametrization Direct3D 11 Tessellation
Input Assembler
VtVertex Shad er Control cage transformation and animation: Hull Shader -Morphing / Skinning / Transforms -The mesh can have any format: Tessellator patches or polygons Domain Shader
Geometry Shader
Rasterizer
Pixel Shader
Output Merger Direct3D 11 Tessellation
Input Assembler Once per control primitive Vertex Sha der
Hull Shader Per-patch data and operations • Such as tessellation factors Tessellator • Access data for the entire primitive in original mesh Domain Shader • BiBasis convers ion • Example: Approximating Catmull-Clark Geometry Shader surfaces by transforming control cage into BBiezier patthches Rasterizer • Project patches into screenspace
Pixel Shader • No redundant per-patch data fetches Output Merger Direct3D 11 Tessellation
Input Assembler
Vertex Sha der
Hull Shader Fixed function tessellation unit: -Generates uvs and connectivity Tessellator information for domain primitive type (lines, triangles and quads) Domain Shader -Up to 64x pr im itive / dtdata amplification Geometry Shader Stream Output Rasterizer
Pixel Shader
Output Merger Direct3D 11 Tessellation
Input Assembler
Vertex Sha der
Hull Shader
Tessellator Evaluate each surface point Get patch ID and uv coordinates Domain Shader Patch data is stored in local storage Outputs surface position Geometry Shader Stream Output Rasterizer
Pixel Shader
Output Merger Tessellation Pre Direct3D 11
GPU tessellation already available Supported on Xbox 360 Supported on ATI RadeonTM HD 2000 Series and beyond Even on the integrated chipsets! Subset of Direct3D 11 tessellation features Available publicly on AMD Developer website in August 2008 Preview and Prepare for Direct3D 11 Support across most APIs gives you best bang for the buck for this feature Support on Windows XP as well as Vista PC versions can use Xbox 360 native features Reach more players Developing artwork takes time Integrating tessellation early gives you and your artists time to design and polish Xbox 360 / DirectX 9 Pipeline
Input Assembler
Vertex Shader sources e R /