rayzee 11.2.1 → 11.4.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.
Files changed (76) hide show
  1. package/README.md +91 -34
  2. package/dist/ArchiveImporter-Cgyx5AF7.js +7860 -0
  3. package/dist/BidirectionalIntegrator-BKF-cwH2.js +954 -0
  4. package/dist/{BufferLayout-D_IBo2ci.js → BufferLayout-xPRH9jYD.js} +41 -5
  5. package/dist/{NeuralRetouch-Cr-otSW8.js → NeuralRetouch-C3Q2XqbF.js} +4 -3
  6. package/dist/{NeuralSuperRes-B7E3_M0t.js → NeuralSuperRes-DV5TtURP.js} +11 -5
  7. package/dist/{PathTracer-D6nbknj5.js → PathTracer-D3MvEaZK.js} +4384 -4618
  8. package/dist/{PhysicalSky-Dq5VSiCQ.js → PhysicalSky-CY4jiz6a.js} +2 -2
  9. package/dist/{RayzeeRenderer-DbjqO6v-.js → RayzeeRenderer-D23m6NqG.js} +486 -391
  10. package/dist/SolarLimb-bZE6y63S.js +762 -0
  11. package/dist/{ToneMapGPU-BOjpul7A.js → ToneMapGPU-CTDBvmmS.js} +31 -22
  12. package/dist/addons/archives.es.js +1 -1
  13. package/dist/addons/bidirectional.es.js +1 -1
  14. package/dist/addons/physical-sky.es.js +1 -1
  15. package/dist/rayzee-core.es.js +7 -7
  16. package/dist/rayzee.es.js +1327 -838
  17. package/dist/rayzee.umd.js +146 -134
  18. package/dist/sceneCachePolicy-AKOEu2lf.js +1602 -0
  19. package/package.json +1 -1
  20. package/src/EngineDefaults.js +2 -2
  21. package/src/Passes/AIUpscaler.js +2 -0
  22. package/src/PathTracerApp.js +126 -19
  23. package/src/Pipeline/CompletionTracker.js +7 -3
  24. package/src/Processor/ArchiveImporter.js +173 -94
  25. package/src/Processor/ArchiveReader.js +20 -23
  26. package/src/Processor/AssetLoader.js +48 -1
  27. package/src/Processor/BVHRefitter.js +109 -13
  28. package/src/Processor/BufferLayout.js +115 -0
  29. package/src/Processor/ChunkedRecords.js +3 -2
  30. package/src/Processor/EmissiveTriangleBuilder.js +6 -6
  31. package/src/Processor/GeometryExtractor.js +189 -79
  32. package/src/Processor/HostMemory.js +39 -9
  33. package/src/Processor/InstanceTable.js +714 -42
  34. package/src/Processor/PBRT/PBRTCurves.js +224 -6
  35. package/src/Processor/PBRT/PBRTMaterials.js +3 -0
  36. package/src/Processor/PBRT/PBRTSceneBuilder.js +82 -25
  37. package/src/Processor/PackedRayBuffer.js +5 -2
  38. package/src/Processor/SceneProcessor.js +747 -141
  39. package/src/Processor/TLASBuilder.js +32 -17
  40. package/src/Processor/ToneMapCPU.js +16 -4
  41. package/src/Processor/ToneMapGPU.js +30 -14
  42. package/src/Processor/USD/USDLayer.js +1149 -0
  43. package/src/Processor/USD/USDScene.js +1655 -0
  44. package/src/Processor/USD/USDStage.js +682 -0
  45. package/src/Processor/USD/USDText.js +674 -0
  46. package/src/Processor/USD/index.js +138 -0
  47. package/src/Processor/Workers/BVHRefitWorker.js +3 -3
  48. package/src/RayzeeRenderer.js +221 -33
  49. package/src/RenderSettings.js +4 -2
  50. package/src/Stages/AutoExposure.js +484 -494
  51. package/src/Stages/Compositor.js +27 -6
  52. package/src/Stages/LocalExposure.js +546 -0
  53. package/src/Stages/NormalDepth.js +7 -12
  54. package/src/Stages/PathTracer.js +18 -21
  55. package/src/Stages/PathTracerStage.js +282 -103
  56. package/src/Storage/GeometrySpill.js +46 -14
  57. package/src/Storage/SceneGraphCodec.js +17 -3
  58. package/src/Storage/SpillStore.js +9 -0
  59. package/src/TSL/BVHTraversal.js +183 -7
  60. package/src/TSL/Common.js +57 -13
  61. package/src/TSL/ShadeKernel.js +3 -2
  62. package/src/TSL/TextureSampling.js +11 -8
  63. package/src/TSL/patches.js +84 -0
  64. package/src/index.js +1 -0
  65. package/src/integrators/BidirectionalIntegrator.js +20 -2
  66. package/src/managers/DenoisingManager.js +15 -19
  67. package/src/managers/InteractionManager.js +19 -6
  68. package/src/managers/MaterialDataManager.js +22 -5
  69. package/src/managers/UniformManager.js +3 -0
  70. package/src/managers/VideoRenderManager.js +30 -4
  71. package/src/neural/NeuralRetouch.js +1 -0
  72. package/src/neural/NeuralSuperRes.js +6 -1
  73. package/dist/ArchiveImporter-D_x863yu.js +0 -5198
  74. package/dist/BidirectionalIntegrator-DmkxxEOR.js +0 -946
  75. package/dist/SolarLimb-CPaeZVwz.js +0 -721
  76. package/dist/sceneCachePolicy-C4-4qwt6.js +0 -485
