Skip to content

GPU Renderer

Yahasi edited this page Jul 6, 2026 · 1 revision

🌐 English · Русский

← Rendering & Lighting · Self-Tests →

GPU Renderer

Nova has an optional GPU raytracer built on ILGPU. It casts every primary, shadow, and lighting ray on the graphics card, at full feature parity with the CPU renderer.

Requirements & selection

  • An NVIDIA GPU (CUDA) is preferred; the renderer also runs on any OpenCL device. If neither is present it uses ILGPU's managed CPU accelerator, so it still runs headless (that's how gputest runs on CI).
  • Select it per world in the Create world dialog: Renderer: CPU / GPU (NVIDIA) (it's stored as graphics.renderer in the world JSON — "cpu" default, "gpu").
  • If a world asks for GPU but no usable GPU is present, it transparently falls back to the CPU renderer.

Feature parity

The GPU path matches the CPU renderer feature-for-feature:

  • Front-to-back transparency (depth peeling).
  • Every light kind — point / directional / spot / area.
  • Spot beam fans and circle / square / triangle cone shapes.
  • Area soft shadows, and alpha-correct shadows (transparent occluders attenuate; opaque blocks fully).
  • PNG textures — the GPU samples the identical texel bit-for-bit (nearest / bilinear / mipmapped kept in lockstep with the CPU). See Textures.

The gputest self-test renders fixed scenes on both paths and compares pixel-by-pixel: with shadows off every feature is deterministic and must match exactly (Δ≈0); with shadows on only a thin shadow-boundary band may differ.

Acceleration & the F3 BVH toggle

The GPU mirrors the CPU's two-level BVH: each mesh's local-space vertices, faces, and a flattened stackless BVH are built once and uploaded once; the kernel transforms each ray into the object's local space and traverses that object's tree, then rotates the result back to world space (spheres stay analytic). Only the small per-frame data (object transforms, spheres, lights) travels each frame.

F3 toggles the BVH on the GPU too (a perf demo): with the BVH on the kernel traverses the tree; with it off it brute-forces every triangle. Because a BVH only prunes which triangles are tested — never the closest-hit result — the rendered output is identical in both states (only FPS differs). gputest asserts GPU == CPU in both states, and that the GPU BVH-on frame equals the GPU BVH-off frame bit-for-bit.

Architecture note

All GPU / ILGPU code lives in the separate Nova3DVisualiser.Gpu project, so the engine library stays dependency-free. The engine feeds the GPU a value-only scene snapshot with no ILGPU types. See Project Structure.

Clone this wiki locally