Skip to content

Commit

Permalink
do not add LDS path in caustics photon map
Browse files Browse the repository at this point in the history
  • Loading branch information
yumcyaWiz committed Nov 22, 2021
1 parent 4893dd3 commit 127aa75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 7 additions & 2 deletions include/integrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,13 @@ class PhotonMapping : public Integrator {
IntersectInfo info;
if (scene.intersect(ray, info)) {
const BxDFType bxdf_type = info.hitPrimitive->getBxDFType();

// break when hitting diffuse surface without previous specular
if (!prev_specular && bxdf_type == BxDFType::DIFFUSE) {
break;
}

// add photon when hitting diffuse surface after specular
if (prev_specular && bxdf_type == BxDFType::DIFFUSE &&
!info.hitPrimitive->hasAreaLight()) {
// TODO: remove lock to get more speed
Expand All @@ -462,8 +469,6 @@ class PhotonMapping : public Integrator {
photons.emplace_back(throughput, info.surfaceInfo.position,
-ray.direction);
}

// break after the first diffuse surface
break;
}

Expand Down
4 changes: 1 addition & 3 deletions include/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ const std::shared_ptr<BxDF> createBxDF(const tinyobj::material_t& material) {
Vec3f(material.specular[0], material.specular[1], material.specular[2]);

switch (material.illum) {
case 2:
// lambert
return std::make_shared<Lambert>(kd);
case 5:
// mirror
return std::make_shared<Mirror>(Vec3(1.0f));
case 7:
// glass
return std::make_shared<Glass>(Vec3(1.0f), material.ior);
default:
// lambert
return std::make_shared<Lambert>(kd);
}
}
Expand Down

0 comments on commit 127aa75

Please sign in to comment.