1
1
#version 430 core
2
2
#include "raytraceCommon.glsl"
3
3
4
+ #include <nbl/builtin/glsl/ext/MitsubaLoader/instance_data_descriptor.glsl>
4
5
5
6
#include <nbl/builtin/glsl/ext/RadeonRays/intersection.glsl>
6
7
layout(set = 2, binding = 0, std430) restrict buffer Queries
@@ -20,7 +21,7 @@ void main()
20
21
21
22
vec3 color = vec3(0.0);
22
23
uvec2 groupLocation = gl_WorkGroupID.xy*gl_WorkGroupSize.xy;
23
- for (uint i=0u; i<1u/* staticViewData.samplesPerPixelPerDispatch*/ ; i++)
24
+ for (uint i=0u; i<staticViewData.samplesPerPixelPerDispatch; i++)
24
25
{
25
26
const uint rayID = baseID+i;
26
27
nbl_glsl_ext_RadeonRays_Intersection hit = hits[rayID];
@@ -29,8 +30,12 @@ void main()
29
30
if (hit.shapeid<0)
30
31
continue;
31
32
32
- color.r -= float(hit.shapeid);//staticViewData.samplesPerPixelPerDispatch;
33
- color.g -= float(hit.primid);//staticViewData.samplesPerPixelPerDispatch;
33
+ // TODO: fetch from ray buffer
34
+ const float thoughput = 1.0/7.0;
35
+
36
+ const bool frontface = true; // TODO: how to determine frontface easily from radeon rays!? barycentrics? ray direction vs. oriented cross product?
37
+ nbl_glsl_MC_oriented_material_t material = nbl_glsl_MC_material_data_t_getOriented(InstData.data[hit.shapeid].material,frontface);
38
+ color += nbl_glsl_MC_oriented_material_t_getEmissive(material)*thoughput;
34
39
35
40
// hit buffer needs clearing
36
41
hits[rayID].shapeid = -1;
@@ -40,8 +45,6 @@ void main()
40
45
else
41
46
acc += color;
42
47
storeAccumulation(acc,pixelCoord);
43
- acc = abs(color);
44
- acc.rg /= vec2(32.0,1023.0);
45
48
imageStore(framebuffer,pixelCoord,uvec4(nbl_glsl_encodeRGB10A2(vec4(acc,1.0)),0u,0u,0u));
46
49
}
47
50
}
0 commit comments