I have a problem with updating some value in a Payload. I generate the payload inside the rgen shader like
struct HitPayload
{
vec3 hitValue;
uint32_t depth;
vec3 worldPos;
uint32_t instanceCustomIndexEXT;
uint32_t primitiveID;
float thereIsNearObj;
float refractionIndex;
float _pad0;
};
layout(location = 0) rayPayloadEXT HitPayload prd;
Inside the other shader rchit(closest) and rahit(any) i access the payload with
struct HitPayload
{
vec3 hitValue;
uint32_t depth;
vec3 worldPos;
uint32_t instanceCustomIndexEXT;
uint32_t primitiveID;
float thereIsNearObj;
float refractionIndex;
float _pad0;
};
layout(location = 0) rayPayloadInEXT HitPayload prd;
The shader compile and the program run. The problem is that i can update only the hitValue and depth value. Other value never change. I update value in the shaders like this
prd.hitValue = vec3(1.0,1.0,0.0); //works
prd.thereIsNearObj = 1.0; //not working
I checked:
- Alignament
- remove ignoreIntersectionEXT (block payload update)
- Implicit cast from int -> uint32_t