a ray tracing deep dive
play

SHADOWS OF THE TOMB RAIDER A RAY TRACING DEEP DIVE Holger Gruen (NVIDIA), Jon Story (NVIDIA), Michiel Roza (Nixxes) 03/19/2019 www.nvidia.com/GTC Shadow of the Tomb Raider Shadows of the Tomb Raider Why ray traced shadows?

0 downloads 8 Views 9,49 MB Size Report
  1. DXR SHADERS Translucency Subtraction is order independent: ➢ Let each layer subtract 1/3 of the light ➢ Pixel in full shadow after 3 order independent hits WS Pixel 50

  2. DXR SHADERS Translucency void TranslucentAnyHit(…) { float alpha = GetHitAlpha(bary, PrimID); if( alpha >= g_fAlphaThreshold ) payload.visibility -= ( 1.0f / 3.0f ); if( payload.visibility < 0.01f ) { payload.visibility = 0.0f; AcceptHitAndEndSearch(); } else IgnoreHit(); } 51

  3. Opaque raytraced shadows 52

  4. Translucent raytraced shadows 53

  5. DXR SHADERS Mini Agenda • Noise / random number generation • Ray generation • Hit shaders • Adaptive raytracing • Translucency • TAA and jittering 54

  6. DXR SHADERS TAA + Jittering • Like many games SotTR uses jittered TAA • Each frame adds a ‘random’ subpixel offset to all geometry • Surprisingly this creates problems with flickering shadows! 55

  7. DXR SHADERS TAA + Jittering The red dots are the pixel • centers a 2x2 pixel grid • This is where rasterized geometry is sampled 56

  8. DXR SHADERS TAA + Jittering The intermediate positions Rasterizing a and the grid are shown to 3D quadrangle help understand how 3D positions change across the quad 57

  9. DXR SHADERS TAA + Jittering Jitter somewhat … 58

  10. DXR SHADERS TAA + Jittering • Jittering changes the WS position that is sampled at pixel centers It also changes the depth values at the pixel centers • • Jittering changes the reconstructed world space positions Shadow ray origins jitter as well 59

  11. DXR SHADERS TAA + Jittering Jittered ray positions are not problematic in general, but: • We typically shoot only one ray per pixel Which is equivalent to ‘point sampling‘ of the visibility signal • • Large areas of flat ground are problematic • Vertical jittering leads to large differences in WS positions Also visible with shadow maps but less because of SM filtering • 60

  12. VIDEO 61

  13. DXR SHADERS TAA + Jittering Solutions: 1. Currently we render an extra depth pass without jittering Use non-jittered depth to reconstruct WS ray origins • 2. Future: Render ddx/ddy(1/z_buffer_depth) with depth pass Reconstruct non-jittered depth • Use non-jittered depth to construct WS ray origins • 1/z-buffer-depth is linear in screen space • 62

  14. Shadow of the Tomb Raider “Shadows” of the Tomb Raider Why ray traced shadows? DXR shaders (ray generation) GameWorks spatial denoiser AGENDA DXR acceleration structure Integration in render pipeline Results Future work 63

  15. INPUT / OUTPUT Light Desc Params Visibility HitT GameWorks Spatial Denoiser Edward Liu & Jon Story Normals Depth 64

  16. ISOTROPIC KERNEL 65

  17. ANISOTROPIC KERNEL 66

  18. OVERLAPPING PENUMBRA #1 67

  19. OVERLAPPING PENUMBRA #2 68

  20. BLEEDING ARTIFACTS Need to detect depth boundaries 69

  21. CUSTOMIZED BOUNDARY DETECTION 70

  22. COULD WE DO LESS WORK? 71

  23. PENUMBRA MASK 72

  24. IMPORTANT FEATURES Half resolution denoising Drastically improves performance SOTTR uses this mode for ALL light types MSAA input Depth & Normal buffers supported Still only requires single sample Visibility & HitT buffers Produces MSAA shadow mask Sub-viewports supported for local light sources Just need to figure out screen area affected 73

  25. Shadow of the Tomb Raider “Shadows” of the Tomb Raider Why ray traced shadows? DXR shaders (ray generation) GameWorks spatial denoiser AGENDA DXR acceleration structure Integration in render pipeline Results Future work 74

  26. BLAS “a mesh” struct D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC { DXGI_FORMAT IndexFormat; DXGI_FORMAT VertexFormat; Vertex and index buffers for each geometry UINT IndexCount; UINT VertexCount; Straightforward for static geometry D3D12_GPU_VIRTUAL_ADDRESS IndexBuffer; D3D12_GPU_VIRTUAL_ADDRESS VertexBuffer; } 75

  27. BLAS #if ExportVertexBuffer RWStructuredBuffer<float3> OutVertexBuffer; What about skinned objects #endif VertexOutput main( and vertex animations? in VertexInput vi, uint vertID : SV_VertexID) { Each vertex needs to be fully transformed! VertexOutput vo; %ShaderGraph% Foundation Engine uses shader graphs #if ExportVertexBuffer OutVertexBuffer[vertID] = vo.OutPosition; Added a shader permutation in VS template for #endif exporting a transformed vertex buffer return vo; } Run a pass for all dynamic objects before building 76

  28. Skinning gone wrong: Inner demon ☺ 77

  29. BLAS Lara’s hair PureHair, an evolution of TressFX Simulates control points Renders strands of hair as camera facing quads Everything needs to be actual geometry in the AS Make the simplest cylinder possible for every strand 78

  30. BLAS Rebuild/refit strategy Two modes of updating dynamic BLASes in DXR: Rebuild, essentially “replacing” the old one (~ 100M tris/sec) Refit, for “small” model changes (~ 1000M tris/sec, 10x as fast!) Catch: ray trace performance might degrade! Top refitting throughput only for large enough workloads We chose to always refit BLAS unless # vertices change 79

  31. TLAS “A scene” struct D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS Static BLASes can be instanced { UINT NumDescs; D3D12_GPU_VIRTUAL_ADDRESS InstanceDescs; Always rebuilding TLAS seems to be fast enough } (<1ms) 80

  32. ACCELERATION STRUCTURE About LODs of meshes Every LOD level is stored in a separate BLAS Using LOD 0 for everything caused self-shadowing artifacts! Just use the same LOD we use for rendering What about LOD fading? Use “most visible” LOD 81

  33. Shadow of the Tomb Raider “Shadows” of the Tomb Raider Why ray traced shadows? DXR shaders (ray generation) GameWorks spatial denoiser AGENDA DXR acceleration structure Integration in render pipeline Results Future work 82

  34. RENDER PIPELINE Forward+ renderer Shadow map Shadow Forward Depth pass pass resolve opaque pass 83

  35. RENDER PIPELINE Now with ray traced shadows! Depth pass (Ray traced) Vertex Shadow map Forward Build AS Jittered/ Shadow transform pass opaque pass Non jittered resolve 84

  36. RENDER PIPELINE Now with ray tracing! 0.5ms 4ms 2ms 3ms 3ms 5ms Depth pass (Ray traced) Vertex Shadow map Forward Build AS Jittered/ Shadow transform pass opaque pass Non jittered resolve 85

  37. RENDER PIPELINE 0.5ms 4ms 2ms 3ms 3ms 5ms Depth pass (Ray traced) Vertex Shadow map Forward Build AS Jittered/ Shadow transform pass opaque pass Non jittered resolve Can run async with depth and shadow map passes! ☺ 86

  38. RENDER PIPELINE Async compute 0.5ms 2ms 3ms 5ms 3ms Depth pass Vertex (Ray traced) Forward opaque Jittered/ Shadow map pass Shadow resolve pass transform Non jittered Build AS 4ms completely hidden! 87

  39. WHY DO WE STILL NEED SHADOW MAPPING? Translucent rendering Translucent rendering has no depth write Can’t use shadow resolve pass! We cannot shoot rays from pixel shaders 88

  40. WHY DO WE STILL NEED SHADOW MAPPING? Performance! Updating entire scene full of dynamic objects costs up to 20ms of BLAS refits  AS culling using existing shadow map culling 89

  41. WHY DO WE STILL NEED SHADOW MAPPING? Performance! For directional lights: Replace only nearest cascades with ray traced shadows For local lights: Distance based fade to shadow map How do we choose these distances? 90

  42. ARTIST TOOLS Let lighting artists decide! 91

  43. Shadow of the Tomb Raider “Shadows” of the Tomb Raider Why ray traced shadows? DXR shaders (ray generation) GameWorks spatial denoiser AGENDA DXR acceleration structure Integration in render pipeline Results Future work 92

  44. No point light shadows 93

  45. Raytraced point light shadows 94

  46. Shadow mapped area light shadows 95

  47. Raytraced area light shadows 96

  48. Shadow mapped sun light shadows 97

  49. Raytraced sun light shadows 98

  50. Shadow of the Tomb Raider “Shadows” of the Tomb Raider Why ray traced shadows? DXR shaders (ray generation) GameWorks spatial denoiser AGENDA DXR acceleration structure Integration in render pipeline Results Future work 99

  51. FUTURE WORK Reconstruct non-jittered depth Ray traced shadows on translucent geometry Tessellation Content authoring with ray tracing in mind Use vertex transform pass for rasterization as well GI / Reflections / AO / … ? 100

