Skip to content

Note about "Deferred Shading"

Yaochuang edited this page Jan 6, 2019 · 9 revisions

Deferred rendering

  • Problems of Lighting
    • It may waste time on fragments which not not actually visible.
    • It may waste time on objects which is out of the reach of the light.
    • The complexity is high: N objects X M lights. It becomes worse if there is heavy pixel shading.
  • Key points in Deferred Rendering
    • Lighting calculations would be performed in image space to reduce complexity.
    • Only ran on fragments that ended up as pixels in the final back buffer.
    • It is a way to make real-time lighting a kind of post-processing effect.
    • Deferred rendering is a multi-pass rendering algorithm.
      • G-Buffer, storing info like Position, Normal, Tex which are needed in Lighting Pass.
    • It may be implemented as frame buffer with multiple attachments in OpenGL.
  • Positives of Deferred Shading
    • Easy for screen space ray-tracing.
    • Easy for applying shadow.
    • Easy for Area Lighting.
  • Negatives in Deferred Rendering
    • This post summarize the defects of Deferred Shading.
    • massive bandwidth consuming by G-Buffer.
    • Hard for Alpha blend, for example transparent objects, so how UE4 handle this issue ?
    • Hard for MSAA.
    • Material limitation by G-Buffer.

Frame Buffer in OpenGL

  • OpenGL FBOs support multiple rendering targets
    • That is, a single fragment shader can write to multiple colour attachments.
    • The number of attachments supported is dependent on graphics hardware, may be as many as 8 attachments.
    • The beauty of multiple render targets is that whatever information you think you might need, you can get on a per-pixel basis, and store into a texture.
    • Example of rendering to multiple target
      • Store scene’s normal on a per-pixel basis, in order to process them later.
      • Write fragments above a certain luminance to a separate render target in order to blur them later.
    • Constraints of OpenGL FBO's attachments
      • Attachments cannot be of a compressed type.
      • All of the attachments must be of the same dimensions.
    • Tutorial-Post-Processing@research.ncl.ac.uk

Reference

Clone this wiki locally