deferred shading
play

Deferred Shading Rasmus Vahtra, Andres Traks Forward rendering - PowerPoint PPT Presentation

Deferred Shading Rasmus Vahtra, Andres Traks Forward rendering (non-deferred shading) Forward rendering (non-deferred shading) Forward rendering (non-deferred shading) Forward rendering (non-deferred shading) Depth culling Forward


  1. Deferred Shading Rasmus Vahtra, Andres Traks

  2. Forward rendering (non-deferred shading)

  3. Forward rendering (non-deferred shading)

  4. Forward rendering (non-deferred shading)

  5. Forward rendering (non-deferred shading) Depth culling

  6. Forward rendering (non-deferred shading)

  7. Forward shader: Vertex Shader (VS) VS PS

  8. Forward shader: Pixel Shader (PS) VS PS

  9. Complexity of forward rendering For each light: For each object: Render() Blend results together

  10. Deferred shading Shading done in a separate rendering pass Pass 1: Render object data into buffers Pass 2: Do lighting/shading VS VS PS PS

  11. Deferred shading: 1) collect data into intermediate textures

  12. Deferred shading: 1) collect data into intermediate textures

  13. Deferred shading: 1) collect data into intermediate textures Depth culling

  14. Deferred shading: 1) collect data into intermediate textures, done Don’t care about geometry anymore

  15. Deferred shader: Vertex Shader (pass 1) VS PS

  16. Deferred shader: Pixel Shader (pass 1) VS PS

  17. Deferred shading: 1) collect data into intermediate textures, done

  18. Deferred shading: 2) Draw a full-screen quad UV = (0, 0) (1, 0) (0, 1) (1, 1)

  19. Deferred shader: Pixel Shader (pass 2)

  20. Review VS PS Forward rendering: Deferred shading: VS VS PS PS

  21. Complexity of deferred rendering For each object: Render geometry data Then shade each pixel on screen exactly once

  22. Deferred shading: VS Pass 2) Draw a full-screen quad VS PS ID TexCoord Position 0 (0, 0) (-1, 1, 0, 1) 1 (1, 0) (1, 1, 0, 1) 2 (0, 1) (-1, -1, 0, 1) 3 (1, 1) (1, -1, 0, 1)

  23. Full screen triangle UV = (1, 0) (2, 0) (0, 0) (0, 1) (1, 1) A bit faster than a quad (0, 2)

  24. G-buffer R G B A Diffuse RGB - Normal XYZ - Depth (32-bit) β€’ 1920 x 1080 x 3 x 32 bits = 24 MB

  25. G-buffer: extra attributes Battlefield 3 Killzone 2

  26. Packing normals π‘œ. 𝑦 2 + π‘œ. 𝑧 2 + π‘œ. 𝑨 2 = 1 Works only with normalized view-space normals! http://aras-p.info/texts/CompactNormalStorage.html

  27. Anti-aliasing Edge-detect Blur if edge detected http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter09.html

  28. Transparent objects? Render them after the deferred pass using forward shading

  29. Deferred lighting

  30. Modifying the G-buffer for deferred lighting R G B A Diffuse RGB - Normal XYZ - Depth (32-bit) Light Accumulation RGB -

  31. Deferred lighting: G-Buffer

  32. Light Stencil Volumes Each point light area is bounded by a sphere (approximate)

  33. Light Stencil Volumes Each point light area is bounded by a sphere (approximate)

  34. Light Stencil Volumes Each point light area is bounded by a sphere (approximate)

  35. Stencil shapes of lights Sphere Cone Fullscreen quad Fullscreen quad http://www.okino.com/new/toolkit/1-14.htm

  36. Other effects: Screen Space Ambient Occlusion (SSAO) http://john-chapman-graphics.blogspot.co.uk/2013/01/ssao-tutorial.html

Recommend


More recommend