Color legend method
One instance as the GPU reads it: its inverse matrix, where its BLAS is in the shared node buffer, and its flags.
A struct of public fields, 64 bytes, sent to the GPU byte for byte: GpuInstance in RayTraversal.fxh declares the same eight fields in the same order. The GpuAccelerationStructure makes one per instance from its TlasInstance; you don’t need to make these. The BVH page shows it in context.
Names are colored by what they are: a method; values and fields keep the plain color.
Fields
BlasNodeEnd →
int · One past the BLAS’s last node in the shared node buffer: where the walk of the instance’s BLAS stops, which has no stack to run out of.
BlasNodeOffset →
int · The BLAS’s root in the shared node buffer, as an absolute index.
Flags →
int · The instance’s RayTracingFlags, as an int: HLSL has no enums.
Pad →
int · Padding, 0, which makes the struct four whole 16-byte rows.
WorldInverseW →
Vector3 · The fourth row of the inverse matrix: where the world’s origin lands in the mesh’s space.
WorldInverseX →
Vector3 · The first row of the inverse matrix: where the world’s X axis lands in the mesh’s space. A world point p lands at p.X * WorldInverseX + p.Y * WorldInverseY + p.Z * WorldInverseZ + WorldInverseW, and a direction the same without the last term, as Vector3.Transform and Vector3.TransformNormal would take them.
WorldInverseY →
Vector3 · The second row of the inverse matrix: where the world’s Y axis lands in the mesh’s space.
WorldInverseZ →
Vector3 · The third row of the inverse matrix: where the world’s Z axis lands in the mesh’s space.
Methods
GpuInstance() →
GpuInstance(in Matrix worldInverse, int blasNodeOffset, int blasNodeEnd, RayTracingFlags flags) · The record of an instance: the inverse matrix’s four rows, its fourth column left out, which an affine inverse doesn’t need.
| Parameter | Type | Description |
|---|---|---|
worldInverse |
Matrix |
The instance’s WorldInverse. |
blasNodeOffset |
int |
Its BLAS’s root in the shared node buffer. |
blasNodeEnd |
int |
One past its BLAS’s last node. |
flags |
RayTracingFlags |
Its flags. |