From 127aa75e0f32446438c7ab83cf76c44bee42007d Mon Sep 17 00:00:00 2001 From: yumcyawiz Date: Mon, 22 Nov 2021 17:10:11 +0900 Subject: [PATCH] do not add LDS path in caustics photon map --- include/integrator.h | 9 +++++++-- include/scene.h | 4 +--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/integrator.h b/include/integrator.h index daae946..406463e 100644 --- a/include/integrator.h +++ b/include/integrator.h @@ -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 @@ -462,8 +469,6 @@ class PhotonMapping : public Integrator { photons.emplace_back(throughput, info.surfaceInfo.position, -ray.direction); } - - // break after the first diffuse surface break; } diff --git a/include/scene.h b/include/scene.h index eecc850..4a8b40e 100644 --- a/include/scene.h +++ b/include/scene.h @@ -26,9 +26,6 @@ const std::shared_ptr 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(kd); case 5: // mirror return std::make_shared(Vec3(1.0f)); @@ -36,6 +33,7 @@ const std::shared_ptr createBxDF(const tinyobj::material_t& material) { // glass return std::make_shared(Vec3(1.0f), material.ior); default: + // lambert return std::make_shared(kd); } }