// Hit information, aka ray payload // This sample only carries a shading color and hit distance. // Note that the payload should be kept as small as possible, // and that its size must be declared in the corresponding // D3D12_RAYTRACING_SHADER_CONFIG pipeline subobjet. #pragma pack_matrix(row_major) #define MAX_TRANSPACENT_HITS 5 struct [raypayload] HitInfo { float4 color[MAX_TRANSPACENT_HITS] : write(caller, closesthit, anyhit, miss) : read(caller, anyhit, closesthit, miss); float distance[MAX_TRANSPACENT_HITS] : write(caller, closesthit, anyhit) : read(caller, anyhit, closesthit); uint hitCount : write(caller, anyhit, closesthit, miss) : read(caller, anyhit, closesthit, miss); }; // Attributes output by the raytracing when hitting a surface, // here the barycentric coordinates struct Attributes { float2 bary; };