@@ -57,7 +57,6 @@ export class PathTracer extends PathTracerStage {
57
57
  this._packedBuffers = null;
58
58
  this._queueManager = null;
59
59
  this._kernelManager = null;
60
- this._gBufferAttr = null; // per-pixel first-hit MRT (ND + albedo); see _buildWavefrontKernels
61
60
  this._m2Attr = null; // per-pixel running mean of luminance² for the Tier-1 convergence early-stop
62
61
  this._streakAttr = null; // Tier-2: per-pixel freeze-candidate streak (u32); frozen := streak >= K
63
62
  // Tier-2 dilation: per-pixel frozen mask (1=skip), written race-free in buildActivePixels; a frozen pixel
@@ -209,7 +208,6 @@ export class PathTracer extends PathTracerStage {
209
208
  t.register( 'gbuffer', () => {
210
209
 
211
210
  const a = [];
212
- if ( this._gBufferAttr ) a.push( this._gBufferAttr );
213
211
  if ( this._m2Attr ) a.push( this._m2Attr );
214
212
  if ( this._streakAttr ) a.push( this._streakAttr );
215
213
  if ( this._frozenMaskAttr ) a.push( this._frozenMaskAttr );
@@ -226,7 +224,8 @@ export class PathTracer extends PathTracerStage {
226
224
  } );
227
225
 
228
226
  // Scene geometry (triangle data, two-level BVH, light BVH + emissive)
229
- t.register( 'geometry', () => [ this.triangleGeoAttr, this.triangleShadeAttr, this.bvhStorageAttr, this.lightStorageAttr ] );
227
+ // The light data shares the materials' buffer and is counted with them.
228
+ t.register( 'geometry', () => [ ...( this._geoParts?.attrs ?? [] ), ...( this._shadeParts?.attrs ?? [] ), ...( this._bvhParts?.attrs ?? [ this.bvhStorageAttr ] ) ] );
230
229
 
231
230
  // Material storage buffer + per-property texture arrays
232
231
  t.register( 'materials', () => {
@@ -1094,9 +1093,9 @@ export class PathTracer extends PathTracerStage {
1094
1093
  */
1095
1094
  _willReadCountersThisFrame() {
1096
1095
 
1097
- if ( this.cameraChanged || this.cameraOptimizer?.isInInteractionMode() ) return false;
1096
+ if ( this.cameraOptimizer?.isInInteractionMode() ) return false;
1098
1097
  if ( this._lockstep ) return ! this._lockstepRead && this.frameCount % this._readbackEveryNFrames === 0;
1099
- if ( this._readbackPending || this._convergedReadbackPending ) return false;
1098
+ if ( this.cameraChanged || this._readbackPending || this._convergedReadbackPending ) return false;
1100
1099
  return this._readbackFrameCounter + 1 >= this._readbackEveryNFrames;
1101
1100
 
1102
1101
  }
@@ -1208,9 +1207,11 @@ export class PathTracer extends PathTracerStage {
1208
1207
 
1209
1208
  _issueLockstepReadback() {
1210
1209
 
1211
- // One in flight, and none mid-motion: frames there do not count, so frameCount stands still.
1210
+ // One in flight, and none in interaction mode: frames there do not count, so frameCount stands still. A moved
1211
+ // camera skips none: a reset's frame 0 sees one whenever the frame before it traced another view, and skipping
1212
+ // it there made the render depend on what was traced before.
1212
1213
  if ( this._lockstepRead || this.frameCount % this._readbackEveryNFrames !== 0 ) return;
1213
- if ( this.cameraChanged || this.cameraOptimizer?.isInInteractionMode() ) return;
1214
+ if ( this.cameraOptimizer?.isInInteractionMode() ) return;
1214
1215
 
1215
1216
  const bounceAttr = this._queueManager?.getBounceCountsAttribute();
1216
1217
  const counterAttr = this._queueManager?.getCountersAttribute();
@@ -1369,8 +1370,9 @@ export class PathTracer extends PathTracerStage {
1369
1370
  _computePathBudget() {
1370
1371
 
1371
1372
  const RAY_BYTES = RAY_STRIDE * 16;
1372
- const HIT_BYTES = ( this._integrator?.hitStride ?? HIT_STRIDE ) * 16;
1373
- const bytesPerPath = RAY_BYTES + HIT_BYTES + GBUFFER_STRIDE * 16
1373
+ // The hit buffer carries the G-buffer as its last region.
1374
+ const HIT_BYTES = ( ( this._integrator?.hitStride ?? HIT_STRIDE ) + GBUFFER_STRIDE ) * 16;
1375
+ const bytesPerPath = RAY_BYTES + HIT_BYTES
1374
1376
  + 4 + 4 /* activeIndices A/B */ + 4;
1375
1377
 
1376
1378
  const limits = this.renderer?.backend?.device?.limits;
@@ -1493,15 +1495,12 @@ export class PathTracer extends PathTracerStage {
1493
1495
 
1494
1496
  }
1495
1497
 
1496
- // Per-CHUNK first-hit G-buffer (LOCAL slot r, size B), 1 uvec4/slot half-packed (pack2x16). Written by
1497
- // Generate + Shade(bounce 0), read by Shade + FinalWrite within the SAME chunk, so per-chunk suffices.
1498
- // uint (not f32): packed lanes can hit the NaN exponent range (snorm 1.0 → 0x7FFF) that an f32 store may
1499
- // canonicalize; u32 stores the bits verbatim.
1500
- const gBufferVec4s = B * GBUFFER_STRIDE;
1501
- freeStorageAttribute( this.renderer, this._gBufferAttr );
1502
- this._gBufferAttr = gpuOnlyStorageAttribute( gBufferVec4s, 4, Uint32Array );
1503
- const gBufferRW = storage( this._gBufferAttr, 'uvec4' );
1504
- const gBufferRO = storage( this._gBufferAttr, 'uvec4' ).toReadOnly();
1498
+ // Per-CHUNK first-hit G-buffer (LOCAL slot r, size B), 1 uvec4/slot half-packed (pack2x16), the hit buffer's
1499
+ // last region (PackedRayBuffer). Written by Generate + Shade(bounce 0), read by Shade + FinalWrite within the
1500
+ // SAME chunk, so per-chunk suffices. uint (not f32): packed lanes can hit the NaN exponent range (snorm 1.0 →
1501
+ // 0x7FFF) that an f32 store may canonicalize; u32 stores the bits verbatim.
1502
+ const gBufferRW = this._packedBuffers.hitBuffer.rw;
1503
+ const gBufferRO = this._packedBuffers.hitBuffer.ro;
1505
1504
 
1506
1505
  // Per-PIXEL persistent buffers (m2/streak/frozenMask) are GLOBAL-pixel-indexed (p = pixelBase + r) and
1507
1506
  // must span the whole frame across chunks AND persist across frames, so they're sized to the reserved
@@ -1842,7 +1841,7 @@ export class PathTracer extends PathTracerStage {
1842
1841
  const freshTri = this.triangleStorageNode;
1843
1842
  const freshMat = this.materialData.materialStorageNode;
1844
1843
  const freshEnvCDF = texture( this.environment.envCDFTexture ); // independent CDF texture node; refreshed in _refreshWfTextureNodes
1845
- const freshLight = this.lightStorageNode;
1844
+ const freshLight = this.lightDataNode;
1846
1845
  // Independent texture nodes (never compiled elsewhere) avoid Three.js TextureNode caching across pipelines; refreshed via _refreshWfTextureNodes.
1847
1846
  const _mat = this.materialData;
1848
1847
  const _env = this.environment;
@@ -2231,7 +2230,6 @@ export class PathTracer extends PathTracerStage {
2231
2230
  this._packedBuffers?.dispose();
2232
2231
  this._queueManager?.dispose();
2233
2232
  this._kernelManager?.dispose();
2234
- this._gBufferAttr?.dispose?.();
2235
2233
  this._m2Attr?.dispose?.();
2236
2234
  this._streakAttr?.dispose?.();
2237
2235
  this._frozenMaskAttr?.dispose?.();
@@ -2241,7 +2239,6 @@ export class PathTracer extends PathTracerStage {
2241
2239
  this._packedBuffers = null;
2242
2240
  this._queueManager = null;
2243
2241
  this._kernelManager = null;
2244
- this._gBufferAttr = null;
2245
2242
  this._m2Attr = null;
2246
2243
  this._streakAttr = null;
2247
2244
  this._frozenMaskAttr = null;