[bug] Fix BTDF
Closed this issue · 11 comments
Gonna use https://github.com/xelatihy/yocto-gl/blob/main/docs/yocto/yocto_shading.md to implement a custom BSDF (will make it a lot easier to debug as I can assume the yocto-gl codebase is accurate)
Almost completely fixed in 670a1f9, however on transmissive microfacet surfaces, total internal reflection tends towards 0 contribution as roughness increases.
This may be either an issue with my combination of the lobes, or an internal issue in yocto-gl's microfacet BTDF
Every lobe except DielectricTransmission
seems to work fine
Fixed a few issues relating to delta lobes + next event estimation.
Given the issue with the microfacet BTDF increases as the surface roughness increases, it may just be energy loss due to using single scattering, looking into implementing multiple scattering GGX
yocto-gl actually already has functions to approximate the multiple scattering contribution, and it doesnt break my entire BSDF
looks like literally all of this was caused by not normalising the barycentric interpolation of the TBN vectors, except when either normal mapping or correcting backfaces
Ok refraction still has the same issue as before, but a bunch of other issues fixed
Todo so I don’t forget:
- Replace NDF sampled reflection-transmission BSDF with custom VNDF version adding in multiple scattering compensation
- Fix rough internal reflection having a throughput of 0 or near 0 (possibly fixed with the above)
- Replace specular term of the glossy lobe with VNDF sampled version + multiple scattering compensation
- Look into benefit of a microfacet diffuse lobe (e.g. oren nayar)
- Square roughness
Pretty much done everything I wanted to do
Still need to reimplement the BTDF and I'm probably gonna have to do single scattering energy loss for it, which yocto-gl doesn't provide a helper for (beyond Ess)
Also the glossy diffuse lobe has no energy loss compensation but the frostbite diffuse BRDF lessens the issue significantly