MilchRatchet / Luminary

CUDA based Pathtracing Offline and Realtime Renderer
MIT License
30 stars 1 forks source link

Triangle solid angle sampling has a high failure rate #88

Closed MilchRatchet closed 1 year ago

MilchRatchet commented 1 year ago

The current implementation produces incorrect solid angle results and samples invalid rays. I had initially not noticed this but when I noticed the bad convergence I investigated further and found this. The switch to solid angle sampling was made just recently but it seems to require a lot more attention to get it right. Numerical precision seems to be the main culprit right now but I am not quite sure.

MilchRatchet commented 1 year ago

Fixed by 0ec0a05

Unfortunately, it seems that it is impossible to make solid angle sampling of triangles numerically stable. Even surface area sampling runs into issues when the sampled point is too close to an edge. So until some miracle discovery happens, we are back to surface area sampling.