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/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/three-gpu-pathtracer)
|
|
4
4
|
[](https://github.com/gkjohnson/three-gpu-pathtracer/actions)
|
|
5
|
+
[](https://gkjohnson.github.io/tools/docs/three-gpu-pathtracer/)
|
|
5
6
|
[](https://github.com/gkjohnson/three-gpu-pathtracer/)
|
|
6
7
|
[](https://twitter.com/garrettkjohnson)
|
|
7
8
|
[](https://github.com/sponsors/gkjohnson/)
|
|
@@ -103,7 +104,9 @@ scene.environment = blurredEnvMap;
|
|
|
103
104
|
|
|
104
105
|
# API
|
|
105
106
|
|
|
106
|
-
See [
|
|
107
|
+
See the [docs site](https://gkjohnson.github.io/tools/docs/three-gpu-pathtracer/) for the WebGPU API documentation.
|
|
108
|
+
|
|
109
|
+
The same documentation is also available as markdown in [API.md](./src/webgpu/API.md).
|
|
107
110
|
|
|
108
111
|
# Gotchas
|
|
109
112
|
|
package/build/index.module.js
CHANGED
|
@@ -2385,6 +2385,7 @@ class EquirectHdrInfoUniform {
|
|
|
2385
2385
|
}
|
|
2386
2386
|
|
|
2387
2387
|
const LIGHT_PIXELS = 6;
|
|
2388
|
+
const VISIBLE_TO_CAMERA_OFFSET = 11;
|
|
2388
2389
|
const RECT_AREA_LIGHT = 0;
|
|
2389
2390
|
const CIRC_AREA_LIGHT = 1;
|
|
2390
2391
|
const SPOT_LIGHT = 2;
|
|
@@ -2465,7 +2466,7 @@ class LightsInfoUniformStruct {
|
|
|
2465
2466
|
|
|
2466
2467
|
type = SPOT_LIGHT;
|
|
2467
2468
|
|
|
2468
|
-
} else if ( l.isDirectionalLight ) {
|
|
2469
|
+
} else if ( l.isDirectionalLight || l.isSunLight ) {
|
|
2469
2470
|
|
|
2470
2471
|
type = DIR_LIGHT;
|
|
2471
2472
|
|
|
@@ -2590,8 +2591,22 @@ class LightsInfoUniformStruct {
|
|
|
2590
2591
|
floatArray[ baseIndex + ( index ++ ) ] = target.y;
|
|
2591
2592
|
floatArray[ baseIndex + ( index ++ ) ] = target.z;
|
|
2592
2593
|
|
|
2594
|
+
} else if ( l.isSunLight ) {
|
|
2595
|
+
|
|
2596
|
+
// the sun has no target and shines from its position toward the origin
|
|
2597
|
+
target.setFromMatrixPosition( l.matrixWorld ).normalize();
|
|
2598
|
+
|
|
2599
|
+
// sample 3
|
|
2600
|
+
// u vector
|
|
2601
|
+
floatArray[ baseIndex + ( index ++ ) ] = target.x;
|
|
2602
|
+
floatArray[ baseIndex + ( index ++ ) ] = target.y;
|
|
2603
|
+
floatArray[ baseIndex + ( index ++ ) ] = target.z;
|
|
2604
|
+
|
|
2593
2605
|
}
|
|
2594
2606
|
|
|
2607
|
+
// whether camera rays see the light
|
|
2608
|
+
floatArray[ baseIndex + VISIBLE_TO_CAMERA_OFFSET ] = l.visibleToCameraRays ? 1 : 0;
|
|
2609
|
+
|
|
2595
2610
|
}
|
|
2596
2611
|
|
|
2597
2612
|
this.count = lights.length;
|
|
@@ -2892,7 +2907,8 @@ function getLights( scene ) {
|
|
|
2892
2907
|
c.isRectAreaLight ||
|
|
2893
2908
|
c.isSpotLight ||
|
|
2894
2909
|
c.isPointLight ||
|
|
2895
|
-
c.isDirectionalLight
|
|
2910
|
+
c.isDirectionalLight ||
|
|
2911
|
+
c.isSunLight
|
|
2896
2912
|
) {
|
|
2897
2913
|
|
|
2898
2914
|
lights.push( c );
|