Skip to main content

Rendering Subsystem

Pipeline overview

Glitter uses a deferred PBR rendering pipeline over Vulkan with VMA-managed GPU memory.

PassDescription
G-Buffer4 MRTs: position, normal+AO, albedo+roughness, emissive+metallic
Shadow maps4-cascade CSM (directional) + omnidirectional cubemap shadows (point lights)
IBLIrradiance map + pre-filtered specular + BRDF LUT split-sum (Fdez-Aguera multi-scattering)
Deferred lightingDirectional + point + spot lights with Cook-Torrance PBR BRDF
Reflection probesPer-probe cubemaps, nearest-probe selection, global fallback
Forward passTransparent / alpha-masked objects rendered after deferred lighting
Post-processingACES Hill tonemapping, exposure, FXAA
Debug channelsReal-time visualisation of individual G-Buffer channels (albedo, normals, roughness, metallic, AO, etc.)

Vulkan backend

The engine uses Vulkan as its sole rendering backend (minimum Vulkan 1.1). GPU capabilities are enumerated before device selection, preferring discrete GPUs.

Key Vulkan features used:

  • VMA (Vulkan Memory Allocator) — all GPU memory allocation goes through VMA; no manual vkAllocateMemory calls
  • Push descriptors — for frequently-changing per-draw bindings
  • Shader demote to helper invocation — for PBR shader anti-aliasing
  • GPU capability enumeration — device selection based on feature support

Renderer registry

Renderers are registered via assemblyRegistration() after logging is configured. The active renderer is selected from engine.config.json with a fallback to the default. Adding a new renderer requires only its registration — no changes to the engine core.

Shader system

All shaders are written in Slang and compiled to SPIR-V at load time. Shader configuration is managed through JSON descriptor files. See the dedicated Shader System page for details.

Debug channel viewer

The Vulkan renderer includes a debug channel viewer accessible via the developer console. When a debug channel is active, tonemapping and gamma correction are bypassed to show raw G-Buffer data.

ChannelContent
AlbedoBase colour from the G-Buffer
NormalsWorld-space normals
RoughnessRoughness channel
MetallicMetallic channel
AOAmbient occlusion
EmissiveEmissive output
PositionWorld-space position