three-gpu-pathtracer 0.0.26 → 0.0.28
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 -2
- package/build/index.module.js +23 -5
- package/build/index.module.js.map +1 -1
- package/build/index.umd.cjs +22 -4
- package/build/index.umd.cjs.map +1 -1
- package/package.json +8 -8
- package/src/core/PathTracingSceneGenerator.js +1 -1
- package/src/core/utils/sceneUpdateUtils.js +2 -1
- package/src/uniforms/EquirectHdrInfoUniform.js +4 -2
- package/src/uniforms/LightsInfoUniformStruct.js +16 -1
- package/src/webgpu/API.md +167 -19
- package/src/webgpu/AtlasTexture.js +32 -12
- package/src/webgpu/EquirectHdrInfoNode.js +97 -46
- package/src/webgpu/LightsInfoNode.js +142 -4
- package/src/webgpu/MegaKernelPathTracer.js +11 -3
- package/src/webgpu/PathTracerBackend.js +174 -21
- package/src/webgpu/TurquinTexture.js +2 -0
- package/src/webgpu/WaveFrontPathTracer.js +169 -71
- package/src/webgpu/WebGPUPathTracer.js +637 -51
- package/src/webgpu/compute/ComputeKernel.js +18 -0
- package/src/webgpu/compute/PathTracerMegaKernel.js +253 -71
- package/src/webgpu/compute/TallySampleCountsKernel.js +10 -10
- package/src/webgpu/compute/UnpackAuxKernel.js +48 -0
- package/src/webgpu/compute/ZeroOutKernel.js +3 -1
- package/src/webgpu/compute/targets.js +55 -0
- package/src/webgpu/compute/wavefront/LogicKernel.js +136 -55
- package/src/webgpu/compute/wavefront/MaterialKernel.js +153 -66
- package/src/webgpu/compute/wavefront/MediumKernel.js +154 -0
- package/src/webgpu/compute/wavefront/PopulatePixelIndicesKernel.js +5 -5
- package/src/webgpu/compute/wavefront/QueueLengthToDispatchKernel.js +5 -5
- package/src/webgpu/compute/wavefront/QueueMediumWalksKernel.js +52 -0
- package/src/webgpu/compute/wavefront/ResetSlotsKernel.js +6 -6
- package/src/webgpu/compute/wavefront/TraceRayKernel.js +11 -9
- package/src/webgpu/compute/wavefront/TraceShadowRayKernel.js +18 -23
- package/src/webgpu/compute/wavefront/structs.js +63 -35
- package/src/webgpu/constants.js +2 -2
- package/src/webgpu/denoise/OIDNDenoiser.js +81 -78
- package/src/webgpu/index.d.ts +79 -6
- package/src/webgpu/materials/GltfCompliantMaterial.js +20 -6
- package/src/webgpu/materials/debug/AuxDebugMaterial.js +54 -0
- package/src/webgpu/nodes/PathtracerBVHComputeData.js +109 -17
- package/src/webgpu/nodes/aux.wgsl.js +61 -0
- package/src/webgpu/nodes/eon.wgsl.js +1 -1
- package/src/webgpu/nodes/lights.wgsl.js +21 -1
- package/src/webgpu/nodes/material.wgsl.js +2 -1
- package/src/webgpu/nodes/medium.wgsl.js +165 -0
- package/src/webgpu/nodes/random.wgsl.js +2 -0
- package/src/webgpu/nodes/sampling.wgsl.js +44 -3
- package/src/webgpu/nodes/structs.wgsl.js +8 -1
- package/src/webgpu/upscale/FSRUpscaler.js +3 -2
package/build/index.umd.cjs
CHANGED
|
@@ -1412,7 +1412,7 @@
|
|
|
1412
1412
|
// generate the geometry
|
|
1413
1413
|
const result = staticGeometryGenerator.generate( geometry );
|
|
1414
1414
|
const materials = result.materials;
|
|
1415
|
-
let needsMaterialIndexUpdate = result.changeType !== NO_CHANGE || this._materialUuids === null || this._materialUuids.length !== length;
|
|
1415
|
+
let needsMaterialIndexUpdate = result.changeType !== NO_CHANGE || this._materialUuids === null || this._materialUuids.length !== materials.length;
|
|
1416
1416
|
if ( ! needsMaterialIndexUpdate ) {
|
|
1417
1417
|
|
|
1418
1418
|
for ( let i = 0, length = materials.length; i < length; i ++ ) {
|
|
@@ -2112,7 +2112,7 @@
|
|
|
2112
2112
|
function preprocessEnvMap( envMap, targetType = three.HalfFloatType ) {
|
|
2113
2113
|
|
|
2114
2114
|
const map = envMap.clone();
|
|
2115
|
-
map.source = new three.
|
|
2115
|
+
map.source = new three.TextureSource( { ...map.image } );
|
|
2116
2116
|
const { width, height, data } = map.image;
|
|
2117
2117
|
|
|
2118
2118
|
// TODO: is there a simple way to avoid cloning and adjusting the env map data here?
|
|
@@ -2381,12 +2381,15 @@
|
|
|
2381
2381
|
|
|
2382
2382
|
this.totalSum = totalSumValue;
|
|
2383
2383
|
this.map = map;
|
|
2384
|
+
this.cdfMarginal = cdfMarginal;
|
|
2385
|
+
this.cdfConditional = cdfConditional;
|
|
2384
2386
|
|
|
2385
2387
|
}
|
|
2386
2388
|
|
|
2387
2389
|
}
|
|
2388
2390
|
|
|
2389
2391
|
const LIGHT_PIXELS = 6;
|
|
2392
|
+
const VISIBLE_TO_CAMERA_OFFSET = 11;
|
|
2390
2393
|
const RECT_AREA_LIGHT = 0;
|
|
2391
2394
|
const CIRC_AREA_LIGHT = 1;
|
|
2392
2395
|
const SPOT_LIGHT = 2;
|
|
@@ -2467,7 +2470,7 @@
|
|
|
2467
2470
|
|
|
2468
2471
|
type = SPOT_LIGHT;
|
|
2469
2472
|
|
|
2470
|
-
} else if ( l.isDirectionalLight ) {
|
|
2473
|
+
} else if ( l.isDirectionalLight || l.isSunLight ) {
|
|
2471
2474
|
|
|
2472
2475
|
type = DIR_LIGHT;
|
|
2473
2476
|
|
|
@@ -2592,8 +2595,22 @@
|
|
|
2592
2595
|
floatArray[ baseIndex + ( index ++ ) ] = target.y;
|
|
2593
2596
|
floatArray[ baseIndex + ( index ++ ) ] = target.z;
|
|
2594
2597
|
|
|
2598
|
+
} else if ( l.isSunLight ) {
|
|
2599
|
+
|
|
2600
|
+
// the sun has no target and shines from its position toward the origin
|
|
2601
|
+
target.setFromMatrixPosition( l.matrixWorld ).normalize();
|
|
2602
|
+
|
|
2603
|
+
// sample 3
|
|
2604
|
+
// u vector
|
|
2605
|
+
floatArray[ baseIndex + ( index ++ ) ] = target.x;
|
|
2606
|
+
floatArray[ baseIndex + ( index ++ ) ] = target.y;
|
|
2607
|
+
floatArray[ baseIndex + ( index ++ ) ] = target.z;
|
|
2608
|
+
|
|
2595
2609
|
}
|
|
2596
2610
|
|
|
2611
|
+
// whether camera rays see the light
|
|
2612
|
+
floatArray[ baseIndex + VISIBLE_TO_CAMERA_OFFSET ] = l.visibleToCameraRays ? 1 : 0;
|
|
2613
|
+
|
|
2597
2614
|
}
|
|
2598
2615
|
|
|
2599
2616
|
this.count = lights.length;
|
|
@@ -2894,7 +2911,8 @@
|
|
|
2894
2911
|
c.isRectAreaLight ||
|
|
2895
2912
|
c.isSpotLight ||
|
|
2896
2913
|
c.isPointLight ||
|
|
2897
|
-
c.isDirectionalLight
|
|
2914
|
+
c.isDirectionalLight ||
|
|
2915
|
+
c.isSunLight
|
|
2898
2916
|
) {
|
|
2899
2917
|
|
|
2900
2918
|
lights.push( c );
|