Ptex and Vector Displacement in AMD Demos
Karl HilleslandMember of Technical Staff, AMD
Ptex Showings
●September 2011 – Press Event●Siggraph Asia 2011 – Sketch●Radeon HD 7970 Launch – Press Event
● Modified GL version, won’t discuss
Ptex
Ptex: Per-face Texture Mapping for Production Rendering[Burley and Lacewell, 2008]
● No UV setup (it’s implicit)● No Seams● Per-Patch Resolution Control● Out-of-core Performance Advantages
Ptex
Ptex: Per-face Texture Mapping for Production Rendering[Burley and Lacewell, 2008]
●Per-face textures + MIPs●Adjacency for filtering
McDonald and Burley
Per-face texture mapping for real-time rendering, McDonald and Burley, SIGGRAPH 2011 Talk.
Practical Ptex for Games, John McDonald, Game Developer Magazine, January, 2012
Borders for Filtering
Face A Texture Face B Texture
Kernel
Note: Quad centric
Borders for Filtering
Borders for Filtering
Borders for Filtering
Packed Ptex
Pack in one texture● Includes all MIPs● Sorted by resolution
Runtime Shader●Compute atlas location starting with primitive ID and face UV
Runtime Shader●Compute desired resolution using ddx and ddy of face UV
Runtime Shader●Compute desired resolution using face UV●Clamp to base resolution
Runtime Shader●Compute desired resolution using face UV●Clamp to base resolution●Find resolution block
Runtime Shader●Compute desired resolution using face UV●Clamp to base resolution●Find resolution block●Find face location
Runtime Shader●Compute desired resolution using face UV●Clamp to base resolution●Find resolution block●Find face location● Incorporate face UV for
final UV
Constant Buffers●Indexed by resolution●Row (V) offset
● Block location
●Prefix Sum● Face resolution● Offset in bin
●Ours: 20 4-byte values
BaseCount
Prefix Sum
16 x 16 5 5
32 x 32 5 10
64 x 64 3 13
Preprocess
●Sort primitives by resolution●Generate packed textures●Generate constant buffers
● Prefix sum of resolution count● Row (V) offset for each resolution
Texture Compression
●Start with at least 2x2●2-texel border to get mulitple of 4x4●Prevents compression across faces
Authoring Vector Displacement
●Author base mesh●Subdivide and edit●Export Displacement from base
Vector Displacement Without Seams●Preprocessing
● Border values match● Corners match
●Runtime● Constant tessellation for now
Demos
Time Cost – Displaced Leo● 1920 x 1200 ● Albedo, AO, Spec, Normal● Radeon HD 7970● Wall Clock
●Average frame time: 1.3 ms●Average frame cost: ~10 microseconds
● Perf Query●Average frame time: 2.8 ms●Average frame cost: 0.6 ms
Space Efficiency
37% Black 7% Black9-23% Borders
Problems
●GS or Tessellation for per-face UVs●Some sorting restrictions
● Indirection solves that at a cost●Anisotropic cost●Ties between geometry and texture●Quads only so far
Conclusion
●Can actually save memory●Computationally cheap●Most promising for seamless displacement
Top Related