rayzee 6.5.0 → 7.1.0
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 +24 -5
- package/dist/rayzee.es.js +7624 -7063
- package/dist/rayzee.es.js.map +1 -1
- package/dist/rayzee.umd.js +157 -236
- package/dist/rayzee.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/EngineDefaults.js +26 -9
- package/src/PathTracerApp.js +118 -26
- package/src/Pipeline/PipelineContext.js +1 -2
- package/src/Pipeline/RenderPipeline.js +1 -1
- package/src/Pipeline/RenderStage.js +1 -1
- package/src/Processor/CameraOptimizer.js +0 -5
- package/src/Processor/GeometryExtractor.js +6 -0
- package/src/Processor/KernelManager.js +277 -0
- package/src/Processor/PackedRayBuffer.js +291 -0
- package/src/Processor/QueueManager.js +173 -0
- package/src/Processor/SceneProcessor.js +1 -0
- package/src/Processor/ShaderBuilder.js +11 -317
- package/src/Processor/StorageTexturePool.js +29 -15
- package/src/Processor/VRAMTracker.js +169 -0
- package/src/Processor/utils.js +11 -110
- package/src/RenderSettings.js +0 -3
- package/src/Stages/ASVGF.js +151 -78
- package/src/Stages/BilateralFilter.js +34 -10
- package/src/Stages/EdgeFilter.js +2 -3
- package/src/Stages/MotionVector.js +16 -9
- package/src/Stages/NormalDepth.js +17 -5
- package/src/Stages/PathTracer.js +671 -1456
- package/src/Stages/PathTracerStage.js +1451 -0
- package/src/Stages/SSRC.js +32 -15
- package/src/Stages/Variance.js +35 -12
- package/src/TSL/CompactKernel.js +110 -0
- package/src/TSL/DebugKernel.js +98 -0
- package/src/TSL/Environment.js +13 -11
- package/src/TSL/ExtendKernel.js +75 -0
- package/src/TSL/FinalWriteKernel.js +121 -0
- package/src/TSL/GenerateKernel.js +111 -0
- package/src/TSL/LightsSampling.js +2 -2
- package/src/TSL/PathTracerCore.js +43 -1039
- package/src/TSL/ShadeKernel.js +876 -0
- package/src/TSL/patches.js +81 -4
- package/src/index.js +3 -0
- package/src/managers/CameraManager.js +1 -1
- package/src/managers/DenoisingManager.js +40 -75
- package/src/managers/EnvironmentManager.js +30 -39
- package/src/managers/OverlayManager.js +7 -22
- package/src/managers/UniformManager.js +0 -3
- package/src/managers/helpers/TileHelper.js +2 -2
- package/src/Stages/AdaptiveSampling.js +0 -483
- package/src/TSL/PathTracer.js +0 -384
- package/src/managers/TileManager.js +0 -298
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Fn, vec3, vec4, float, int, uint, uvec2, uniform, normalize, mat3, storage, If,
|
|
2
2
|
textureStore, workgroupId, localId } from 'three/tsl';
|
|
3
3
|
import { RenderTarget, StorageTexture } from 'three/webgpu';
|
|
4
|
-
import { HalfFloatType, RGBAFormat, NearestFilter, Matrix4 } from 'three';
|
|
4
|
+
import { HalfFloatType, RGBAFormat, NearestFilter, Matrix4, Box2, Vector2 } from 'three';
|
|
5
5
|
import { RenderStage, StageExecutionMode } from '../Pipeline/RenderStage.js';
|
|
6
|
+
import { MAX_STORAGE_TEXTURE_SIZE } from '../EngineDefaults.js';
|
|
6
7
|
import { Ray, HitInfo } from '../TSL/Struct.js';
|
|
7
8
|
import { traverseBVH } from '../TSL/BVHTraversal.js';
|
|
8
9
|
|
|
@@ -44,12 +45,15 @@ export class NormalDepth extends RenderStage {
|
|
|
44
45
|
const w = options.width || 1;
|
|
45
46
|
const h = options.height || 1;
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
// StorageTexture stays at max alloc — see resize crash fix (three.js #33061).
|
|
49
|
+
this._outputStorageTex = new StorageTexture( MAX_STORAGE_TEXTURE_SIZE, MAX_STORAGE_TEXTURE_SIZE );
|
|
48
50
|
this._outputStorageTex.type = HalfFloatType;
|
|
49
51
|
this._outputStorageTex.format = RGBAFormat;
|
|
50
52
|
this._outputStorageTex.minFilter = NearestFilter;
|
|
51
53
|
this._outputStorageTex.magFilter = NearestFilter;
|
|
52
54
|
|
|
55
|
+
this._srcRegion = new Box2( new Vector2( 0, 0 ), new Vector2( 0, 0 ) );
|
|
56
|
+
|
|
53
57
|
// Ping-pong RTs share format with the StorageTexture so copyTextureToTexture works.
|
|
54
58
|
const rtOpts = {
|
|
55
59
|
type: HalfFloatType,
|
|
@@ -252,13 +256,16 @@ export class NormalDepth extends RenderStage {
|
|
|
252
256
|
const prevRT = this._currentIdx === 0 ? this._rtB : this._rtA;
|
|
253
257
|
|
|
254
258
|
this.renderer.compute( this._computeNode );
|
|
255
|
-
|
|
259
|
+
|
|
260
|
+
// Copy only the active region out of the over-allocated StorageTexture.
|
|
261
|
+
this._srcRegion.max.set( writeRT.width, writeRT.height );
|
|
262
|
+
this.renderer.copyTextureToTexture( this._outputStorageTex, writeRT.texture, this._srcRegion );
|
|
256
263
|
|
|
257
264
|
// First dispatch: seed prev from current so ASVGF doesn't see false
|
|
258
265
|
// disocclusion on frame 1.
|
|
259
266
|
if ( ! this._hasHistory ) {
|
|
260
267
|
|
|
261
|
-
this.renderer.copyTextureToTexture( this._outputStorageTex, prevRT.texture );
|
|
268
|
+
this.renderer.copyTextureToTexture( this._outputStorageTex, prevRT.texture, this._srcRegion );
|
|
262
269
|
this._hasHistory = true;
|
|
263
270
|
|
|
264
271
|
}
|
|
@@ -279,9 +286,14 @@ export class NormalDepth extends RenderStage {
|
|
|
279
286
|
|
|
280
287
|
setSize( width, height ) {
|
|
281
288
|
|
|
282
|
-
|
|
289
|
+
// StorageTexture stays at its max allocation (see constructor).
|
|
290
|
+
// RenderTarget.setSize() updates width/height but does NOT bump
|
|
291
|
+
// texture.version, so copyTextureToTexture's GPU texture would stay at
|
|
292
|
+
// the old size — needsUpdate forces the resize to take effect.
|
|
283
293
|
this._rtA.setSize( width, height );
|
|
294
|
+
this._rtA.texture.needsUpdate = true;
|
|
284
295
|
this._rtB.setSize( width, height );
|
|
296
|
+
this._rtB.texture.needsUpdate = true;
|
|
285
297
|
this._hasHistory = false;
|
|
286
298
|
this.resolutionWidth.value = width;
|
|
287
299
|
this.resolutionHeight.value = height;
|