ReportHit function

Called by an intersection shader to report a ray intersection.


This intrinsic function definition is equivalent to the following function template:

bool ReportHit(float THit, uint HitKind, attr_t Attributes);



A float value specifying the parametric distance of the intersection..


An unsigned integer that identifies the type of hit that occurred. This is a user-specified value in the range of 0-127. The value can be read by any hit or closest hit shaders with the HitKind intrinsic.


The user-defined Intersection Attribute Structure structure specifying the intersection attributes.

Return Value

bool True if the hit was accepted. A hit is rejected if THit is outside the current ray interval, or the any hit shader calls IgnoreHit. The current ray interval is defined by RayTMin and RayTCurrent.


This function can be called from the following raytracing shader types:

See also

Direct3D 12 Raytracing HLSL Reference