Introduction
While modern GPUs are highly optimized for ray tracing triangle meshes, rendering procedural geometry—shapes defined by mathematical equations rather than vertex lists—remains a significant hurdle. Procedural primitives, such as fractals or Constructive Solid Geometry (CSG) objects, require custom intersection shaders and complex management of the DirectX RayTracing (DXR) API. Proceduray is a lightweight C++ engine designed to simplify this "black magic" by providing a mid-level abstraction that balances developer productivity with the flexibility required for complex non-triangle rendering.
System Architecture
Proceduray introduces several design choices to tame the complexity of the DXR API, specifically targeting the management of shader tables and resource synchronization.
Shader Compatibility and Type Safety
A primary challenge in graphics programming is maintaining synchronization between host-side (C++) and device-side (HLSL) data structures. Proceduray centralizes "Plain Old Data" (POD) structs, such as ray payloads and root arguments, ensuring both sides remain in sync. By leveraging C++17 variants, the engine provides type-safe resource management, reducing the risk of invalid memory access on the GPU.
Decoupled Shader Tables and Acceleration Structures
The engine simplifies the DXR indexing formula—$a = h_s + h_p * (r + m * g + i)$—which is often a source of confusion for developers. By allowing users to define shader table entries as flexible tuples (Ray ID, Hit Group ID, Local Root Signature ID, and Root Arguments), the engine makes variables like ray type ($r$) and geometry contribution ($g$) intuitive to configure. Furthermore, Proceduray automatically handles the creation of Bottom-Level Acceleration Structures (BLAS) for procedural geometry using Axis-Aligned Bounding Boxes (AABBs).
Results and Evaluation
The engine's capabilities are demonstrated through the real-time rendering of mathematically defined procedural scenes. Procedural geometry offers significant memory efficiency; because the surface is calculated on-the-fly, it requires far less VRAM than a high-density triangle mesh representing the same complex fractal.
The authors evaluate the engine using various primitives, including CSG "Pac-man" shapes and complex 3D fractals like Julia sets and Mandelbulbs. Proceduray's robustness is highlighted by its use in generating sample code for the Ray Tracing Gems 2 book, proving its utility for high-quality fractal exploration and rendering.
Conclusion and Future Work
Proceduray serves as both a functional tool and a didactic reference for developers navigating the DXR API. While the current implementation is specific to DirectX 12, future work includes investigating Vulkan support and extending the engine to handle Neural Implicits and non-Euclidean geometry via curved rays.
Summary updated