How Krypton Works

Describes how Krypton works, compares it to how other engines generally work, and describes the advantages and disadvantages of Krypton's method.

Light Map Generation Pipeline

The processing done by the CPU and GPU which is required to render light maps

Other Engines:

If you’ve seen the conventional way developers are used to creating 2d shadow geometry, you’ll be familiar with the shadow generation pipeline:
  • CPU (once)
    • Generate shadow hull geometry
  • CPU (each frame)
    • Set shadow hull and light position (game logic)
    • Transform shadow hull's into world-space
    • Generate shadow geometry based on the back-facing sides of shadow hulls *
  • GPU (each frame)
    • Swap render target **
    • Draw shadow hulls to a render target (once per light)
      • Swap render target **
      • Draw light texture to temporary render target
      • Draw shadow geometry to temporary render target
      • Swap render target **
      • Draw temporary render target additively to the final light map **
    • Swap render target **
    • Final light map is multiplicatively drawn to the scene

* - CPU bottleneck
** - GPU bottleneck

Krypton:

Krypton takes a different approach to generating 2d shadows and light maps:
  • CPU (once)
    • Generate stretchable shadow hull geometry
  • CPU (each frame)
    • Set shadow hull and light position (game logic)
    • Transform shadow hull's into world-space
  • GPU (each frame)
    • Swap render target **
    • Draw shadow hulls to a render target (once per light)
      • Clear Stencil Buffer
      • Pass 1: Draw shadow's to the stencil buffer
      • Pass 2: Draw light texture additively to the render target
    • Swap render target **
    • Final light map is multiplicatively drawn to the scene

* - CPU bottleneck
** - GPU bottleneck

Advantages and Disadvantages of Krypton's method

  • Advantages
    • Speed & Efficiency
    • High number of lights and shadow hulls
    • Reduces CPU load
    • Reduces memory re-allocation
  • Disadvantages
    • Cannot generate penumbra-style soft shadows
    • Post-processing cannot be applied per-light

Last edited Aug 5, 2011 at 1:56 AM by djdindak, version 4

Comments

No comments yet.