DXR Acceleration Structure Rebuild vs Update

In DirectX Raytracing (DXR), managing acceleration structures is critical for balancing GPU execution time and ray tracing performance. This article explains the technical differences between rebuilding and updating acceleration structures—specifically Bottom-Level (BLAS) and Top-Level (TLAS) structures—evaluating the trade-offs between construction overhead, memory consumption, and ray traversal efficiency to help you determine the optimal strategy for dynamic scenes.

Understanding Acceleration Structures in DXR

DirectX Raytracing uses a two-level bounding volume hierarchy (BVH) system:

  • Bottom-Level Acceleration Structure (BLAS): Contains actual geometric data (triangles or procedural primitives).
  • Top-Level Acceleration Structure (TLAS): Contains references (instances) to one or more BLAS instances, along with transform matrices and shader identifier offsets.

When objects move, deform, or are added/removed from a scene, these structures must reflect those changes. DXR provides two primary paths to reflect scene modifications: a full rebuild or an in-place update.

Acceleration Structure Rebuild

A rebuild constructs the BVH from scratch using the current geometric data or instance definitions.

How It Works

The application allocates sufficient scratch and result memory and invokes BuildRaytracingAccelerationStructure without the update flag. The GPU generates a brand-new tree structure, re-evaluating spatial partitioning and bounding boxes from the ground up.

Advantages

  • Optimal Traversal Performance: Rebuilding generates the highest quality BVH, minimizing bounding box overlap and tree depth. This maximizes ray traversal speed during the dispatch phase.
  • Topology Changes: You can introduce completely new geometry, change vertex or primitive counts, or fundamentally reorganize instances.
  • Memory Efficiency: Does not require the additional memory overhead associated with making an acceleration structure updatable.

Disadvantages

  • High GPU Cost: Rebuilding is computationally expensive, consuming substantial GPU compute cycles and memory bandwidth.

Best Used For

  • Static geometry generated at load time.
  • Objects with changing topologies (such as particle systems or dynamic destruction).
  • Situations where ray traversal performance is heavily prioritized over build time.

Acceleration Structure Update

An update modifies an existing BVH in-place by adjusting bounding boxes without restructuring the fundamental tree topology.

How It Works

To update an acceleration structure, the initial build must be created with the D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_UPDATE flag. Subsequent modifications invoke BuildRaytracingAccelerationStructure with the D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PERFORM_UPDATE flag.

Advantages

  • Speed: Updates are significantly faster to execute on the GPU than full rebuilds, making them suitable for real-time per-frame operations.
  • Lower Overhead: Reduces command list execution latency and memory bandwidth contention.

Disadvantages

  • Degraded Traversal Quality: Because the internal tree nodes are not re-sorted or restructured, large motions can cause bounding boxes to stretch and overlap excessively. Over time, this leads to worse ray traversal times.
  • Strict Constraints: You cannot change primitive counts, vertex counts, or topology. For a BLAS, vertices can only move within the bounds of existing primitives.
  • Memory Overhead: Requiring ALLOW_UPDATE often increases the base memory size of the structure.

Best Used For

  • Slightly deformed geometry, such as character skinning or facial animations.
  • Per-frame updates to TLAS instance transforms when camera or object positions change minimally.

Practical Implementation Strategy

  • TLAS: Because TLAS structures only contain instances and are relatively lightweight, developers frequently rebuild the TLAS every frame rather than updating it, ensuring optimal tree quality with minimal compute cost.
  • BLAS: For dynamic meshes (such as skinned characters), perform updates per frame to save execution time. If the deformation causes severe mesh stretching over time, schedule a periodic full rebuild to restore optimal ray traversal performance.