Skip to content

Fix the spectral majorant of gridvolume and a transmittance underflow - #1959

Open
AuroraRyan0301 wants to merge 2 commits into
mitsuba-renderer:masterfrom
AuroraRyan0301:spectral-fixes
Open

Fix the spectral majorant of gridvolume and a transmittance underflow#1959
AuroraRyan0301 wants to merge 2 commits into
mitsuba-renderer:masterfrom
AuroraRyan0301:spectral-fixes

Conversation

@AuroraRyan0301

@AuroraRyan0301 AuroraRyan0301 commented Sep 10, 2026

Copy link
Copy Markdown

Two bugs in spectral variants. They give abnormal gradients.

1. gridvolume returns the wrong maximum. Delta tracking needs a majorant above the largest density in the grid. The medium asks the volume for it with max(). In spectral variants an RGB grid stores four numbers per voxel: three spectral upsampling coefficients and a scale. However, max() returns the largest of (c0, c1, c2, scale), and c0, c1, c2 are not densities.

Fix. max() takes the scale alone, because the curve built from c0, c1, c2 stays between 0 and 1.

2. Transmittance underflows. exp(-majorant * t) underflows to zero once majorant * t passes about 87. prbvolpath and prbvolpath_sm then get 0/0 in the free flight weight tr / pdf and drop the path, leading to black pixels.

Fix. The optical depth is clamped to 80 before the exponential to avoid that.

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

In spectral variants gridvolume::max() returned the largest of
(c0, c1, c2, scale), and c0, c1, c2 are not densities. It now takes the
scale alone.
exp(-majorant * t) underflows to zero once majorant * t passes about 87.
prbvolpath and prbvolpath_sm then get 0/0 in the free flight weight
tr / pdf and drop the path. The optical depth is clamped to 80 before
the exponential to avoid that.
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