three-gpu-pathtracer 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-gpu-pathtracer",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Path tracing renderer and utilities for three.js built on top of three-mesh-bvh.",
5
5
  "module": "src/index.js",
6
6
  "main": "build/index.umd.cjs",
@@ -29,7 +29,8 @@ export const directLightContributionGLSL = /*glsl*/`
29
29
  // get the material pdf
30
30
  vec3 sampleColor;
31
31
  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 ) {
33
34
 
34
35
  // weight the direct light contribution
35
36
  float lightPdf = lightRec.pdf / lightsDenom;
@@ -71,7 +72,8 @@ export const directLightContributionGLSL = /*glsl*/`
71
72
  // get the material pdf
72
73
  vec3 sampleColor;
73
74
  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 ) {
75
77
 
76
78
  // weight the direct light contribution
77
79
  envPdf /= lightsDenom;
@@ -181,7 +181,7 @@ export class AmbientOcclusionMaterial extends MaterialBase {
181
181
  dot( rayDirection, faceNormal ) > 0.0 &&
182
182
  (
183
183
  ! bvhIntersectFirstHit( bvh, rayOrigin, rayDirection, faceIndices, outNormal, barycoord, side, dist ) ||
184
- dist > radius
184
+ dist >= radius
185
185
  )
186
186
  ) {
187
187