Proceduray - A light-weight engine for procedural primitive ray tracing

Vinícius da Silva, Tiago Novello, Hélio Lopes, Luiz VelhoarXiv 2020 · arXiv

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).

Overview of the Acceleration Structure hierarchy and its mapping to the Shader Table.

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.

A sample scene rendered in real-time featuring procedural CSG objects and complex 3D fractals.

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

Abstract

We introduce Proceduray, an engine for real-time ray tracing of procedural geometry. Its motivation is the current lack of mid-level abstraction tools for scenes with primitives involving intersection shaders. Those scenes impose strict engine design choices since they need flexibility in the shader table setup. Proceduray aims at providing a fair tradeoff between that flexibility and productivity. It also aims to be didactic. Shader table behavior can be confusing because parameters for indexing come from different parts of a system, involving both host and device code. This is different in essence from ray tracing triangle meshes (which must use a built-in intersection shader for all objects) or rendering with the traditional graphics or compute pipelines. Additionals goals of the project include fomenting deeper discussions about DirectX RayTracing (DXR) host code and providing a good starting point for developers trying to deal with procedural geometry using DXR.
BibTeX
@misc{silva2020proceduray,
  author = {Vinícius da Silva and Tiago Novello and Hélio Lopes and Luiz Velho},
  title = {{Proceduray - A light-weight engine for procedural primitive ray tracing}},
  year = {2020},
  eprint = {2012.10357},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2012.10357},
}
Figure