rayzee 11.2.1 → 11.3.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 (62) hide show
  1. package/README.md +58 -29
  2. package/dist/ArchiveImporter-D735xX-4.js +7860 -0
  3. package/dist/BidirectionalIntegrator-M89c0AlP.js +954 -0
  4. package/dist/{BufferLayout-D_IBo2ci.js → BufferLayout-xPRH9jYD.js} +41 -5
  5. package/dist/{NeuralRetouch-Cr-otSW8.js → NeuralRetouch-DiBH63kz.js} +1 -1
  6. package/dist/{NeuralSuperRes-B7E3_M0t.js → NeuralSuperRes-CZNQP13W.js} +1 -1
  7. package/dist/{PathTracer-D6nbknj5.js → PathTracer-BXCCVrPK.js} +4371 -4612
  8. package/dist/{PhysicalSky-Dq5VSiCQ.js → PhysicalSky-DqmaS0lb.js} +2 -2
  9. package/dist/{RayzeeRenderer-DbjqO6v-.js → RayzeeRenderer-DUSMFhmc.js} +426 -363
  10. package/dist/SolarLimb-bZE6y63S.js +762 -0
  11. package/dist/addons/archives.es.js +1 -1
  12. package/dist/addons/bidirectional.es.js +1 -1
  13. package/dist/addons/physical-sky.es.js +1 -1
  14. package/dist/rayzee-core.es.js +7 -7
  15. package/dist/rayzee.es.js +472 -468
  16. package/dist/rayzee.umd.js +106 -105
  17. package/dist/sceneCachePolicy-BAib5fCp.js +1602 -0
  18. package/package.json +1 -1
  19. package/src/PathTracerApp.js +4 -3
  20. package/src/Processor/ArchiveImporter.js +173 -94
  21. package/src/Processor/ArchiveReader.js +20 -23
  22. package/src/Processor/AssetLoader.js +48 -1
  23. package/src/Processor/BVHRefitter.js +109 -13
  24. package/src/Processor/BufferLayout.js +115 -0
  25. package/src/Processor/ChunkedRecords.js +3 -2
  26. package/src/Processor/EmissiveTriangleBuilder.js +6 -6
  27. package/src/Processor/GeometryExtractor.js +189 -79
  28. package/src/Processor/HostMemory.js +39 -9
  29. package/src/Processor/InstanceTable.js +714 -42
  30. package/src/Processor/PBRT/PBRTCurves.js +224 -6
  31. package/src/Processor/PBRT/PBRTMaterials.js +3 -0
  32. package/src/Processor/PBRT/PBRTSceneBuilder.js +82 -25
  33. package/src/Processor/PackedRayBuffer.js +5 -2
  34. package/src/Processor/SceneProcessor.js +747 -141
  35. package/src/Processor/TLASBuilder.js +32 -17
  36. package/src/Processor/USD/USDLayer.js +1149 -0
  37. package/src/Processor/USD/USDScene.js +1655 -0
  38. package/src/Processor/USD/USDStage.js +682 -0
  39. package/src/Processor/USD/USDText.js +674 -0
  40. package/src/Processor/USD/index.js +138 -0
  41. package/src/Processor/Workers/BVHRefitWorker.js +3 -3
  42. package/src/RayzeeRenderer.js +167 -26
  43. package/src/Stages/NormalDepth.js +7 -12
  44. package/src/Stages/PathTracer.js +12 -17
  45. package/src/Stages/PathTracerStage.js +273 -96
  46. package/src/Storage/GeometrySpill.js +46 -14
  47. package/src/Storage/SceneGraphCodec.js +17 -3
  48. package/src/Storage/SpillStore.js +9 -0
  49. package/src/TSL/BVHTraversal.js +183 -7
  50. package/src/TSL/Common.js +57 -13
  51. package/src/TSL/ShadeKernel.js +3 -2
  52. package/src/TSL/TextureSampling.js +11 -8
  53. package/src/TSL/patches.js +84 -0
  54. package/src/integrators/BidirectionalIntegrator.js +20 -2
  55. package/src/managers/DenoisingManager.js +4 -4
  56. package/src/managers/InteractionManager.js +19 -6
  57. package/src/managers/MaterialDataManager.js +22 -5
  58. package/src/managers/UniformManager.js +3 -0
  59. package/dist/ArchiveImporter-D_x863yu.js +0 -5198
  60. package/dist/BidirectionalIntegrator-DmkxxEOR.js +0 -946
  61. package/dist/SolarLimb-CPaeZVwz.js +0 -721
  62. package/dist/sceneCachePolicy-C4-4qwt6.js +0 -485