Recommend Documents


deep dive deep dive int into o seo seo
DEEP DIVE DEEP DIVE INT INTO O SEO

DEEP DIVE DEEP DIVE INT INTO O SEO SEO Private and Confidential. Property

datapower datapower mq integration mq integration deep
DataPower DataPower-MQ Integration MQ

DataPower DataPower-MQ Integration MQ Integration Deep Dive Deep Dive

rtgen agc iccp deep dive
RTGEN (AGC) & ICCP Deep Dive

RTGEN (AGC) & ICCP Deep Dive February 23, 2012 Shari Brown and Matt Beck

a deep dive into the dark web
A Deep Dive into the Dark Web Coen

A Deep Dive into the Dark Web Coen Schuijt UvA OS3 February 5 th , 2019

next generation aco model
Next Generation ACO Model Open Door

Next Generation ACO Model Open Door Forum: Financial Deep Dive March 31,

a deep dive into the
A Deep Dive into the kude@ga.co Shi

Stes Bais sen.bais@ga.co Kut el A Deep Dive into the kude@ga.co Shi Oku

interactive deep dive
Interactive Deep-dive : Visualizing

Interactive Deep-dive : Visualizing Terrorism Data Ella Kim, Leah Kim

advanced ray tracing
Advanced Ray Tracing 1 2/8/2006

