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 NAN bug when MLT propose a path with 0 radiance #477

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

w3ntao
Copy link
Contributor

@w3ntao w3ntao commented Jan 9, 2025

In MLTIntegrator::Render(), when computing radiance for current path and proposed path, there is a non zero probabilty that their radiance (cCurrent, cProposed) evaluated to 0.

In such case, both accept and splat value will be affected:

  • accept will be assigned 1 when cCurrent == 0
  • LProposed * accept / cProposed and LCurrent * (1 - accept) / cCurrent will be evaluated to NAN, thus pollute the final image
Float cProposed = c(LProposed, lambdaProposed);
Float cCurrent = c(LCurrent, lambdaCurrent);
Float accept = std::min<Float>(1, cProposed / cCurrent);

// Splat both current and proposed samples to _film_
if (accept > 0)
    film.AddSplat(pProposed, LProposed * accept / cProposed, lambdaProposed);
film.AddSplat(pCurrent, LCurrent * (1 - accept) / cCurrent, lambdaCurrent);

My proposed fix is simple: just avoid film.AddSplat() when cCurrent == 0 || cProposed == 0, and then compute accept accordingly.

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