@@ -94,9 +94,10 @@ export class TLASBuilder {
94
94
  */
95
95
  build( table ) {
96
96
 
97
- const aabbs = new Float64Array( table.count * 6 );
98
- table.writeWorldAABBs( aabbs );
99
- const built = this.buildStructure( aabbs, table.count );
97
+ const clustered = table.clusterCount > 0;
98
+ const aabbs = clustered ? table.clusterBounds : new Float64Array( table.entryCount * 6 );
99
+ if ( ! clustered ) table.writeEntryWorldAABBs( aabbs );
100
+ const built = this.buildStructure( aabbs, clustered ? table.clusterCount : table.entryCount );
100
101
  TLASBuilder.fillLeaves( built.data, built.nodeCount, table );
101
102
  return built;
102
103
 
@@ -235,22 +236,34 @@ export class TLASBuilder {
235
236
  */
236
237
  static fillLeaves( data, nodeCount, table ) {
237
238
 
238
- const world = table.world, src = table.sourceMesh;
239
- const blasOffset = table.tplBlasOffset, visible = table.visible, leafOf = table.tlasLeafIndex;
240
239
  const idx = bvhIndexView( data );
241
240
 
241
+ if ( table.clusterCount > 0 ) {
242
+
243
+ // Built over clusters: each leaf holds one, its copies' transforms in records (table.writeRecord).
244
+ for ( let node = 0; node < nodeCount; node ++ ) {
245
+
246
+ const o = node * FLOATS_PER_NODE;
247
+ if ( idx[ o + 3 ] === BVH_LEAF_MARKERS.BLAS_POINTER_LEAF ) table.writeClusterLeaf( data, idx, o, idx[ o + 1 ], table.clusterWorld, node );
248
+
249
+ }
250
+
251
+ return;
252
+
253
+ }
254
+
242
255
  for ( let node = 0; node < nodeCount; node ++ ) {
243
256
 
244
257
  const o = node * FLOATS_PER_NODE;
245
258
  if ( idx[ o + 3 ] !== BVH_LEAF_MARKERS.BLAS_POINTER_LEAF ) continue;
246
259
 
247
- const i = idx[ o + 1 ] & TLAS_PLACEMENT_MASK;
248
- idx[ o ] = blasOffset[ src[ i ] ];
249
- data[ o + 2 ] = visible[ i ] ? 1.0 : 0.0;
260
+ const e = idx[ o + 1 ] & TLAS_PLACEMENT_MASK;
261
+ idx[ o ] = table.entryRoot( e );
262
+ data[ o + 2 ] = table.entryVisible( e ) ? 1.0 : 0.0;
250
263
 
251
- TLASBuilder.writeLeafMatrix( data, idx, o, world, i );
264
+ TLASBuilder.writeLeafMatrix( data, idx, o, table, table.repOf( e ), e );
252
265
 
253
- leafOf[ i ] = node;
266
+ table.setLeafOf( e, node );
254
267
 
255
268
  }
256
269
 
@@ -261,25 +274,27 @@ export class TLASBuilder {
261
274
  * its own whenever a placement moves, so a rigid transform costs a matrix rather than a
262
275
  * rewrite of the geometry the placement may be sharing.
263
276
  *
264
- * Slot [1] is rewritten too: the placement index, with {@link TLAS_LEAF_IDENTITY} set when
265
- * the matrix is identity so traversal can skip the ray transform for that leaf.
277
+ * Slot [1] is rewritten too: the TLAS entry (the placement, unless placements are grouped), with
278
+ * {@link TLAS_LEAF_IDENTITY} set when the matrix is identity so traversal can skip the ray transform for that leaf.
266
279
  *
267
280
  * @param {Float32Array} data - the node buffer, or one chunk of it
268
281
  * @param {Uint32Array} idx - u32 view over the same memory as `data`
269
282
  * @param {number} off - float offset of the leaf within `data`
270
- * @param {Float32Array} world - the instance table's object-to-world column
271
- * @param {number} placement
283
+ * @param {import('./InstanceTable.js').InstanceTable} table
284
+ * @param {number} placement - whose transform the leaf carries
285
+ * @param {number} [entry] - the TLAS entry it stands for
272
286
  */
273
- static writeLeafMatrix( data, idx, off, world, placement ) {
287
+ static writeLeafMatrix( data, idx, off, table, placement, entry = placement ) {
274
288
 
275
289
  const inv = _inverseScratch;
276
- invertAffineInto( world, placement * 16, inv );
290
+ const row = table.matrixRow( placement ), world = table.rowArray;
291
+ invertAffineInto( world, row, inv );
277
292
 
278
293
  data[ off + 4 ] = inv[ 0 ]; data[ off + 5 ] = inv[ 4 ]; data[ off + 6 ] = inv[ 8 ]; data[ off + 7 ] = inv[ 12 ];
279
294
  data[ off + 8 ] = inv[ 1 ]; data[ off + 9 ] = inv[ 5 ]; data[ off + 10 ] = inv[ 9 ]; data[ off + 11 ] = inv[ 13 ];
280
295
  data[ off + 12 ] = inv[ 2 ]; data[ off + 13 ] = inv[ 6 ]; data[ off + 14 ] = inv[ 10 ]; data[ off + 15 ] = inv[ 14 ];
281
296
 
282
- idx[ off + 1 ] = ( placement | ( isIdentityAt( world, placement * 16 ) ? TLAS_LEAF_IDENTITY : 0 ) ) >>> 0;
297
+ idx[ off + 1 ] = ( entry | ( isIdentityAt( world, row ) ? TLAS_LEAF_IDENTITY : 0 ) ) >>> 0;
283
298
 
284
299
  }
285
300