Skip to content

Commit d08fa08

Browse files
authored
Merge pull request #448 from gkjohnson/reverse-simplification
Revert "Remove unnecessary check"
2 parents fba1350 + cf3fb9f commit d08fa08

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/materials/pathtracing/glsl/directLightContribution.glsl.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export const directLightContributionGLSL = /*glsl*/`
2929
// get the material pdf
3030
vec3 sampleColor;
3131
float lightMaterialPdf = bsdfResult( worldWo, lightRec.direction, surf, sampleColor );
32-
if ( lightMaterialPdf > 0.0 ) {
32+
bool isValidSampleColor = all( greaterThanEqual( sampleColor, vec3( 0.0 ) ) );
33+
if ( lightMaterialPdf > 0.0 && isValidSampleColor ) {
3334
3435
// weight the direct light contribution
3536
float lightPdf = lightRec.pdf / lightsDenom;
@@ -71,7 +72,8 @@ export const directLightContributionGLSL = /*glsl*/`
7172
// get the material pdf
7273
vec3 sampleColor;
7374
float envMaterialPdf = bsdfResult( worldWo, envDirection, surf, sampleColor );
74-
if ( envMaterialPdf > 0.0 ) {
75+
bool isValidSampleColor = all( greaterThanEqual( sampleColor, vec3( 0.0 ) ) );
76+
if ( envMaterialPdf > 0.0 && isValidSampleColor ) {
7577
7678
// weight the direct light contribution
7779
envPdf /= lightsDenom;

0 commit comments

Comments
 (0)