Skip to content

Rendering

HxEngine renders with a deferred + forward, physically based (PBR) pipeline on Direct3D 11 (via Vortice). Rendering code is written against an internal RHI (render hardware interface), keeping the door open for future backends.

Each camera is rendered through a fixed sequence of passes:

  1. Shadow pass — cascaded shadow maps (4 cascades) for directional light, plus cube-map shadows for point lights.
  2. G-Buffer pass — opaque geometry into multiple render targets + depth, including a velocity buffer (for TAA / motion blur) and a Hi-Z depth chain (for SSR / AO).
  3. Deferred lighting — Cook-Torrance PBR, up to 16 dynamic lights.
  4. Sky pass — procedural Rayleigh + Mie atmospheric scattering.
  5. Forward pass — transparent geometry and VFX.
  6. Post-processing — a configurable HDR effect chain (see below).
  7. Editor overlays — selection outline, gizmos, debug draw and grid.

Post-processing runs in HDR before the final tone-map to LDR. The chain is configurable; available effects include:

  • Auto-exposure / eye adaptation — luminance-driven exposure.
  • Bloom — threshold → multi-level downsample → blur → upsample.
  • Tone mapping — ACES filmic (also Reinhard / filmic variants) + gamma.
  • Color grading.
  • Screen-space reflections (SSR) — Hi-Z–assisted ray marching with roughness blend.
  • Depth of field — circle-of-confusion based, with bokeh/hex blur.
  • Motion blur — using the velocity buffer.
  • God rays / light shafts — radial sun-shaft pass.
  • Fog.
  • Chromatic aberration, vignette, film grain.
  • Anti-aliasing — TAA (velocity-based), with FXAA as a fallback.
  • Custom post-process materials — write your own screen-space effect in HLSL.

The game thread builds an immutable frame snapshot; a dedicated render thread records command buffers and presents:

Game thread: build frame → submit snapshot
Render thread: execute → record command buffers → present

A SAH-built BVH drives frustum culling for larger scenes, with a linear scan for small ones, and per-cascade culling for shadows.

Shaders are authored in HLSL (Shader Model 5.0). Materials plug custom HLSL into the pipeline through the material system.