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

Fix normalmap #905

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

tomix1024
Copy link

@tomix1024 tomix1024 commented Sep 15, 2023

Description

The shading frame in the normalmap BSDF was not computed correctly.
The shading frame-local normal was used in conjunction with the world-space dp_du to construct the perturbed shading frame.
The shading frame in turn was interpreted as the "shading frame in world space", as well as the relative transformation between the original shading frame and the perturbed one...

Testing

resources/data/tests/scenes/git/test_normalmap_roughconductor_path.xml has been added in my fork of the mitsuba-data repository to verify the changes.
(But this probably does not really count here, does it?)
The improved correctness relative to the previous implementation can be seen if the normal-mapped rendering is compared to a not normal-mapped rendering.

I have added src/bsdfs/tests/test_normalmap.py, that verifies that sampling from a normal-mapped BSDF is the same as sampling from the nested BSDF with an appropriately rotated surface interaction.

Checklist

  • My code follows the style guidelines of this project
  • My changes generate no new warnings
  • My code also compiles for cuda_* and llvm_* variants. If you can't test this, please leave below
  • I have commented my code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I cleaned the commit history and removed any "Merge" commits
  • I give permission that the Mitsuba 3 project may redistribute my contributions under the terms of its license

@tomix1024 tomix1024 force-pushed the normalmap branch 2 times, most recently from 395f1ed to caadd87 Compare September 15, 2023 22:19
@tomix1024
Copy link
Author

tomix1024 commented Sep 15, 2023

Please have a look if the tests are sufficient as they are now...
The interesting case occurs only if an anisotropically scattering BSDF is nested inside of the normalmap, so it is difficult to have some "analytic" ground truth solution to test against.

Also the code is compiling for me with GCC 9 on Ubuntu 20.04, GCC 11 on Ubuntu 22.04 and Visual Studio 2022 on Windows 11.
I am not sure why the CI build is failing.

@tomix1024 tomix1024 marked this pull request as ready for review September 15, 2023 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant