nvpro-samples / vk_raytrace

Ray tracing glTF scene with Vulkan
Apache License 2.0
575 stars 35 forks source link

bugs in pathtrace.glsl #13

Closed bacTlink closed 3 years ago

bacTlink commented 3 years ago

I notice some problems in pathtrace.glsl. I am sorry I have no time to fix them myself. If these problems exist, I hope this issue post can help you out.

  1. The shadow rays of point light sources are not handled correctly. The maximum distance of the shadow rays should not be 1e32 for them.
  2. The environment map evaluation in PathTrace() does not have MIS weight.
  3. The direct light contribution is accumulated after RR. So if RR is activated, the direct light of the last bounce may not be added.
bacTlink commented 3 years ago
  1. misWeight should always be 1 for point lights since they are not hitable.
  2. When bsdfSampleRec.pdf <= 0, the direct light contribution is also not accumulated.
mklefrancois commented 3 years ago

Thanks for the comments, I will have a look.

mklefrancois commented 3 years ago

The punctual lights was a quick addition, but this commit 4b0e78d should hopefully fix it. If eventually there are area lights with glTF, the code should be adapted.