Advanced Ray Tracing 1 2/8/2006 Distributed Ray Tracing Distributed ray

2019 system goals deep dive data
2019 System Goals Deep-Dive Data

2019 System Goals Deep-Dive Data Carmelo Barbaro Executive Director, Poverty

using the assessment findings to dive headfirst into the
Using the Assessment Findings to Dive

NO PLACE FOR KIDS Using the Assessment Findings to Dive Headfirst into the

warning
WARNING Learners, please complete the

WARNING Learners, please complete the Learner Survey

housing repairs discovery
HOUSING REPAIRS DISCOVERY DEFINING A

HOUSING REPAIRS DISCOVERY DEFINING A COMMON SERVICE PATTERN CLIENTS:

headache in the clinic
Headache in the Clinic Mark Slootsky

Headache in the Clinic Mark Slootsky PGY-2 Background 50% adult population

structuring direct lending funds open ended vs private
Structuring Direct Lending Funds:

Presenting a live 90-minute webinar with interactive Q&A Structuring

choos oosing ing specific ific therapeutic rapeutic
CHOOS OOSING ING SPECIFIC IFIC

CHOOS OOSING ING SPECIFIC IFIC THERAPEUTIC RAPEUTIC STRATEGIES TEGIES IN

luts a plea for a holistic
LUTS A plea for a holistic approach.

LUTS A plea for a holistic approach. HUBERT GALLAGHER, MCh; FRCSI,

the elusive perfect mouse model
The (elusive) perfect mouse model Tom

The (elusive) perfect mouse model Tom Cooper, M.D. Department of Pathology

nutrition
Nutrition Supplements Jennifer Click

Nutrition Supplements Jennifer Click Redlich MS, RD, CSO, LDN Natural

diabetes how to fight an epidemic
Diabetes: how to fight an epidemic

Oxford Splash 2019 Diabetes: how to fight an epidemic Matthew Lloyd Lesson

identification and characterization of molecular nature
Identification and characterization of

Department of Physics, Chemistry and Biology Final Thesis Identification and

series
SERIES Professional Education units

American Association of Diabetes Educators Provider is accredited as a

insulin
Insulin Speakers Dr Roni Saha ,

Insulin Speakers Dr Roni Saha , Consultant Diabetologist, St Georges Hospital