rayzee 9.0.0 → 9.1.1
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 +139 -8
- package/dist/{NeuralRetouch-CYOJ21Wn.js → NeuralRetouch-BRquqfmZ.js} +1 -1
- package/dist/{NeuralSuperRes-CQLCLpcC.js → NeuralSuperRes-CbNvQjCw.js} +3 -2
- package/dist/{ToneMapGPU-BVE852iN.js → ToneMapGPU-DpUZDMbQ.js} +2 -1
- package/dist/rayzee.es.js +10353 -5337
- package/dist/rayzee.umd.js +265 -265
- package/package.json +1 -1
- package/src/AssetConfig.js +4 -0
- package/src/EngineDefaults.js +38 -56
- package/src/EngineEvents.js +3 -0
- package/src/EngineIssues.js +6 -0
- package/src/Headless.js +3 -1
- package/src/Passes/AIUpscaler.js +2 -1
- package/src/Passes/OIDNDenoiser.js +3 -6
- package/src/PathTracerApp.js +290 -19
- package/src/Processor/ArchiveCache.js +120 -0
- package/src/Processor/ArchiveReader.js +179 -32
- package/src/Processor/AssetLoader.js +514 -76
- package/src/Processor/AtmosphereModel.js +465 -0
- package/src/Processor/BVHBuilder.js +4 -1
- package/src/Processor/BVHLeafFold.js +100 -0
- package/src/Processor/BVHRefitter.js +98 -214
- package/src/Processor/ChunkedRecords.js +189 -4
- package/src/Processor/EmissiveTriangleBuilder.js +8 -0
- package/src/Processor/GeometryExtractor.js +238 -40
- package/src/Processor/InstanceTable.js +55 -37
- package/src/Processor/KernelManager.js +4 -1
- package/src/Processor/PBRT/PBRTCurves.js +104 -27
- package/src/Processor/PBRT/PBRTParser.js +132 -22
- package/src/Processor/PBRT/PBRTSceneBuilder.js +192 -49
- package/src/Processor/PBRT/buffers.js +27 -0
- package/src/Processor/PBRT/index.js +55 -15
- package/src/Processor/PackedRayBuffer.js +10 -13
- package/src/Processor/ParallelBVHBuilder.js +36 -15
- package/src/Processor/PhysicalSky.js +308 -0
- package/src/Processor/QueueManager.js +1 -0
- package/src/Processor/SceneProcessor.js +1132 -181
- package/src/Processor/SplitBLAS.js +249 -0
- package/src/Processor/SunPosition.js +41 -0
- package/src/Processor/TextureCreator.js +21 -0
- package/src/Processor/Workers/AIUpscalerWorker.js +79 -52
- package/src/Processor/Workers/BVHWorker.js +17 -13
- package/src/Processor/ZipReader.js +207 -0
- package/src/RenderSettings.js +38 -0
- package/src/SceneState/SceneState.js +367 -0
- package/src/SceneState/portable.js +52 -0
- package/src/Stages/NormalDepth.js +7 -6
- package/src/Stages/PathTracer.js +108 -4
- package/src/Stages/PathTracerStage.js +251 -104
- package/src/Storage/BLASCache.js +190 -0
- package/src/Storage/CDFCache.js +77 -0
- package/src/Storage/DownloadCache.js +266 -0
- package/src/Storage/GeometrySpill.js +217 -0
- package/src/Storage/SceneGraphCodec.js +503 -0
- package/src/Storage/SpillStore.js +112 -0
- package/src/Storage/StorageManager.js +934 -0
- package/src/Storage/StorageOps.js +137 -0
- package/src/Storage/StorageWorker.js +37 -0
- package/src/Storage/events.js +29 -0
- package/src/Storage/identity.js +77 -0
- package/src/Storage/index.js +9 -0
- package/src/Storage/inlineTransport.js +24 -0
- package/src/Storage/locks.js +99 -0
- package/src/Storage/openStorage.js +87 -0
- package/src/Storage/sceneCachePolicy.js +12 -0
- package/src/Storage/shared.js +9 -0
- package/src/Storage/transport.js +62 -0
- package/src/TSL/Atmosphere.js +684 -0
- package/src/TSL/BVHTraversal.js +288 -239
- package/src/TSL/Common.js +11 -2
- package/src/TSL/Displacement.js +6 -6
- package/src/TSL/EmissiveSampling.js +5 -5
- package/src/TSL/EnvironmentCDF.js +176 -0
- package/src/TSL/GenerateKernel.js +3 -3
- package/src/TSL/HitFacet.js +4 -4
- package/src/TSL/LightsDirect.js +8 -8
- package/src/TSL/LightsSampling.js +55 -37
- package/src/TSL/Random.js +1 -0
- package/src/TSL/ShadeKernel.js +75 -19
- package/src/TSL/Sun.js +40 -0
- package/src/TSL/TextureSampling.js +6 -7
- package/src/index.js +18 -0
- package/src/managers/CameraManager.js +169 -1
- package/src/managers/EnvironmentManager.js +263 -33
- package/src/managers/GoboManager.js +19 -8
- package/src/managers/IESManager.js +3 -3
- package/src/managers/LightManager.js +98 -5
- package/src/managers/MaterialDataManager.js +22 -2
- package/src/managers/TransformManager.js +26 -0
- package/src/managers/UniformManager.js +5 -3
- package/src/managers/VideoRenderManager.js +3 -1
- package/src/managers/timeline/CameraTrack.js +22 -0
- package/src/managers/timeline/TimelineManager.js +14 -0
- package/src/version.js +3 -0
- package/src/Processor/ProceduralSky.js +0 -291
|
@@ -148,7 +148,7 @@ export class NormalDepth extends RenderStage {
|
|
|
148
148
|
if ( ! pt ) return false;
|
|
149
149
|
|
|
150
150
|
const matAttr = pt.materialData?.materialStorageAttr;
|
|
151
|
-
const triSwapped = pt.
|
|
151
|
+
const triSwapped = pt.triangleGeoAttr && pt.triangleGeoAttr !== this._lastTriAttr;
|
|
152
152
|
const bvhSwapped = pt.bvhStorageAttr && pt.bvhStorageAttr !== this._lastBvhAttr;
|
|
153
153
|
const matSwapped = matAttr && matAttr !== this._lastMatAttr;
|
|
154
154
|
|
|
@@ -167,12 +167,13 @@ export class NormalDepth extends RenderStage {
|
|
|
167
167
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
if ( pt.
|
|
170
|
+
if ( pt.triangleGeoAttr && ! this._triStorageNode ) {
|
|
171
171
|
|
|
172
172
|
// uvec4, matching PathTracerStage: packed lanes must keep their exact bit pattern.
|
|
173
|
-
this._triStorageNode =
|
|
174
|
-
pt.
|
|
175
|
-
|
|
173
|
+
this._triStorageNode = {
|
|
174
|
+
geo: storage( pt.triangleGeoAttr, 'uvec4', pt.triangleGeoAttr.count ).toReadOnly(),
|
|
175
|
+
shade: storage( pt.triangleShadeAttr, 'uvec4', pt.triangleShadeAttr.count ).toReadOnly(),
|
|
176
|
+
};
|
|
176
177
|
|
|
177
178
|
}
|
|
178
179
|
|
|
@@ -193,7 +194,7 @@ export class NormalDepth extends RenderStage {
|
|
|
193
194
|
// In-place bucket swaps (model change) — graph closes over the nodes, only .value changes.
|
|
194
195
|
if ( this._linearBuckets ) refreshBucketTextureNodes( this._linearBuckets, pt.materialData?.linearBuckets );
|
|
195
196
|
|
|
196
|
-
this._lastTriAttr = pt.
|
|
197
|
+
this._lastTriAttr = pt.triangleGeoAttr || this._lastTriAttr;
|
|
197
198
|
this._lastBvhAttr = pt.bvhStorageAttr || this._lastBvhAttr;
|
|
198
199
|
this._lastMatAttr = matAttr || this._lastMatAttr;
|
|
199
200
|
|
package/src/Stages/PathTracer.js
CHANGED
|
@@ -188,7 +188,7 @@ export class PathTracer extends PathTracerStage {
|
|
|
188
188
|
} );
|
|
189
189
|
|
|
190
190
|
// Scene geometry (triangle data, two-level BVH, light BVH + emissive)
|
|
191
|
-
t.register( 'geometry', () => [ this.
|
|
191
|
+
t.register( 'geometry', () => [ this.triangleGeoAttr, this.triangleShadeAttr, this.bvhStorageAttr, this.lightStorageAttr ] );
|
|
192
192
|
|
|
193
193
|
// Material storage buffer + per-property texture arrays
|
|
194
194
|
t.register( 'materials', () => {
|
|
@@ -547,6 +547,107 @@ export class PathTracer extends PathTracerStage {
|
|
|
547
547
|
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
+
/**
|
|
551
|
+
* The accumulation as it stands, for a checkpoint: the three MRT attachments (aux only while it
|
|
552
|
+
* holds samples), the per-pixel convergence buffers, and the counters that decide the next
|
|
553
|
+
* sample — together what a later frame reads, so restoring them continues the same sequence.
|
|
554
|
+
* @returns {Promise<Object>} typed arrays, tight rows, top row first as the textures hold them
|
|
555
|
+
*/
|
|
556
|
+
async captureAccumulation() {
|
|
557
|
+
|
|
558
|
+
const pool = this.storageTextures;
|
|
559
|
+
const width = pool.renderWidth;
|
|
560
|
+
const height = pool.renderHeight;
|
|
561
|
+
const pixels = width * height;
|
|
562
|
+
|
|
563
|
+
const readAttachment = async index => {
|
|
564
|
+
|
|
565
|
+
const padded = await this.renderer.readRenderTargetPixelsAsync( pool.readTarget, 0, 0, width, height, index );
|
|
566
|
+
const stride = Math.ceil( width * 16 / 256 ) * 64;
|
|
567
|
+
if ( stride === width * 4 ) return new Float32Array( padded.buffer, padded.byteOffset, pixels * 4 ).slice();
|
|
568
|
+
const tight = new Float32Array( pixels * 4 );
|
|
569
|
+
for ( let y = 0; y < height; y ++ ) tight.set( padded.subarray( y * stride, y * stride + width * 4 ), y * width * 4 );
|
|
570
|
+
return tight;
|
|
571
|
+
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
const readBuffer = async ( attr, Type ) => attr ? new Type( await this.renderer.getArrayBufferAsync( attr, null, 0, pixels * 4 ) ) : null;
|
|
575
|
+
const aux = this._auxGBufferEnabled && this._auxSamples > 0;
|
|
576
|
+
|
|
577
|
+
// Every copy is submitted here, in this task, before any await: a frame rendered between two of
|
|
578
|
+
// them would give a checkpoint whose parts disagree.
|
|
579
|
+
const state = {
|
|
580
|
+
frameCount: this.frameCount,
|
|
581
|
+
seedTick: this._seedTick,
|
|
582
|
+
auxSamples: aux ? this._auxSamples : 0,
|
|
583
|
+
convergedFraction: this._convergedFraction,
|
|
584
|
+
convergedGeometryFraction: this._convergedGeometryFraction,
|
|
585
|
+
isComplete: this.isComplete,
|
|
586
|
+
};
|
|
587
|
+
const reads = [
|
|
588
|
+
readAttachment( 0 ),
|
|
589
|
+
aux ? readAttachment( 1 ) : null,
|
|
590
|
+
aux ? readAttachment( 2 ) : null,
|
|
591
|
+
readBuffer( this._m2Attr, Float32Array ),
|
|
592
|
+
readBuffer( this._streakAttr, Uint32Array ),
|
|
593
|
+
readBuffer( this._frozenMaskAttr, Uint32Array ),
|
|
594
|
+
];
|
|
595
|
+
const [ color, normalDepth, albedo, m2, streak, frozenMask ] = await Promise.all( reads );
|
|
596
|
+
|
|
597
|
+
return { width, height, state, color, normalDepth, albedo, m2, streak, frozenMask };
|
|
598
|
+
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Writes a {@link captureAccumulation} back, so the next frame continues it. The render size must
|
|
603
|
+
* match; nothing may reset accumulation after this.
|
|
604
|
+
*/
|
|
605
|
+
restoreAccumulation( checkpoint ) {
|
|
606
|
+
|
|
607
|
+
const pool = this.storageTextures;
|
|
608
|
+
const { width, height, state } = checkpoint;
|
|
609
|
+
if ( pool.renderWidth !== width || pool.renderHeight !== height ) {
|
|
610
|
+
|
|
611
|
+
throw new Error( `checkpoint is ${width}×${height}; the render is ${pool.renderWidth}×${pool.renderHeight}` );
|
|
612
|
+
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
const backend = this.renderer.backend;
|
|
616
|
+
const device = backend.device;
|
|
617
|
+
if ( ! backend.get( pool.readTarget.textures[ 0 ] ).texture ) this.renderer.initRenderTarget( pool.readTarget );
|
|
618
|
+
|
|
619
|
+
const writeAttachment = ( index, data ) => device.queue.writeTexture(
|
|
620
|
+
{ texture: backend.get( pool.readTarget.textures[ index ] ).texture },
|
|
621
|
+
data,
|
|
622
|
+
{ bytesPerRow: width * 16, rowsPerImage: height },
|
|
623
|
+
{ width, height },
|
|
624
|
+
);
|
|
625
|
+
|
|
626
|
+
const writeBuffer = ( attr, data ) => {
|
|
627
|
+
|
|
628
|
+
if ( attr && data ) device.queue.writeBuffer( backend.get( attr ).buffer, 0, data );
|
|
629
|
+
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
writeAttachment( 0, checkpoint.color );
|
|
633
|
+
if ( checkpoint.normalDepth ) writeAttachment( 1, checkpoint.normalDepth );
|
|
634
|
+
if ( checkpoint.albedo ) writeAttachment( 2, checkpoint.albedo );
|
|
635
|
+
writeBuffer( this._m2Attr, checkpoint.m2 );
|
|
636
|
+
writeBuffer( this._streakAttr, checkpoint.streak );
|
|
637
|
+
writeBuffer( this._frozenMaskAttr, checkpoint.frozenMask );
|
|
638
|
+
|
|
639
|
+
this.frameCount = state.frameCount;
|
|
640
|
+
this.frame.value = state.frameCount;
|
|
641
|
+
this._seedTick = state.seedTick;
|
|
642
|
+
this.hasPreviousAccumulated.value = state.frameCount > 0 ? 1 : 0;
|
|
643
|
+
this._auxSamples = checkpoint.normalDepth ? state.auxSamples : 0;
|
|
644
|
+
this._auxSeedPending = this._auxGBufferEnabled && ! checkpoint.normalDepth;
|
|
645
|
+
this._convergedFraction = state.convergedFraction ?? 0;
|
|
646
|
+
this._convergedGeometryFraction = state.convergedGeometryFraction ?? 0;
|
|
647
|
+
this.isComplete = false;
|
|
648
|
+
|
|
649
|
+
}
|
|
650
|
+
|
|
550
651
|
reset() {
|
|
551
652
|
|
|
552
653
|
super.reset();
|
|
@@ -1147,7 +1248,7 @@ export class PathTracer extends PathTracerStage {
|
|
|
1147
1248
|
|
|
1148
1249
|
const genParams = {
|
|
1149
1250
|
rayBufferRW: pb.rayBuffer.rw,
|
|
1150
|
-
|
|
1251
|
+
hitBufferRW: pb.hitBuffer.rw,
|
|
1151
1252
|
gBufferRW,
|
|
1152
1253
|
resolution: this.resolution,
|
|
1153
1254
|
// RNG axis only (baseSeed + stratified jitter) — takes the seed counter, not the
|
|
@@ -1458,8 +1559,7 @@ export class PathTracer extends PathTracerStage {
|
|
|
1458
1559
|
envCDFTexture: freshEnvCDF,
|
|
1459
1560
|
lightBuffer: freshLight,
|
|
1460
1561
|
rayBufferRW: pb.rayBuffer.rw,
|
|
1461
|
-
|
|
1462
|
-
hitBufferRO: pb.hitBuffer.ro,
|
|
1562
|
+
hitBufferRW: pb.hitBuffer.rw,
|
|
1463
1563
|
counters,
|
|
1464
1564
|
activeIndicesRO: this._sortMaterials ? qm.getSortedRO() : qm.getActiveReadRO(),
|
|
1465
1565
|
envTexture: freshEnvTex,
|
|
@@ -1512,6 +1612,10 @@ export class PathTracer extends PathTracerStage {
|
|
|
1512
1612
|
maxRayCount: this._wfMaxRayCount,
|
|
1513
1613
|
chunkRowBase: this._wfChunkRowBase,
|
|
1514
1614
|
auxGBufferEnabled: this._auxGBufferUniform,
|
|
1615
|
+
hasSun: this.hasSun,
|
|
1616
|
+
sunDirection: this.sunDirection,
|
|
1617
|
+
sunRadiance: this.sunRadiance,
|
|
1618
|
+
sunParams: this.sunParams,
|
|
1515
1619
|
} );
|
|
1516
1620
|
this._kernelManager.register( 'shade',
|
|
1517
1621
|
shadeFn().compute(
|