Properly calling trace function with payload1

This commit is contained in:
mklefrancois 2020-08-31 16:56:39 +02:00
parent 81c26d451f
commit e1dff2a4e7
12 changed files with 478 additions and 12 deletions

View file

@ -10,7 +10,7 @@ hitAttributeEXT vec2 attribs;
// clang-format off
layout(location = 0) rayPayloadInEXT hitPayload prd;
layout(location = 1) rayPayloadEXT bool isShadowed;
layout(location = 1) rayPayloadEXT shadowPayload prdShadow;
layout(binding = 0, set = 0) uniform accelerationStructureEXT topLevelAS;
@ -104,7 +104,8 @@ void main()
vec3 origin = gl_WorldRayOriginEXT + gl_WorldRayDirectionEXT * gl_HitTEXT;
vec3 rayDir = L;
uint flags = gl_RayFlagsSkipClosestHitShaderEXT;
isShadowed = true;
prdShadow.isHit = true;
prdShadow.seed = prd.seed;
traceRayEXT(topLevelAS, // acceleration structure
flags, // rayFlags
0xFF, // cullMask
@ -117,8 +118,9 @@ void main()
tMax, // ray max range
1 // payload (location = 1)
);
prd.seed = prdShadow.seed;
if(isShadowed)
if(prdShadow.isHit)
{
attenuation = 0.3;
}