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.
Frame pipeline
Section titled “Frame pipeline”Each camera is rendered through a fixed sequence of passes:
- Shadow pass — cascaded shadow maps (4 cascades) for directional light, plus cube-map shadows for point lights.
- 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).
- Deferred lighting — Cook-Torrance PBR, up to 16 dynamic lights.
- Sky pass — procedural Rayleigh + Mie atmospheric scattering.
- Forward pass — transparent geometry and VFX.
- Post-processing — a configurable HDR effect chain (see below).
- Editor overlays — selection outline, gizmos, debug draw and grid.
Post-processing stack
Section titled “Post-processing stack”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.
Threaded rendering
Section titled “Threaded rendering”The game thread builds an immutable frame snapshot; a dedicated render thread records command buffers and presents:
Game thread: build frame → submit snapshotRender thread: execute → record command buffers → presentCulling & spatial indexing
Section titled “Culling & spatial indexing”A SAH-built BVH drives frustum culling for larger scenes, with a linear scan for small ones, and per-cascade culling for shadows.
Shaders
Section titled “Shaders”Shaders are authored in HLSL (Shader Model 5.0). Materials plug custom HLSL into the pipeline through the material system.