three-gpu-pathtracer 0.0.18 → 0.0.20
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/build/index.module.js +15 -5
- package/build/index.module.js.map +1 -1
- package/build/index.umd.cjs +15 -5
- package/build/index.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/materials/pathtracing/PhysicalPathTracingMaterial.js +4 -1
- package/src/materials/pathtracing/glsl/directLightContribution.glsl.js +1 -1
- package/src/shader/sampling/equirectSampling.glsl.js +8 -1
- package/src/uniforms/LightsInfoUniformStruct.js +1 -1
- package/src/uniforms/MaterialsTexture.js +1 -1
package/build/index.umd.cjs
CHANGED
|
@@ -1996,7 +1996,7 @@
|
|
|
1996
1996
|
|
|
1997
1997
|
let index = 0;
|
|
1998
1998
|
const pixelCount = materials.length * MATERIAL_PIXELS;
|
|
1999
|
-
const dimension = Math.ceil( Math.sqrt( pixelCount ) );
|
|
1999
|
+
const dimension = Math.ceil( Math.sqrt( pixelCount ) ) || 1;
|
|
2000
2000
|
const { threeCompatibilityTransforms, image, features } = this;
|
|
2001
2001
|
|
|
2002
2002
|
// get the list of textures with unique sources
|
|
@@ -2858,7 +2858,7 @@
|
|
|
2858
2858
|
let index = 0;
|
|
2859
2859
|
|
|
2860
2860
|
// initialize to 0
|
|
2861
|
-
for ( let p = 0; p < LIGHT_PIXELS; p ++ ) {
|
|
2861
|
+
for ( let p = 0; p < LIGHT_PIXELS * 4; p ++ ) {
|
|
2862
2862
|
|
|
2863
2863
|
floatArray[ baseIndex + p ] = 0;
|
|
2864
2864
|
|
|
@@ -5589,10 +5589,17 @@ bool bvhIntersectFogVolumeHit(
|
|
|
5589
5589
|
// samples the color given env map with CDF and returns the pdf of the direction
|
|
5590
5590
|
float sampleEquirect( vec3 direction, inout vec3 color ) {
|
|
5591
5591
|
|
|
5592
|
+
float totalSum = envMapInfo.totalSum;
|
|
5593
|
+
if ( totalSum == 0.0 ) {
|
|
5594
|
+
|
|
5595
|
+
color = vec3( 0.0 );
|
|
5596
|
+
return 1.0;
|
|
5597
|
+
|
|
5598
|
+
}
|
|
5599
|
+
|
|
5592
5600
|
vec2 uv = equirectDirectionToUv( direction );
|
|
5593
5601
|
color = texture2D( envMapInfo.map, uv ).rgb;
|
|
5594
5602
|
|
|
5595
|
-
float totalSum = envMapInfo.totalSum;
|
|
5596
5603
|
float lum = luminance( color );
|
|
5597
5604
|
ivec2 resolution = textureSize( envMapInfo.map, 0 );
|
|
5598
5605
|
float pdf = lum / totalSum;
|
|
@@ -6996,7 +7003,7 @@ bool bvhIntersectFogVolumeHit(
|
|
|
6996
7003
|
|
|
6997
7004
|
}
|
|
6998
7005
|
|
|
6999
|
-
} else {
|
|
7006
|
+
} else if ( envMapInfo.totalSum != 0.0 && environmentIntensity != 0.0 ) {
|
|
7000
7007
|
|
|
7001
7008
|
// find a sample in the environment map to include in the contribution
|
|
7002
7009
|
vec3 envColor, envDirection;
|
|
@@ -7967,7 +7974,10 @@ bool bvhIntersectFogVolumeHit(
|
|
|
7967
7974
|
// inverse environment rotation
|
|
7968
7975
|
envRotation3x3 = mat3( environmentRotation );
|
|
7969
7976
|
invEnvRotation3x3 = inverse( envRotation3x3 );
|
|
7970
|
-
lightsDenom =
|
|
7977
|
+
lightsDenom =
|
|
7978
|
+
( environmentIntensity == 0.0 || envMapInfo.totalSum == 0.0 ) && lights.count != 0u ?
|
|
7979
|
+
float( lights.count ) :
|
|
7980
|
+
float( lights.count + 1u );
|
|
7971
7981
|
|
|
7972
7982
|
// final color
|
|
7973
7983
|
gl_FragColor = vec4( 0, 0, 0, 1 );
|