Struct ProceduralInstanceDesc
Parameters used to configure the creation of procedural instances that are part of a IRayTracingAccelStruct.
Inherited Members
Namespace: UnityEngine.Rendering.UnifiedRayTracing
Assembly: Unity.UnifiedRayTracing.Runtime.dll
Syntax
public struct ProceduralInstanceDesc
Constructors
ProceduralInstanceDesc(GraphicsBuffer, uint)
Creates a ProceduralInstanceDesc.
Declaration
public ProceduralInstanceDesc(GraphicsBuffer aabbBuffer, uint aabbCount)
Parameters
| Type | Name | Description |
|---|---|---|
| GraphicsBuffer | aabbBuffer | The GraphicsBuffer that defines a list of axis-aligned bounding boxes (AABBs). |
| uint | aabbCount | The number of AABBs Unity uses when you build the acceleration structure for this ray tracing instance. |
Fields
aabbBuffer
The GraphicsBuffer that defines a list of axis-aligned bounding boxes (AABBs).
Declaration
public GraphicsBuffer aabbBuffer
Field Value
| Type | Description |
|---|---|
| GraphicsBuffer |
Remarks
The buffer must remain valid until Build(CommandBuffer, GraphicsBuffer) is called. You retain ownership of this buffer and are responsible for its disposal.
aabbCount
The number of AABBs Unity uses when you build the acceleration structure for this ray tracing instance.
Declaration
public uint aabbCount
Field Value
| Type | Description |
|---|---|
| uint |
instanceID
Instance identifier. Can be accessed in the HLSL via the instanceID member of Hit (Hit is returned by the TraceRayClosestHit/TraceRayAnyHit HLSL functions).
Declaration
public uint instanceID
Field Value
| Type | Description |
|---|---|
| uint |
localToWorldMatrix
The transformation matrix of the instance.
Declaration
public Matrix4x4 localToWorldMatrix
Field Value
| Type | Description |
|---|---|
| Matrix4x4 |
mask
The instance mask.
Declaration
public uint mask
Field Value
| Type | Description |
|---|---|
| uint |
Remarks
Instances in the acceleration structure contain an 8-bit user defined instance mask. The TraceRayClosestHit/TraceRayAnyHit HLSL functions have an 8-bit input parameter, InstanceInclusionMask which gets ANDed with the instance mask from any instance that is a candidate for intersection during acceleration structure traversal on the GPU. If the result of the AND operation is zero, the GPU ignores the intersection.