LerpworksAcademy
On this page

Graphics › The frame

How an engine draws a frame: passes and the G-buffer

Know first: Shader: a function for every pixel, Surface properties: roughness, metallic, AO, Depth buffer: what is closer to the camera, Transparency: Opaque, Masked, Translucent

A frame in a game is a chain of dozens of passes. Each pass draws its own image, and later passes read it. The chain has one big fork. You can light each object while it is being drawn. Or you can first fill in a form of surface properties for every pixel, the G-buffer, and compute the light afterward. That choice decides how Buffer Visualization works, how glass is lit, and what a hundred lamps cost. This is lesson five of the course “How an engine draws a frame.”

Why this matters

You have already met the depth prepass and the rule that transparent objects are drawn after the opaque ones. This lesson puts the whole frame together. Without that picture, several things stay unexplained:

  • where the Base Color, World Normal, Roughness and Scene Depth images in the Unreal viewport menu come from;
  • why a material has a fixed set of outputs, when a shader could compute anything;
  • why glass gets simpler lighting than the stone beside it, and why a decal does not land on glass;
  • why one engine can switch on a hundred lamps, while in another an object gets no more than eight.

Further in the article

  1. The frame is a chain of passes
  2. Forward rendering: light right away
  3. Deferred rendering: the form first, light later
  4. Why hundreds of lamps are no problem for deferred rendering
  5. What the form costs
  6. The order of the passes
  7. How to read the G-buffer
  8. Where it breaks
  9. Connections: the same idea in other fields
  10. Key points
  11. Test yourself