G-buffer / Geometry Lighting Glow / Blur Postprocess Tone Map UI Layers Final Output GEOMETRY Write: color, world pos, material, emissivity → G-Buffer (depth + 4 attachments) GL_RGBA32F (world pos) LIGHTING Full-screen pass reads G-buffer Applies directional/point/spot → Light Buffer (color + glow ch.) Lights uploaded via UBOs PING_PONG_GAUSSIAN Gaussian blur on glow channel Multiple passes, no aliasing → Ping-Pong A ↔ Ping-Pong B Alternating read/write FBOs GLOW Composite blurred glow + damage effects → Glow Buffer Blended onto lit scene ↓ continue POSTPROCESS Effects that sample the already-lit scene → Postprocess Buffer (depth) Has depth attachment TONE_MAP Compress HDR to RGBA Color grading applied → Tone-Mapped FBO UI Text, HUD, menus Screen-fixed elements → On-screen layer No lighting applied ON_TOP_OF_UI Second transparent layer above all UI elements → On-screen layer RENDER_TO_WINDOW Full-screen quad blit Offscreen FBO → display → Window (displayOpenGL) G-Buffer Attachments (4 color + 1 depth) 0: GL_RGBA16F — Color 1: GL_RGBA32F — World Position 2: GL_RGBA16F — Material 3: GL_RGBA16F — Emissivity / Glow 32-bit world pos prevents banding artifacts in point-light distance calculations