Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions src/pbrt/cpu/integrators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2679,12 +2679,33 @@ void MLTIntegrator::Render() {
// Compute acceptance probability for proposed sample
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);
Float accept = NAN;
if (cProposed == 0 && cCurrent == 0) {
// neither current path or the proposed found a light source
accept = 0.5;

} else if (cProposed == 0) {
// current path found a light source but the proposed didn't
accept = 0;
film.AddSplat(pCurrent, LCurrent / cCurrent, lambdaCurrent);

} else if (cCurrent == 0) {
// current path didn't find a light source but the proposed did
accept = 1;
film.AddSplat(pProposed, LProposed / cProposed, lambdaProposed);

} else {
// both paths found a light source
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);
}
if (accept < 1) {
film.AddSplat(pCurrent, LCurrent * (1 - accept) / cCurrent, lambdaCurrent);
}
}

// Accept or reject the proposal
if (rng.Uniform<Float>() < accept) {
Expand Down
Loading