diff --git a/src/libbidir/edge.cpp b/src/libbidir/edge.cpp index 6ad50fb1..4e867899 100644 --- a/src/libbidir/edge.cpp +++ b/src/libbidir/edge.cpp @@ -48,6 +48,9 @@ bool PathEdge::sampleNext(const Scene *scene, Sampler *sampler, return false; } + if (length == 0) + return false; + if (!medium) { weight[ERadiance] = weight[EImportance] = Spectrum(1.0f); pdf[ERadiance] = pdf[EImportance] = 1.0f; @@ -103,6 +106,9 @@ bool PathEdge::perturbDirection(const Scene *scene, } d = ray.d; + if (length == 0) + return false; + if (!medium) { weight[ERadiance] = weight[EImportance] = Spectrum(1.0f); pdf[ERadiance] = pdf[EImportance] = 1.0f;