350 likes | 364 Views
Postmortem: Deferred Shading in Tabula Rasa. Rusty Koonce NCsoft September 15, 2008. Topics Covered. Introduction Background Technical Highlights Performance Player Metrics Demonstration Questions and Answers. Introduction. What is deferred shading?. Introduction.
E N D
Postmortem: Deferred Shading in Tabula Rasa Rusty Koonce NCsoft September 15, 2008
Topics Covered Introduction Background Technical Highlights Performance Player Metrics Demonstration Questions and Answers
Introduction What is deferred shading?
Introduction What is deferred shading? Deferred shading is a technique for lighting a scene as a post process. Typically forward shading is used, where lighting is applied to each vertex or pixel as it is rendered. With deferred shading, material properties about each pixel are rendered and per-pixel lighting is applied as a post process after the scene has been rendered.
Introduction What is Tabula Rasa?
Introduction What is Tabula Rasa? Tabula Rasa is a massively multiplayer online role-playing game. It is set in a near future sci-fi setting, taking the player to alien worlds. The pace of the game is fast and similar to a 3rd person shooter.
Background Engine features wanted by art/design
Background Engine features wanted by art/design Shadows and ability to create dramatic lighting (not necessarily in real-time -- lightmaps were acceptable) Dynamic light support Interior and exterior settings -- with support for mixing both within the same map Support for many objects (players/creatures/NPCs) moving into view at once
Background Constraints
Background Constraints Pre-existing forward shading engine that supported basic dynamic lighting only A lot of art and many shaders already created for existing engine Minimum system requirements of NVidia FX or ATI 9600 class hardware
Background Decision
Background Decision The existing DX9 based engine would be retrofitted to support both forward and deferred shading. Forward shading would be the fallback for lower end hardware, with deferred shading being the preferred render pipeline on higher end hardware. All existing art assets could be leveraged as-is, without the need to update them.
Technical Highlights Benefits of deferred shading
Technical Highlights Benefits of deferred shading Lighting cost is proportional to the number of lights and is not proportional to the geometric complexity of the scene Only visible pixels have lighting computations executed on them Shaders can have lighting computations cleanly separated from the material rendering Depth and material properties such as surface normals become accessible from shaders All lighting is done in real-time. No time required to build precomputed light data in the map build process; designers can see their changes in real-time.
Technical Highlights Issues with deferred shading
Technical Highlights Issues with deferred shading High GPU memory bandwidth utilization High VRAM utilization No hardware FSAA support (DX9) Very limited hardware alpha blending support
Technical Highlights Implementation Detail (Deferred)
Technical Highlights Implementation Detail (Deferred) Material MRT Layout
Technical Highlights Implementation Detail (Deferred) FSAA 1) Fake: Detect edges and blur them 2) Emulation: Super-sample by rendering to a larger render target and then use the hardware to filter the final image down to the desired size
Technical Highlights Implementation Detail (Deferred) Alpha Blending 1) Flora/ground cover rendered with alpha test; scaling is used to transition it in and out 2) Hair is alpha tested; helmets are common place in game 3) Alpha blended geometry is rendered after deferred shading of opaque geometry completes; this blended geometry typically does not receive lighting and if it does it is not exactly the same
Technical Highlights Implementation Detail (Deferred) Shadows 1) All shadows use shadowmaps; every shadow is a true volumetric shadow 2) All lights can cast shadows 3) Artists control if a light casts a shadow if if that shadow updates in “real-time” or not 4) Shadowmap rendering is throttled and done based on light priority 5) The number of shadows active within a single frame is capped
Technical Highlights Implementation Detail (Deferred) Video Memory Management 1) All render targets are allocated before most other resources 2) A shadowmap cache is used; a fixed number of shadowmaps are allocated for the duration of play 3) A render target and depth buffer cache is used
Performance Compatibility
Performance Compatibility Deferred Shading (Our Min Requirements) 256MB VRAM Pixel Shader 3.0 MRT Support (4 simultaneous) Deferred Shading (Recommended Requirements) 320+MB VRAM 50+ GB/s GPU Memory Bandwidth (8800 GT, X1900)
Performance Scalability
Performance Scalability Deferred lighting performance is most closely tied to the GPU memory bandwidth. The more bandwidth, the better the performance. Unlike forward shading, deferred shading performance is significantly tied to the resolution at which the game is played. Fortunately, today's GPUs are catching up. Sub-$200 video cards are offered now by ATI and NVidia that well exceed 50GB/s in memory bandwidth.
Performance NV Perf HUD Profile 8800 GTS (64 GB/s Memory Bandwidth) Max Graphics Settings (FSAA off) 1680 x 1050 Approximate Resolution
Player Metrics Hardware
Player Metrics Hardware
Player Metrics Graphics Settings
Demonstration Hardware: NVidia 9600 GT 512MB (~$120, 57.6 GB/s) Intel Core2 Quad Q6600 @ 2.40 GHz Vista 64 4GB RAM
Questions and Answers Contact Info: Rusty Koonce jrkoonce@yahoo.com