Skip to content

Commit

Permalink
Merge pull request #77 from NJUCG/xiaoyaoing-patch-2
Browse files Browse the repository at this point in the history
fix: fix a bug in PathIntegrator-new
  • Loading branch information
ChenxiZhou0619 authored Aug 7, 2023
2 parents 20f1a04 + 3220f24 commit 93ddfab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/FunctionLayer/Integrator/PathIntegrator-new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ Spectrum PathIntegratorNew::Li(const Ray &initialRay,

// Russian roulette.
double pSurvive = russianRoulette(throughput, nBounces);
if (randFloat() > pSurvive)
if(sampler->sample1D()>=pSurvive){
break;
}
throughput /= pSurvive;

//* ----- Direct Illumination -----
Expand All @@ -95,7 +96,7 @@ Spectrum PathIntegratorNew::Li(const Ray &initialRay,

//*----- BSDF Sampling -----
PathIntegratorLocalRecord sampleScatterRecord = sampleScatter(its, ray);
if (!sampleScatterRecord.f.isBlack()) {
if (!sampleScatterRecord.f.isBlack() && sampleScatterRecord.pdf!=0) {
throughput *= sampleScatterRecord.f / sampleScatterRecord.pdf;
} else {
break;
Expand Down

0 comments on commit 93ddfab

Please sign in to comment.