Direct3D 12 raytracing HLSL system value intrinsics
Article 12/30/2021
6 contributors
Feedback
In this article
System values are retrieved by using special intrinsic functions, rather than including parameters with special semantics in your shader function signature.
In this section
Ray dispatch system values
Topic
Description
DispatchRaysIndex
Gets the current x and y location within the width and height obtained with the DispatchRaysDimensions system value intrinsic.
DispatchRaysDimensions
The width, height and depth values from the D3D12_DISPATCH_RAYS_DESC structure specified in the originating DispatchRays call.
Ray system values
Topic
Description
WorldRayOrigin
The world-space origin of the current ray.
WorldRayDirection
The world-space direction for the current ray.
RayTMin
A float representing the current parametric starting point for the ray.
RayTCurrent
A float representing the current parametric ending point for the ray.
RayFlags
An unsigned integer containing the current ray_flag flags.
Primitive/object space system values
Topic
Description
InstanceIndex
The autogenerated index of the current instance in the top-level raytracing acceleration structure.
InstanceID
The user-provided identifier for the instance on the bottom-level acceleration structure instance within the top-level structure.
PrimitiveIndex
The autogenerated index of the primitive within the geometry inside the bottom-level acceleration structure instance.
ObjectRayOrigin
The object-space origin for the current ray.
ObjectRayDirection
The object-space direction for the current ray.
ObjectToWorld3x4
A matrix for transforming from object-space to world-space.
ObjectToWorld4x3
A matrix for transforming from object-space to world-space.
WorldToObject3x4
A matrix for transforming from world-space to object-space
WorldToObject4x3
A matrix for transforming from world-space to object-space
Hit-specific system values
Topic
Description
HitKind
Returns the value passed as the HitKind parameter to ReportHit .