zaphod icon indicating copy to clipboard operation
zaphod copied to clipboard

Half vector reprojection not performed in GDPT, leading to high variance in specular paths

Open dylanede opened this issue 7 years ago • 1 comments

I've noticed that in your GDPT implementation, your path continuation by reusing half vectors from the base path doesn't appear to be done entirely correctly (at least as far as I understand the algorithm). The paper calls for half vectors to be reprojected in "tangent space". This means that you can't just copy the half vector in world space. If you do, perfectly reflective surfaces will provide zero contribution for offset bounces that do not hit the exact same normal direction as the bounce on the base path, as the half vector won't match. And for all material types there is a risk of the half vector pointing into the surface, nulling any possible contribution.

The code I am referring to is https://github.com/daseyb/zaphod/blob/3da8928709843931687848f1c1d887bda5b33982/src/Rendering/Integrators/GradientDomainPathTracer.cpp#L98-L103

This needs to be corrected to do the reprojection of halfVec in tangent space. Picking an appropriate tangent space is not straightforward however. It needs to keep the normal pointing in the same local direction (by definition of "tangent space"), but also it should ideally keep the plane containing the incoming direction and normal vector at the same local orientation as well. This second property improves results with rougher specular surfaces. When implementing this be careful about how incident rays close to the normal direction are handled.

It's a shame that the paper doesn't go into any detail about this.

dylanede avatar Feb 25 '18 16:02 dylanede

Thanks for the comment and actually looking through the code! I have to admit that my GDPT implementation is very lacking. I basically only went far enough to understand the technique properly and used/adapted the Mitsuba based implementation afterwards to produce most of the figures in my seminar paper. I hope I'll find some time to continue working on zaphod in the next few months:)

On 25 February 2018 at 17:18, Dylan Ede [email protected] wrote:

I've noticed that in your GDPT implementation, your path continuation by reusing half vectors from the base path doesn't appear to be done entirely correctly (at least as far as I understand the algorithm). The paper calls for half vectors to be reprojected in "tangent space". This means that you can't just copy the half vector in world space. If you do, perfectly reflective surfaces will provide zero contribution for offset bounces that do not hit the exact same normal direction as the bounce on the base path, as the half vector won't match. And for all material types there is a risk of the half vector pointing into the surface, nulling any possible contribution.

The code I am referring to is https://github.com/daseyb/zaphod/blob/ 3da8928709843931687848f1c1d887bda5b33982/src/Rendering/Integrators/ GradientDomainPathTracer.cpp#L98-L103

This needs to be corrected to do the reprojection of halfVec in tangent space. Picking an appropriate tangent space is not straightforward however. It needs to keep the normal pointing in the same local direction (by definition of "tangent space"), but also it should ideally keep the plane containing the incoming direction and normal vector at the same local orientation as well. This second property improves results with rougher specular surfaces. When implementing this be careful about how incident rays close to the normal direction are handled.

It's a shame that the paper doesn't go into any detail about this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/daseyb/zaphod/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ABmDsn1VkgJIdafr1y6FxEMMJfmlyT7Lks5tYYfOgaJpZM4SSWmk .

daseyb avatar Feb 25 '18 22:02 daseyb