Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Fix BTDF #29

Closed
Derpius opened this issue Aug 7, 2022 · 11 comments
Closed

[bug] Fix BTDF #29

Derpius opened this issue Aug 7, 2022 · 11 comments
Labels
binary module Issues relating to the binary module bug Something isn't working
Milestone

Comments

@Derpius
Copy link
Owner

Derpius commented Aug 7, 2022

Describe the bug
Either the material inputted to the BTDF is incorrect, or the port of Falcor's BTDF is incorrect, as transmissive materials are completely broken.

I can't find any renders of transmissive materials from when the BSDF was implemented either, so it may never have worked.

Screenshots

@Derpius Derpius added the bug Something isn't working label Aug 7, 2022
@Derpius
Copy link
Owner Author

Derpius commented Aug 7, 2022

@yogwoggf

@Derpius
Copy link
Owner Author

Derpius commented Aug 10, 2022

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)

@Derpius Derpius added this to the v0.10.0 milestone Aug 11, 2022
@Derpius Derpius added the binary module Issues relating to the binary module label Aug 13, 2022
@Derpius Derpius modified the milestones: v0.10.0, v0.11.0 Aug 15, 2022
@Derpius
Copy link
Owner Author

Derpius commented Aug 20, 2022

Reimplemented the diffuse and specular reflection lobes using yocto-gl’s diffuse, dielectric reflection, and conductive reflection lobes

@Derpius
Copy link
Owner Author

Derpius commented Aug 21, 2022

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

@Derpius Derpius added the help wanted Extra attention is needed label Aug 21, 2022
@Derpius
Copy link
Owner Author

Derpius commented Aug 21, 2022

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

@Derpius Derpius removed the help wanted Extra attention is needed label Aug 21, 2022
@Derpius
Copy link
Owner Author

Derpius commented Aug 22, 2022

yocto-gl actually already has functions to approximate the multiple scattering contribution, and it doesnt break my entire BSDF

@Derpius
Copy link
Owner Author

Derpius commented Aug 22, 2022

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

@Derpius
Copy link
Owner Author

Derpius commented Aug 22, 2022

Ok refraction still has the same issue as before, but a bunch of other issues fixed

@Derpius
Copy link
Owner Author

Derpius commented Aug 22, 2022

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

@Derpius
Copy link
Owner Author

Derpius commented Aug 23, 2022

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

@Derpius
Copy link
Owner Author

Derpius commented Aug 23, 2022

image
🥳

@Derpius Derpius closed this as completed Aug 23, 2022
@Derpius Derpius moved this to Backlog in VisTrace Dec 16, 2022
@Derpius Derpius added this to VisTrace Dec 16, 2022
@Derpius Derpius moved this from Backlog to Done in VisTrace Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary module Issues relating to the binary module bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

1 participant