Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion lib/rendering/shading/bsdf/npr/BsdfToon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,14 @@ ToonBsdfLobe::eval(const BsdfSlice &slice,
float cosThetaWi = dot(N, wi);

if (pdf != NULL) {
*pdf = max(cosThetaWi, 0.0f) * sOneOverPi;
// Use sEpsilon as the floor rather than 0 for shadow-side directions
// (cosThetaWi <= 0). A zero pdf would cause isSampleInvalid() to
// discard the light sample entirely, suppressing the shadow-zone ramp
// contribution added in MOONSHINE-2049. This lobe never
// importance-samples the back hemisphere, so a near-zero positive pdf
// is semantically correct: it gives the light sample near-unity MIS
// weight for those directions, which is the desired behavior.
*pdf = max(cosThetaWi, sEpsilon) * sOneOverPi;
}

// Note: we assume this lobe has been setup with a OneMinus*Fresnel
Expand Down
9 changes: 8 additions & 1 deletion lib/rendering/shading/ispc/bsdf/npr/BsdfToon.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ ToonBsdfLobe_eval(const varying BsdfLobe * uniform lobe,
const float cosThetaWi = dot(N, wi);

if (pdf != NULL) {
*pdf = max(cosThetaWi, 0.0f) * sOneOverPi;
// Use sEpsilon as the floor rather than 0 for shadow-side directions
// (cosThetaWi <= 0). A zero pdf would cause isSampleInvalid() to
// discard the light sample entirely, suppressing the shadow-zone ramp
// contribution added in MOONSHINE-2049. This lobe never
// importance-samples the back hemisphere, so a near-zero positive pdf
// is semantically correct: it gives the light sample near-unity MIS
// weight for those directions, which is the desired behavior.
*pdf = max(cosThetaWi, sEpsilon) * sOneOverPi;
}

// Note: we assume this lobe has been setup with a OneMinus*Fresnel
Expand Down