three-gpu-pathtracer 0.0.25 → 0.0.27
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/README.md +4 -1
- package/build/index.module.js +18 -2
- package/build/index.module.js.map +1 -1
- package/build/index.umd.cjs +18 -2
- package/build/index.umd.cjs.map +1 -1
- package/package.json +3 -2
- package/src/core/utils/sceneUpdateUtils.js +2 -1
- package/src/uniforms/LightsInfoUniformStruct.js +16 -1
- package/src/webgpu/AtlasTexture.js +30 -9
- package/src/webgpu/EquirectHdrInfoNode.js +11 -1
- package/src/webgpu/LightsInfoNode.js +141 -3
- package/src/webgpu/MegaKernelPathTracer.js +1 -0
- package/src/webgpu/PathTracerBackend.js +2 -0
- package/src/webgpu/TurquinTexture.js +2 -0
- package/src/webgpu/WaveFrontPathTracer.js +13 -0
- package/src/webgpu/WebGPUPathTracer.js +9 -3
- package/src/webgpu/compute/ComputeKernel.js +10 -0
- package/src/webgpu/compute/PathTracerMegaKernel.js +75 -44
- package/src/webgpu/compute/wavefront/LogicKernel.js +77 -43
- package/src/webgpu/compute/wavefront/MaterialKernel.js +1 -1
- package/src/webgpu/compute/wavefront/TraceShadowRayKernel.js +6 -4
- package/src/webgpu/compute/wavefront/structs.js +3 -1
- package/src/webgpu/index.d.ts +38 -0
- package/src/webgpu/materials/GltfCompliantMaterial.js +1 -1
- package/src/webgpu/nodes/PathtracerBVHComputeData.js +79 -9
- package/src/webgpu/nodes/lights.wgsl.js +21 -1
- package/src/webgpu/nodes/structs.wgsl.js +1 -0
- package/src/webgpu/upscale/FSRUpscaler.js +2 -1
package/build/index.umd.cjs
CHANGED
|
@@ -2387,6 +2387,7 @@
|
|
|
2387
2387
|
}
|
|
2388
2388
|
|
|
2389
2389
|
const LIGHT_PIXELS = 6;
|
|
2390
|
+
const VISIBLE_TO_CAMERA_OFFSET = 11;
|
|
2390
2391
|
const RECT_AREA_LIGHT = 0;
|
|
2391
2392
|
const CIRC_AREA_LIGHT = 1;
|
|
2392
2393
|
const SPOT_LIGHT = 2;
|
|
@@ -2467,7 +2468,7 @@
|
|
|
2467
2468
|
|
|
2468
2469
|
type = SPOT_LIGHT;
|
|
2469
2470
|
|
|
2470
|
-
} else if ( l.isDirectionalLight ) {
|
|
2471
|
+
} else if ( l.isDirectionalLight || l.isSunLight ) {
|
|
2471
2472
|
|
|
2472
2473
|
type = DIR_LIGHT;
|
|
2473
2474
|
|
|
@@ -2592,8 +2593,22 @@
|
|
|
2592
2593
|
floatArray[ baseIndex + ( index ++ ) ] = target.y;
|
|
2593
2594
|
floatArray[ baseIndex + ( index ++ ) ] = target.z;
|
|
2594
2595
|
|
|
2596
|
+
} else if ( l.isSunLight ) {
|
|
2597
|
+
|
|
2598
|
+
// the sun has no target and shines from its position toward the origin
|
|
2599
|
+
target.setFromMatrixPosition( l.matrixWorld ).normalize();
|
|
2600
|
+
|
|
2601
|
+
// sample 3
|
|
2602
|
+
// u vector
|
|
2603
|
+
floatArray[ baseIndex + ( index ++ ) ] = target.x;
|
|
2604
|
+
floatArray[ baseIndex + ( index ++ ) ] = target.y;
|
|
2605
|
+
floatArray[ baseIndex + ( index ++ ) ] = target.z;
|
|
2606
|
+
|
|
2595
2607
|
}
|
|
2596
2608
|
|
|
2609
|
+
// whether camera rays see the light
|
|
2610
|
+
floatArray[ baseIndex + VISIBLE_TO_CAMERA_OFFSET ] = l.visibleToCameraRays ? 1 : 0;
|
|
2611
|
+
|
|
2597
2612
|
}
|
|
2598
2613
|
|
|
2599
2614
|
this.count = lights.length;
|
|
@@ -2894,7 +2909,8 @@
|
|
|
2894
2909
|
c.isRectAreaLight ||
|
|
2895
2910
|
c.isSpotLight ||
|
|
2896
2911
|
c.isPointLight ||
|
|
2897
|
-
c.isDirectionalLight
|
|
2912
|
+
c.isDirectionalLight ||
|
|
2913
|
+
c.isSunLight
|
|
2898
2914
|
) {
|
|
2899
2915
|
|
|
2900
2916
|
lights.push( c );
|