What Is BLAS in DirectX Raytracing?

Bottom-Level Acceleration Structures (BLAS) are a foundational component of hardware-accelerated ray tracing in DirectX Raytracing (DXR). This article covers the fundamental purpose of a BLAS, how it formats and bounds geometry data, its role within the two-level acceleration structure hierarchy alongside the Top-Level Acceleration Structure (TLAS), and best practices for managing BLAS memory and updates for real-time performance.

The Role of Acceleration Structures

In traditional rasterization, the GPU processes triangles sequentially from the perspective of a camera. Ray tracing, however, requires testing arbitrary rays against millions of triangles from any point and direction in a scene. Testing each ray against every triangle individually is computationally prohibitive.

To solve this, DXR uses Bounding Volume Hierarchies (BVHs), which recursively group geometric primitives inside hierarchical axis-aligned bounding boxes (AABBs). Instead of checking millions of triangles, a ray only tests the bounding boxes it intersects, drastically reducing computational overhead.

What is a Bottom-Level Acceleration Structure (BLAS)?

A Bottom-Level Acceleration Structure is the lowest tier of this BVH hierarchy. While traditional 3D graphics pipelines pass raw vertex and index buffers directly into shaders, DXR requires these buffers to be compiled into a BLAS.

A BLAS directly references and encompasses actual geometric data, such as:

  • Triangle meshes: Polygons defined by vertex, index, and transform buffers.
  • Procedural geometry: Primitives defined by custom AABBs, where ray-surface intersections are calculated using custom intersection shaders (e.g., hair, spheres, or volumetric clouds).

The BLAS stores geometry in local object space rather than world space. Because of this, it represents the physical shape of an individual object or asset, independent of where that object is placed in the game world.

The Two-Level Hierarchy: BLAS vs. TLAS

DXR uses a two-level acceleration structure system to maximize performance and memory efficiency:

  1. Bottom-Level Acceleration Structure (BLAS): Contains the raw mesh data in object space.
  2. Top-Level Acceleration Structure (TLAS): Contains a list of instances that point to various BLAS references. Each instance in the TLAS includes a \(3 \times 4\) transformation matrix, flags, and an instance ID.

This separation enables efficient geometry instancing. For example, a virtual forest can contain thousands of trees with varying positions, rotations, and scales. Instead of generating distinct acceleration structures for each tree, the GPU creates a single BLAS for the tree mesh. The TLAS then instances this BLAS thousands of times using lightweight transform matrices. This saves significant VRAM and allows the GPU to quickly traverse scenes.

Building and Managing BLAS in DXR

Creating a BLAS occurs directly on the GPU using the BuildRaytracingAccelerationStructure API call. The developer provides geometric descriptions (D3D12_RAYTRACING_GEOMETRY_DESC), allocates the required scratch memory for building, and designates the destination GPU buffer.

Key considerations when working with BLAS include:

  • Static vs. Dynamic Geometry: Static objects (such as buildings and terrain) only require their BLAS to be built once during loading. Dynamic objects (such as skinned characters or destructible meshes) require their BLAS to be either refit (updated) or rebuilt entirely each frame.
  • Update vs. Rebuild: Updating a BLAS (D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_PERFORM_UPDATE) is fast because it adjusts the existing bounding boxes without rearranging the tree topology. However, if the topology of the mesh changes significantly, a full rebuild is required to prevent degraded ray traversal performance.
  • Compaction: When a BLAS is initially built, the driver allocates an estimated memory footprint that is often larger than necessary. DXR provides a compaction mechanism that queries the final post-build size and copies the BLAS into a tightly packed memory buffer, significantly reducing overall VRAM consumption.