rayzee 10.0.0 → 11.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.
Files changed (176) hide show
  1. package/README.md +252 -44
  2. package/dist/ActiveColor-YvuQq44O.js +13 -0
  3. package/dist/ArchiveImporter-Hn35o6Z5.js +5145 -0
  4. package/dist/AssetConfig-DSEntE65.js +30 -0
  5. package/dist/BidirectionalIntegrator-CBw8hkeu.js +946 -0
  6. package/dist/BufferLayout-D_IBo2ci.js +150 -0
  7. package/dist/ColorManagement-oeEk7oSu.js +1488 -0
  8. package/dist/EngineEvents-Ci8dVWCP.js +73 -0
  9. package/dist/EngineIssues-CIZnXHsF.js +72 -0
  10. package/dist/FileFormats-sPGJeCRc.js +102 -0
  11. package/dist/Logger-dDDGj9Av.js +97 -0
  12. package/dist/{NeuralRetouch-CYgkQY8Z.js → NeuralRetouch-BzNpiVHZ.js} +8 -6
  13. package/dist/{NeuralSuperRes-PkgDLQcD.js → NeuralSuperRes-Bk7bHg2B.js} +55 -120
  14. package/dist/PathTracer-72XufKAr.js +29976 -0
  15. package/dist/PhysicalSky-BgjdV88k.js +1219 -0
  16. package/dist/RayzeeRenderer-1QRO97eq.js +3551 -0
  17. package/dist/SolarLimb-CPaeZVwz.js +721 -0
  18. package/dist/ToneMapGPU-CjU3osDd.js +177 -0
  19. package/dist/ViewTransforms-CYN7bq2w.js +255 -0
  20. package/dist/WorkingMatrix-C6y233hT.js +27 -0
  21. package/dist/ZipReader-gDSWr0I5.js +98 -0
  22. package/dist/addons/archives.es.js +3 -0
  23. package/dist/addons/bidirectional.es.js +2 -0
  24. package/dist/addons/color.es.js +3 -0
  25. package/dist/addons/formats.es.js +2 -0
  26. package/dist/addons/physical-sky.es.js +2 -0
  27. package/dist/addons/storage.es.js +3 -0
  28. package/dist/archiveFormats-tnAoUL1j.js +94 -0
  29. package/dist/identity-DrQsGT2o.js +39 -0
  30. package/dist/openStorage-DwcBRUj7.js +820 -0
  31. package/dist/rayzee-core.es.js +12 -0
  32. package/dist/rayzee.es.js +2551 -44024
  33. package/dist/rayzee.umd.js +528 -487
  34. package/dist/sceneCachePolicy-C67jbci-.js +443 -0
  35. package/dist/shared-BGBcSxBQ.js +17 -0
  36. package/package.json +23 -2
  37. package/src/Color/ActiveColor.js +34 -0
  38. package/src/Color/BasicColor.js +147 -0
  39. package/src/Color/ColorManagement.js +7 -31
  40. package/src/Color/ViewTransforms.js +5 -1
  41. package/src/EngineDefaults.js +62 -1029
  42. package/src/EngineEvents.js +2 -0
  43. package/src/EngineIssues.js +2 -0
  44. package/src/Headless.js +6 -5
  45. package/src/Passes/AIUpscaler.js +58 -141
  46. package/src/Passes/OIDNDenoiser.js +92 -65
  47. package/src/Passes/OIDNTemporalHistory.js +1 -1
  48. package/src/PathTracerApp.js +620 -4026
  49. package/src/Pipeline/PipelineContext.js +0 -4
  50. package/src/Platform.js +36 -0
  51. package/src/Processor/ArchiveCache.js +20 -7
  52. package/src/Processor/ArchiveImporter.js +1265 -0
  53. package/src/Processor/ArchiveReader.js +22 -4
  54. package/src/Processor/AssetLoader.js +327 -1763
  55. package/src/Processor/AtmosphereModel.js +1 -2
  56. package/src/Processor/BVHBuilder.js +14 -126
  57. package/src/Processor/BVHLeafFold.js +4 -6
  58. package/src/Processor/BVHRefitter.js +67 -46
  59. package/src/Processor/BufferLayout.js +291 -0
  60. package/src/Processor/EmissiveTriangleBuilder.js +1 -1
  61. package/src/Processor/EnvironmentExactTable.js +187 -0
  62. package/src/Processor/EquirectHDRInfo.js +30 -223
  63. package/src/Processor/FileFormats.js +116 -0
  64. package/src/Processor/GLTFDecoders.js +85 -0
  65. package/src/Processor/GLTFDiffuseTransmission.js +63 -0
  66. package/src/Processor/GeometryExtractor.js +15 -5
  67. package/src/Processor/HostMemory.js +7 -1
  68. package/src/Processor/IESParser.js +47 -35
  69. package/src/Processor/InstanceTable.js +1 -1
  70. package/src/Processor/KernelManager.js +35 -2
  71. package/src/Processor/MaterialPacking.js +10 -8
  72. package/src/Processor/PBRT/PBRTMaterials.js +254 -42
  73. package/src/Processor/PBRT/PBRTParser.js +49 -19
  74. package/src/Processor/PBRT/PBRTScattering.js +93 -0
  75. package/src/Processor/PBRT/PBRTSceneBuilder.js +1050 -75
  76. package/src/Processor/PBRT/PBRTTextureBake.js +179 -0
  77. package/src/Processor/PBRT/PFM.js +59 -0
  78. package/src/Processor/PackedRayBuffer.js +116 -9
  79. package/src/Processor/ParallelBVHBuilder.js +3 -6
  80. package/src/Processor/PhysicalSky.js +5 -4
  81. package/src/Processor/PlatformImageLoader.js +50 -6
  82. package/src/Processor/QueueManager.js +39 -5
  83. package/src/Processor/ReinsertionOptimizer.js +2 -2
  84. package/src/Processor/SceneMetadata.js +30 -5
  85. package/src/Processor/SceneProcessor.js +53 -62
  86. package/src/Processor/ShaderBuilder.js +6 -16
  87. package/src/Processor/SimpleSky.js +1 -62
  88. package/src/Processor/SolarLimb.js +3 -0
  89. package/src/Processor/SplitBLAS.js +1 -1
  90. package/src/Processor/StorageTexturePool.js +22 -1
  91. package/src/Processor/TLASBuilder.js +1 -3
  92. package/src/Processor/TextureBuckets.js +237 -0
  93. package/src/Processor/TextureCreator.js +181 -8
  94. package/src/Processor/ToneMapGPU.js +64 -15
  95. package/src/Processor/Workers/BVHRefitWorker.js +5 -2
  96. package/src/Processor/Workers/BVHSubtreeWorker.js +1 -34
  97. package/src/Processor/Workers/BVHWorker.js +5 -18
  98. package/src/Processor/Workers/CDFWorker.js +6 -183
  99. package/src/Processor/Workers/TexturesWorker.js +103 -18
  100. package/src/Processor/archiveFormats.js +7 -0
  101. package/src/Processor/utils.js +2 -1
  102. package/src/RayzeeRenderer.js +3900 -0
  103. package/src/RenderSettings.js +68 -62
  104. package/src/Stages/ASVGF.js +13 -14
  105. package/src/Stages/AutoExposure.js +17 -17
  106. package/src/Stages/BilateralFilter.js +2 -1
  107. package/src/Stages/Compositor.js +8 -23
  108. package/src/Stages/DenoiserSettings.js +182 -0
  109. package/src/Stages/EdgeFilter.js +2 -1
  110. package/src/Stages/MotionVector.js +1 -1
  111. package/src/Stages/NRD.js +11 -5
  112. package/src/Stages/NormalDepth.js +12 -8
  113. package/src/Stages/PathTracer.js +336 -43
  114. package/src/Stages/PathTracerStage.js +69 -66
  115. package/src/Stages/Variance.js +1 -1
  116. package/src/Storage/BLASCache.js +1 -1
  117. package/src/Storage/CDFCache.js +18 -17
  118. package/src/Storage/DownloadCache.js +1 -1
  119. package/src/Storage/SceneGraphCodec.js +46 -3
  120. package/src/Storage/SpillStore.js +1 -1
  121. package/src/Storage/StorageManager.js +45 -9
  122. package/src/Storage/areas.js +4 -0
  123. package/src/TSL/BVHTraversal.js +50 -25
  124. package/src/TSL/Bidirectional.js +208 -0
  125. package/src/TSL/BidirectionalLamps.js +132 -0
  126. package/src/TSL/Clearcoat.js +15 -6
  127. package/src/TSL/Common.js +20 -15
  128. package/src/TSL/ConnectKernel.js +167 -0
  129. package/src/TSL/Debugger.js +1 -1
  130. package/src/TSL/Displacement.js +4 -3
  131. package/src/TSL/EmissiveSampling.js +65 -18
  132. package/src/TSL/Environment.js +77 -106
  133. package/src/TSL/EnvironmentCDF.js +85 -39
  134. package/src/TSL/ExtendKernel.js +8 -3
  135. package/src/TSL/FinalWriteKernel.js +4 -4
  136. package/src/TSL/GenerateKernel.js +18 -4
  137. package/src/TSL/HitFacet.js +35 -5
  138. package/src/TSL/LightBVHSampling.js +40 -9
  139. package/src/TSL/LightGenerateKernel.js +293 -0
  140. package/src/TSL/LightGuide.js +198 -0
  141. package/src/TSL/LightSplatKernel.js +180 -0
  142. package/src/TSL/LightVisibility.js +111 -0
  143. package/src/TSL/LightsCore.js +13 -38
  144. package/src/TSL/LightsDirect.js +28 -29
  145. package/src/TSL/LightsIndirect.js +3 -1
  146. package/src/TSL/LightsSampling.js +239 -51
  147. package/src/TSL/MaterialEvaluation.js +113 -31
  148. package/src/TSL/MaterialProperties.js +44 -17
  149. package/src/TSL/MaterialTransmission.js +52 -47
  150. package/src/TSL/MergeKernel.js +224 -0
  151. package/src/TSL/PathTracerCore.js +65 -29
  152. package/src/TSL/Random.js +5 -1
  153. package/src/TSL/SceneResources.js +51 -0
  154. package/src/TSL/ShadeKernel.js +985 -101
  155. package/src/TSL/Struct.js +10 -0
  156. package/src/TSL/Sun.js +1 -1
  157. package/src/TSL/TextureSampling.js +66 -61
  158. package/src/addons/archives.js +14 -0
  159. package/src/addons/bidirectional.js +13 -0
  160. package/src/addons/color.js +32 -0
  161. package/src/addons/formats.js +16 -0
  162. package/src/addons/physicalSky.js +14 -0
  163. package/src/addons/storage.js +19 -0
  164. package/src/core.js +31 -0
  165. package/src/index.js +13 -23
  166. package/src/integrators/BidirectionalIntegrator.js +838 -0
  167. package/src/managers/AnimationManager.js +88 -6
  168. package/src/managers/CameraManager.js +103 -46
  169. package/src/managers/DenoisingManager.js +14 -10
  170. package/src/managers/EnvironmentManager.js +125 -103
  171. package/src/managers/GoboManager.js +9 -0
  172. package/src/managers/MaterialDataManager.js +48 -37
  173. package/src/managers/UniformManager.js +32 -10
  174. package/dist/ToneMapGPU-B6XIe3DU.js +0 -544
  175. package/dist/rolldown-runtime-CAFD8bLK.js +0 -11
  176. package/src/Processor/TreeletOptimizer.js +0 -574
package/src/TSL/Struct.js CHANGED
@@ -68,6 +68,11 @@ export const RayTracingMaterial = struct( {
68
68
  iridescenceThicknessMapIndex: 'int',
69
69
  specularIntensityMapIndex: 'int',
70
70
  specularColorMapIndex: 'int',
71
+ // KHR_materials_diffuse_transmission: the diffuse lobe's share sent through to the other side, and its tint.
72
+ diffuseTransmission: 'float',
73
+ diffuseTransmissionColor: 'vec3',
74
+ diffuseTransmissionMapIndex: 'int',
75
+ diffuseTransmissionColorMapIndex: 'int',
71
76
  } );
72
77
 
73
78
  // Result of folding the glTF extension textures into their scalar factors (applyExtensionMaps).
@@ -82,6 +87,8 @@ export const ExtMapResult = struct( {
82
87
  iridescenceThickness: 'float', // resolved thin-film thickness → written into iridescenceThicknessRange.y
83
88
  specularIntensity: 'float',
84
89
  specularColor: 'vec3',
90
+ diffuseTransmission: 'float',
91
+ diffuseTransmissionColor: 'vec3',
85
92
  } );
86
93
 
87
94
  // Lightweight material for shadow ray evaluation — only the fields needed
@@ -159,6 +166,8 @@ export const DirectionSample = struct( {
159
166
  isTransmission: 'bool',
160
167
  // Spectral tint from the transmission sampler; vec3(1) for every reflection lobe.
161
168
  colorWeight: 'vec3',
169
+ // Drawn from the diffuse transmission lobe: `value` is its BTDF and the direction is below N.
170
+ isDiffuseTransmission: 'bool',
162
171
  } );
163
172
 
164
173
  export const BRDFWeights = struct( {
@@ -168,6 +177,7 @@ export const BRDFWeights = struct( {
168
177
  clearcoat: 'float',
169
178
  transmission: 'float',
170
179
  iridescence: 'float',
180
+ diffuseTransmission: 'float',
171
181
  } );
172
182
 
173
183
 
package/src/TSL/Sun.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Fn, float, vec3, sqrt, max, dot, cross, pow, cos, sin, abs, normalize, select, If } from 'three/tsl';
2
2
 
3
- import { LIMB_DARKENING_EXPONENT } from '../Processor/AtmosphereModel.js';
3
+ import { LIMB_DARKENING_EXPONENT } from '../Processor/SolarLimb.js';
4
4
 
5
5
  const LIMB_EXPONENT = vec3( ...LIMB_DARKENING_EXPONENT );
6
6
  // µ^α averages to 2 / (α + 2) over the disc, so this keeps the mean at `sunRadiance`.
@@ -1,3 +1,4 @@
1
+ import { sceneResources, materialLayers } from './SceneResources.js';
1
2
  import { Fn, wgslFn, float, vec2, vec3, vec4, int, If, normalize, cross, dot, length, sign, abs, atan, mix, clamp, texture, textureSize, uintBitsToFloat } from 'three/tsl';
2
3
  import { DataArrayTexture, LinearFilter } from 'three';
3
4
 
@@ -7,7 +8,7 @@ import {
7
8
  ExtMapResult,
8
9
  } from './Struct.js';
9
10
  import { instanceRows, instanceDirToWorld, triangleRow } from './Common.js';
10
- import { TEXTURE_CONSTANTS } from '../EngineDefaults.js';
11
+ import { TEXTURE_CONSTANTS } from '../Processor/TextureBuckets.js';
11
12
 
12
13
  // ================================================================================
13
14
  // CONSOLIDATED SHAPE-BUCKETED MATERIAL TEXTURES
@@ -18,30 +19,11 @@ import { TEXTURE_CONSTANTS } from '../EngineDefaults.js';
18
19
  // footprint. Bucket shapes are planned per scene (planTextureBuckets) — not powers of two.
19
20
  // A map's stored index encodes (bucket, layer) as bucket * BUCKET_LAYER_STRIDE + layer.
20
21
  //
21
- // The bucket texture nodes live at module level (same pattern as gobo/IES/shadowAlbedo):
22
- // each stage sets them via setMaterialBucketTextures() right before building its graph,
23
- // so each pipeline bakes in its own fresh nodes (avoiding cross-pipeline TextureNode
24
- // caching, just like the per-type nodes did before).
22
+ // The bucket texture nodes are the kernel's own (SceneResources.js): each pipeline builds fresh nodes,
23
+ // avoiding cross-pipeline TextureNode caching, and hands them to its kernels' build context.
25
24
 
26
25
  const _STRIDE = TEXTURE_CONSTANTS.BUCKET_LAYER_STRIDE;
27
26
 
28
- // Array<MATERIAL_BUCKET_COUNT> of texture nodes (never null — empty buckets get placeholders).
29
- let _srgbBuckets = null;
30
- let _linearBuckets = null;
31
-
32
- /**
33
- * Set the bucket texture node arrays read by the sampling functions. Call before building
34
- * any graph that samples material textures (Shade / NormalDepth / Debug kernels).
35
- * @param {Array} srgb sRGB pool nodes (albedo + emissive)
36
- * @param {Array} linear linear pool nodes (normal/bump/roughness/metalness/displacement)
37
- */
38
- export function setMaterialBucketTextures( srgb, linear ) {
39
-
40
- _srgbBuckets = srgb;
41
- _linearBuckets = linear;
42
-
43
- }
44
-
45
27
  // Run `fn(node, layer)` inside a runtime branch that selects the bucket node a packed
46
28
  // index points to. Emits one If/ElseIf arm per bucket; only the matching arm executes.
47
29
  // Caller must guard packedIndex >= 0.
@@ -89,13 +71,6 @@ export const bucketTexelSize = ( buckets, packedIndex ) => {
89
71
 
90
72
  };
91
73
 
92
- // The linear-pool node set (displacement lives here) — for Displacement.js texel sizing.
93
- export function getLinearBucketTextures() {
94
-
95
- return _linearBuckets;
96
-
97
- }
98
-
99
74
  // 1×1 white placeholder array so empty-bucket branches always reference a valid node.
100
75
  export function makeBucketPlaceholder() {
101
76
 
@@ -334,13 +309,15 @@ export const computeUVCache = Fn( ( [ baseUV, material ] ) => {
334
309
  // PROCESSING FUNCTIONS
335
310
  // ================================================================================
336
311
 
337
- export const processAlbedo = Fn( ( [ material, uvCache ] ) => {
312
+ export const processAlbedo = Fn( ( [ material, uvCache ], builder ) => {
313
+
314
+ const { srgbBuckets } = sceneResources( builder );
338
315
 
339
316
  const result = material.color.toVar();
340
317
 
341
318
  If( material.albedoMapIndex.greaterThanEqual( int( 0 ) ), () => {
342
319
 
343
- const albedoSample = sampleBucket( _srgbBuckets, material.albedoMapIndex, uvCache.albedoUV ).toVar();
320
+ const albedoSample = sampleBucket( srgbBuckets, material.albedoMapIndex, uvCache.albedoUV ).toVar();
344
321
  // sRGB→linear handled by GPU hardware (sRGB bucket arrays carry SRGBColorSpace → rgba8unorm-srgb)
345
322
  result.assign( vec4( material.color.rgb.mul( albedoSample.rgb ), material.color.a.mul( albedoSample.a ) ) );
346
323
 
@@ -350,7 +327,9 @@ export const processAlbedo = Fn( ( [ material, uvCache ] ) => {
350
327
 
351
328
  } );
352
329
 
353
- export const processMetalnessRoughness = Fn( ( [ material, uvCache ] ) => {
330
+ export const processMetalnessRoughness = Fn( ( [ material, uvCache ], builder ) => {
331
+
332
+ const { linearBuckets } = sceneResources( builder );
354
333
 
355
334
  const metalness = material.metalness.toVar();
356
335
  const roughness = material.roughness.toVar();
@@ -358,7 +337,7 @@ export const processMetalnessRoughness = Fn( ( [ material, uvCache ] ) => {
358
337
  If( material.metalnessMapIndex.greaterThanEqual( int( 0 ) ).and( material.metalnessMapIndex.equal( material.roughnessMapIndex ) ), () => {
359
338
 
360
339
  // Same packed index → same bucket layer (e.g. ORM) → sample once.
361
- const sample = sampleBucket( _linearBuckets, material.metalnessMapIndex, uvCache.metalnessUV );
340
+ const sample = sampleBucket( linearBuckets, material.metalnessMapIndex, uvCache.metalnessUV );
362
341
  metalness.assign( material.metalness.mul( sample.b ) );
363
342
  roughness.assign( material.roughness.mul( sample.g ) );
364
343
 
@@ -366,14 +345,14 @@ export const processMetalnessRoughness = Fn( ( [ material, uvCache ] ) => {
366
345
 
367
346
  If( material.metalnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
368
347
 
369
- const metSample = sampleBucket( _linearBuckets, material.metalnessMapIndex, uvCache.metalnessUV );
348
+ const metSample = sampleBucket( linearBuckets, material.metalnessMapIndex, uvCache.metalnessUV );
370
349
  metalness.assign( material.metalness.mul( metSample.b ) );
371
350
 
372
351
  } );
373
352
 
374
353
  If( material.roughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
375
354
 
376
- const rghSample = sampleBucket( _linearBuckets, material.roughnessMapIndex, uvCache.roughnessUV );
355
+ const rghSample = sampleBucket( linearBuckets, material.roughnessMapIndex, uvCache.roughnessUV );
377
356
  roughness.assign( material.roughness.mul( rghSample.g ) );
378
357
 
379
358
  } );
@@ -471,13 +450,15 @@ export const triangleUVTangent = Fn( ( [ triangleBuffer, triIndex, geometryNorma
471
450
  * arbitrary frame comes out 90 deg off, so the rib normals tilt up/down instead of across
472
451
  * the ribs.
473
452
  */
474
- export const processNormal = Fn( ( [ geometryNormal, material, uvCache, uvTangent ] ) => {
453
+ export const processNormal = Fn( ( [ geometryNormal, material, uvCache, uvTangent ], builder ) => {
454
+
455
+ const { linearBuckets } = sceneResources( builder );
475
456
 
476
457
  const result = geometryNormal.toVar();
477
458
 
478
459
  If( material.normalMapIndex.greaterThanEqual( int( 0 ) ), () => {
479
460
 
480
- const normalSample = sampleBucket( _linearBuckets, material.normalMapIndex, uvCache.normalUV );
461
+ const normalSample = sampleBucket( linearBuckets, material.normalMapIndex, uvCache.normalUV );
481
462
  const normalMap = normalSample.xyz.mul( 2.0 ).sub( 1.0 ).toVar();
482
463
  normalMap.x.mulAssign( material.normalScale.x );
483
464
  normalMap.y.assign( normalMap.y.negate().mul( material.normalScale.x ) );
@@ -512,7 +493,9 @@ export const processNormal = Fn( ( [ geometryNormal, material, uvCache, uvTangen
512
493
 
513
494
  } );
514
495
 
515
- export const processBump = Fn( ( [ currentNormal, material, uvCache ] ) => {
496
+ export const processBump = Fn( ( [ currentNormal, material, uvCache ], builder ) => {
497
+
498
+ const { linearBuckets } = sceneResources( builder );
516
499
 
517
500
  const result = currentNormal.toVar();
518
501
 
@@ -521,7 +504,7 @@ export const processBump = Fn( ( [ currentNormal, material, uvCache ] ) => {
521
504
  // Taps + texel size come from the SELECTED bucket node (its real dimensions), so the
522
505
  // finite-difference step is correct per bucket — done inside one bucket-branch.
523
506
  const bumpNormal = vec3( 0.0, 0.0, 1.0 ).toVar();
524
- withBucket( _linearBuckets, material.bumpMapIndex, ( node, layer ) => {
507
+ withBucket( linearBuckets, material.bumpMapIndex, ( node, layer ) => {
525
508
 
526
509
  const texelSize = vec2( 1.0 ).div( vec2( textureSize( node ) ) ).toVar();
527
510
  const h_c = texture( node, uvCache.bumpUV ).depth( layer ).r;
@@ -549,11 +532,13 @@ export const processBump = Fn( ( [ currentNormal, material, uvCache ] ) => {
549
532
  // Fold the glTF anisotropyTexture (RG = tangent-space direction, B = strength) into scalar
550
533
  // (strength, rotationRadians) per three.js: anisotropy · R(rotation) · (normalize(rg·2−1)·b).
551
534
  // Caller guarantees anisotropyMapIndex >= 0. `uv` is pre-transformed by the caller (albedo transform).
552
- export const processAnisotropyMap = Fn( ( [ material, uv ] ) => {
535
+ export const processAnisotropyMap = Fn( ( [ material, uv ], builder ) => {
536
+
537
+ const { linearBuckets } = sceneResources( builder );
553
538
 
554
539
  const result = vec2( material.anisotropy, material.anisotropyRotation ).toVar();
555
540
 
556
- const s = sampleBucket( _linearBuckets, material.anisotropyMapIndex, uv ).toVar();
541
+ const s = sampleBucket( linearBuckets, material.anisotropyMapIndex, uv ).toVar();
557
542
  const texDir = s.rg.mul( 2.0 ).sub( 1.0 ).toVar();
558
543
  const dlen = texDir.length().toVar();
559
544
 
@@ -581,7 +566,10 @@ export const processAnisotropyMap = Fn( ( [ material, uv ] ) => {
581
566
  // pre-transformed by the caller with the material's albedo KHR_texture_transform (extension maps
582
567
  // share the base UV set/transform in practice). Color maps (sheenColor, specularColor) read the
583
568
  // sRGB pool; data maps read the linear pool.
584
- export const applyExtensionMaps = Fn( ( [ material, uv ] ) => {
569
+ export const applyExtensionMaps = Fn( ( [ material, uv ], builder ) => {
570
+
571
+ const { srgbBuckets, linearBuckets } = sceneResources( builder );
572
+ const layers = materialLayers( builder );
585
573
 
586
574
  const r = ExtMapResult( {
587
575
  transmission: material.transmission,
@@ -593,53 +581,66 @@ export const applyExtensionMaps = Fn( ( [ material, uv ] ) => {
593
581
  iridescenceThickness: material.iridescenceThicknessRange.y, // default = max (no-texture behavior)
594
582
  specularIntensity: material.specularIntensity,
595
583
  specularColor: material.specularColor,
584
+ diffuseTransmission: material.diffuseTransmission,
585
+ diffuseTransmissionColor: material.diffuseTransmissionColor,
596
586
  } ).toVar();
597
587
 
598
588
  If( material.transmissionMapIndex.greaterThanEqual( int( 0 ) ), () => {
599
589
 
600
- r.transmission.assign( r.transmission.mul( sampleBucket( _linearBuckets, material.transmissionMapIndex, uv ).r ) );
590
+ r.transmission.assign( r.transmission.mul( sampleBucket( linearBuckets, material.transmissionMapIndex, uv ).r ) );
601
591
 
602
592
  } );
603
- If( material.clearcoatMapIndex.greaterThanEqual( int( 0 ) ), () => {
593
+ if ( layers.clearcoat ) If( material.clearcoatMapIndex.greaterThanEqual( int( 0 ) ), () => {
604
594
 
605
- r.clearcoat.assign( r.clearcoat.mul( sampleBucket( _linearBuckets, material.clearcoatMapIndex, uv ).r ) );
595
+ r.clearcoat.assign( r.clearcoat.mul( sampleBucket( linearBuckets, material.clearcoatMapIndex, uv ).r ) );
606
596
 
607
597
  } );
608
- If( material.clearcoatRoughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
598
+ if ( layers.clearcoat ) If( material.clearcoatRoughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
609
599
 
610
- r.clearcoatRoughness.assign( r.clearcoatRoughness.mul( sampleBucket( _linearBuckets, material.clearcoatRoughnessMapIndex, uv ).g ) );
600
+ r.clearcoatRoughness.assign( r.clearcoatRoughness.mul( sampleBucket( linearBuckets, material.clearcoatRoughnessMapIndex, uv ).g ) );
611
601
 
612
602
  } );
613
- If( material.sheenColorMapIndex.greaterThanEqual( int( 0 ) ), () => {
603
+ if ( layers.sheen ) If( material.sheenColorMapIndex.greaterThanEqual( int( 0 ) ), () => {
614
604
 
615
- r.sheenColor.assign( r.sheenColor.mul( sampleBucket( _srgbBuckets, material.sheenColorMapIndex, uv ).rgb ) );
605
+ r.sheenColor.assign( r.sheenColor.mul( sampleBucket( srgbBuckets, material.sheenColorMapIndex, uv ).rgb ) );
616
606
 
617
607
  } );
618
- If( material.sheenRoughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
608
+ if ( layers.sheen ) If( material.sheenRoughnessMapIndex.greaterThanEqual( int( 0 ) ), () => {
619
609
 
620
610
  // clamp to [0.05,1] to keep parity with the sample/PDF floor applied in ShadeKernel
621
- r.sheenRoughness.assign( clamp( r.sheenRoughness.mul( sampleBucket( _linearBuckets, material.sheenRoughnessMapIndex, uv ).a ), 0.05, 1.0 ) );
611
+ r.sheenRoughness.assign( clamp( r.sheenRoughness.mul( sampleBucket( linearBuckets, material.sheenRoughnessMapIndex, uv ).a ), 0.05, 1.0 ) );
622
612
 
623
613
  } );
624
- If( material.iridescenceMapIndex.greaterThanEqual( int( 0 ) ), () => {
614
+ if ( layers.iridescence ) If( material.iridescenceMapIndex.greaterThanEqual( int( 0 ) ), () => {
625
615
 
626
- r.iridescence.assign( r.iridescence.mul( sampleBucket( _linearBuckets, material.iridescenceMapIndex, uv ).r ) );
616
+ r.iridescence.assign( r.iridescence.mul( sampleBucket( linearBuckets, material.iridescenceMapIndex, uv ).r ) );
627
617
 
628
618
  } );
629
- If( material.iridescenceThicknessMapIndex.greaterThanEqual( int( 0 ) ), () => {
619
+ if ( layers.iridescence ) If( material.iridescenceThicknessMapIndex.greaterThanEqual( int( 0 ) ), () => {
630
620
 
631
- const g = sampleBucket( _linearBuckets, material.iridescenceThicknessMapIndex, uv ).g;
621
+ const g = sampleBucket( linearBuckets, material.iridescenceThicknessMapIndex, uv ).g;
632
622
  r.iridescenceThickness.assign( mix( material.iridescenceThicknessRange.x, material.iridescenceThicknessRange.y, g ) );
633
623
 
634
624
  } );
635
625
  If( material.specularIntensityMapIndex.greaterThanEqual( int( 0 ) ), () => {
636
626
 
637
- r.specularIntensity.assign( r.specularIntensity.mul( sampleBucket( _linearBuckets, material.specularIntensityMapIndex, uv ).a ) );
627
+ r.specularIntensity.assign( r.specularIntensity.mul( sampleBucket( linearBuckets, material.specularIntensityMapIndex, uv ).a ) );
638
628
 
639
629
  } );
640
630
  If( material.specularColorMapIndex.greaterThanEqual( int( 0 ) ), () => {
641
631
 
642
- r.specularColor.assign( r.specularColor.mul( sampleBucket( _srgbBuckets, material.specularColorMapIndex, uv ).rgb ) );
632
+ r.specularColor.assign( r.specularColor.mul( sampleBucket( srgbBuckets, material.specularColorMapIndex, uv ).rgb ) );
633
+
634
+ } );
635
+ // KHR_materials_diffuse_transmission: the factor from the map's alpha, the colour from its RGB.
636
+ if ( layers.diffuseTransmission ) If( material.diffuseTransmissionMapIndex.greaterThanEqual( int( 0 ) ), () => {
637
+
638
+ r.diffuseTransmission.assign( r.diffuseTransmission.mul( sampleBucket( linearBuckets, material.diffuseTransmissionMapIndex, uv ).a ) );
639
+
640
+ } );
641
+ if ( layers.diffuseTransmission ) If( material.diffuseTransmissionColorMapIndex.greaterThanEqual( int( 0 ) ), () => {
642
+
643
+ r.diffuseTransmissionColor.assign( r.diffuseTransmissionColor.mul( sampleBucket( srgbBuckets, material.diffuseTransmissionColorMapIndex, uv ).rgb ) );
643
644
 
644
645
  } );
645
646
 
@@ -647,13 +648,15 @@ export const applyExtensionMaps = Fn( ( [ material, uv ] ) => {
647
648
 
648
649
  } );
649
650
 
650
- export const processEmissive = Fn( ( [ material, uvCache ] ) => {
651
+ export const processEmissive = Fn( ( [ material, uvCache ], builder ) => {
652
+
653
+ const { srgbBuckets } = sceneResources( builder );
651
654
 
652
655
  const emissionBase = material.emissive.mul( material.emissiveIntensity ).toVar();
653
656
 
654
657
  If( material.emissiveMapIndex.greaterThanEqual( int( 0 ) ), () => {
655
658
 
656
- const emissiveSample = sampleBucket( _srgbBuckets, material.emissiveMapIndex, uvCache.emissiveUV ).toVar();
659
+ const emissiveSample = sampleBucket( srgbBuckets, material.emissiveMapIndex, uvCache.emissiveUV ).toVar();
657
660
  // sRGB→linear handled by GPU hardware (sRGB bucket arrays carry SRGBColorSpace → rgba8unorm-srgb)
658
661
  emissionBase.assign( emissionBase.mul( emissiveSample.rgb ) );
659
662
 
@@ -707,14 +710,16 @@ export const sampleAllMaterialTextures = Fn( ( [ material, uv, geometryNormal, u
707
710
  } );
708
711
 
709
712
  // Sample displacement map (linear pool) at given UV coordinates.
710
- export const sampleDisplacementMap = Fn( ( [ displacementMapIndex, uv, transform ] ) => {
713
+ export const sampleDisplacementMap = Fn( ( [ displacementMapIndex, uv, transform ], builder ) => {
714
+
715
+ const { linearBuckets } = sceneResources( builder );
711
716
 
712
717
  const result = float( 0.0 ).toVar();
713
718
 
714
719
  If( displacementMapIndex.greaterThanEqual( int( 0 ) ), () => {
715
720
 
716
721
  const transformedUV = getTransformedUV( { uv, transform } );
717
- result.assign( sampleBucket( _linearBuckets, displacementMapIndex, transformedUV ).r );
722
+ result.assign( sampleBucket( linearBuckets, displacementMapIndex, transformedUV ).r );
718
723
 
719
724
  } );
720
725
 
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Scene archives (.zip, .tar, .tar.gz) and the pbrt-v4 scenes in them — `rayzee/addons/archives`. PathTracerApp
3
+ * installs it itself; on the renderer core, install it once:
4
+ *
5
+ * @example
6
+ * import { RayzeeRenderer } from 'rayzee/core';
7
+ * import { ArchiveImporter } from 'rayzee/addons/archives';
8
+ *
9
+ * renderer.assetLoader.setArchiveImporter( new ArchiveImporter( renderer.assetLoader ) );
10
+ * await renderer.loadFile( 'scene.tar' );
11
+ */
12
+
13
+ export { ArchiveImporter, ARCHIVE_ELEMENT_PROMPT_BYTES } from '../Processor/ArchiveImporter.js';
14
+ export { openZip, readZipDirectory } from '../Processor/ZipReader.js';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Bidirectional path tracing and vertex merging — `rayzee/addons/bidirectional`: the path tracer's 'bidirectional'
3
+ * and 'vcm' integrators. PathTracerApp registers them itself; on the renderer core, register them once:
4
+ *
5
+ * @example
6
+ * import { RayzeeRenderer } from 'rayzee/core';
7
+ * import { BidirectionalIntegrator } from 'rayzee/addons/bidirectional';
8
+ *
9
+ * renderer.stages.pathTracer.registerIntegrator( [ 'bidirectional', 'vcm' ], pt => new BidirectionalIntegrator( pt ) );
10
+ * renderer.settings.set( 'integrator', 'bidirectional' );
11
+ */
12
+
13
+ export { BidirectionalIntegrator } from '../integrators/BidirectionalIntegrator.js';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The OCIO colour pipeline — `rayzee/addons/color`: colour configs, OCIO views and looks, working spaces, input
3
+ * colour spaces and export spaces. The renderer core renders in linear Rec.709 through three.js's own view transforms
4
+ * (BasicColor); PathTracerApp installs this itself. On the core, install it once — before or after init():
5
+ *
6
+ * @example
7
+ * import { RayzeeRenderer, configureAssets } from 'rayzee/core';
8
+ * import { ColorManagement } from 'rayzee/addons/color';
9
+ *
10
+ * configureAssets( { ocioRuntimeFactory: () => import( '@bb-studio/ocio' ) } );
11
+ * renderer.setColorManagement( ColorManagement );
12
+ * await renderer.loadColorConfig( { builtin: 'ocio://cg-config-v4.0.0_aces-v2.0_ocio-v2.5' } );
13
+ */
14
+
15
+ export {
16
+ ColorManagement, getActiveColorManagement, setActiveColorManagement,
17
+ isColorManaged, DEFAULT_WORKING_SPACE, findNativeLinearSpace, canvasColorSpaceFor,
18
+ } from '../Color/ColorManagement.js';
19
+ export { displayCanvasFit } from '../Color/Displays.js';
20
+ export {
21
+ buildOcioView, addOcioView, addAllOcioViews,
22
+ DEFAULT_LUT_SIZE, DEFAULT_MIN_EV, DEFAULT_MAX_EV,
23
+ } from '../Color/OcioViews.js';
24
+ export {
25
+ resolveInputSpace, textureInputSpace, setInputOverride, clearInputOverrides,
26
+ listInputOverrides, listFileRules, isDataTexture,
27
+ } from '../Color/InputColorSpaces.js';
28
+ export {
29
+ convertColor, convertPixelsF32, convertEncodedRGBA8, applyMatrixRGBA8, extractMatrix,
30
+ hasColorSpace, isDataSpace, srgbToLinear, linearToSrgb,
31
+ } from '../Color/ColorSpaces.js';
32
+ export { measureBakeError, bakeLut, makeCpuSampler } from '../Color/LutBake.js';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * File formats beyond glTF and .hdr — `rayzee/addons/formats`: FBX, OBJ, STL, PLY, Collada, 3MF and USD models, and
3
+ * EXR environments. PathTracerApp registers all of them itself; on the renderer core, register the ones you read (each
4
+ * three.js loader is downloaded the first time its format is read, and a bundler drops the formats you leave out):
5
+ *
6
+ * @example
7
+ * import { RayzeeRenderer } from 'rayzee/core';
8
+ * import { objFormat, exrFormat } from 'rayzee/addons/formats';
9
+ *
10
+ * renderer.assetLoader.registerFormat( objFormat, exrFormat );
11
+ * await renderer.loadFile( objFile );
12
+ */
13
+
14
+ export {
15
+ fbxFormat, objFormat, stlFormat, plyFormat, colladaFormat, threeMFFormat, usdFormat, exrFormat, allFormats,
16
+ } from '../Processor/FileFormats.js';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The physical sky — `rayzee/addons/physical-sky`: Bruneton's atmosphere baked on the GPU for environment mode
3
+ * 'procedural', with its importance-sampling table and analytic sun. PathTracerApp installs it itself; on the renderer
4
+ * core, install it once:
5
+ *
6
+ * @example
7
+ * import { RayzeeRenderer } from 'rayzee/core';
8
+ * import { PhysicalSky } from 'rayzee/addons/physical-sky';
9
+ *
10
+ * renderer.environmentManager.setProceduralSky( PhysicalSky );
11
+ * await renderer.environmentManager.setMode( 'procedural' );
12
+ */
13
+
14
+ export { PhysicalSky } from '../Processor/PhysicalSky.js';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * On-disk storage — `rayzee/addons/storage`: the origin private file system behind the download, environment and
3
+ * scene caches and the memory spill. The renderer core runs without it (downloads land in memory, nothing is cached);
4
+ * PathTracerApp installs it itself. On the core, install it before init():
5
+ *
6
+ * @example
7
+ * import { RayzeeRenderer } from 'rayzee/core';
8
+ * import { acquireSharedStorage } from 'rayzee/addons/storage';
9
+ *
10
+ * const renderer = new RayzeeRenderer( canvas );
11
+ * renderer.setStorageOpener( acquireSharedStorage );
12
+ * await renderer.init();
13
+ */
14
+
15
+ export { openStorage, acquireSharedStorage } from '../Storage/openStorage.js';
16
+ export {
17
+ StorageManager, StorageArea, StorageEntry, EntryWriter, STORAGE_KIND, ENGINE_AREAS, openInlineStorage,
18
+ } from '../Storage/StorageManager.js';
19
+ export { acquireLock, heldLockNames } from '../Storage/locks.js';
package/src/core.js ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Rayzee renderer core — `rayzee/core`.
3
+ *
4
+ * A scene and camera in, path-traced samples accumulated, the image out. No denoisers, camera controls,
5
+ * gizmo, overlays or timeline: `rayzee` adds those (PathTracerApp). See docs/CORE_AND_ADDONS.md.
6
+ *
7
+ * @example
8
+ * const renderer = await new RayzeeRenderer( canvas ).init();
9
+ * await renderer.loadObject3D( gltf.scene );
10
+ * await renderer.renderFrames( 256 );
11
+ * const image = await renderer.renderToBuffer( { colorSpace: 'srgb' } );
12
+ * renderer.dispose();
13
+ */
14
+
15
+ import './TSL/patches.js';
16
+
17
+ export { RayzeeRenderer, describeAdapter } from './RayzeeRenderer.js';
18
+ export { EngineEvents, LEGACY_EVENT_NAMES } from './EngineEvents.js';
19
+ export { ISSUE_CODES, ISSUE_SEVERITY, IssueLog, EngineIssueError } from './EngineIssues.js';
20
+ export { RenderSettings, SETTING_SOURCE } from './RenderSettings.js';
21
+ export { configureAssets, getAssetConfig } from './AssetConfig.js';
22
+ export { configurePlatform, getPlatform } from './Platform.js';
23
+ export { LightManager } from './managers/LightManager.js';
24
+ export { listViewTransforms, getViewTransform, onRegistryChange, DEFAULT_VIEW } from './Color/ViewTransforms.js';
25
+ export { ARCHIVE_FORMATS } from './Processor/archiveFormats.js';
26
+ export { ENGINE_DEFAULTS, MATERIAL_DEFAULTS } from './EngineDefaults.js';
27
+ export { SKY_DEFAULTS } from './managers/EnvironmentManager.js';
28
+ export { MAX_RESERVABLE_RENDER_SIZE } from './Processor/StorageTexturePool.js';
29
+ export { TRIANGLE_DATA_LAYOUT } from './Processor/BufferLayout.js';
30
+ export { Logger, createLogger, fmt, LOG_LEVELS } from './utils/Logger.js';
31
+ export { VERSION } from './version.js';
package/src/index.js CHANGED
@@ -8,8 +8,9 @@
8
8
  // Patches (side-effect imports — must run before any StorageTexture usage)
9
9
  import './TSL/patches.js';
10
10
 
11
- // Main application
11
+ // Main application: the viewer, built on the renderer core (also `rayzee/core`)
12
12
  export { PathTracerApp, describeAdapter } from './PathTracerApp.js';
13
+ export { RayzeeRenderer } from './RayzeeRenderer.js';
13
14
 
14
15
  // Event types
15
16
  export { EngineEvents, LEGACY_EVENT_NAMES } from './EngineEvents.js';
@@ -35,6 +36,7 @@ export {
35
36
 
36
37
  // Archives read in place: one entry at a time, never the whole file in memory
37
38
  export { openZip, readZipDirectory } from './Processor/ZipReader.js';
39
+ export { ARCHIVE_FORMATS } from './Processor/archiveFormats.js';
38
40
 
39
41
  // Engine package version, as built
40
42
  export { VERSION } from './version.js';
@@ -55,31 +57,19 @@ export { Logger, createLogger, fmt, LOG_LEVELS } from './utils/Logger.js';
55
57
  // Configuration defaults and presets
56
58
  export {
57
59
  ENGINE_DEFAULTS,
58
- ASVGF_QUALITY_PRESETS,
59
- NRD_DEFAULTS,
60
- NRD_QUALITY_PRESETS,
61
- NRD_PRESET_KEYS,
62
- NRD_HIT_DIST_A,
63
- NRD_HIT_DIST_B,
64
- CAMERA_PRESETS,
65
- CAMERA_RANGES,
66
- SKY_PRESETS,
67
- DEFAULT_SUN_PATH,
68
- AUTO_FOCUS_MODES,
69
- AF_DEFAULTS,
70
- TRIANGLE_DATA_LAYOUT,
71
- BVH_LEAF_MARKERS,
72
- TEXTURE_CONSTANTS,
73
- DEFAULT_TEXTURE_MATRIX,
74
60
  MATERIAL_DEFAULTS,
75
- MEMORY_CONSTANTS,
76
61
  PRODUCTION_RENDER_CONFIG,
77
62
  INTERACTIVE_RENDER_CONFIG,
78
- MAX_RESERVABLE_RENDER_SIZE,
79
- RENDER_PROFILES,
80
- getRenderProfile,
81
- MATERIAL_SIDE_CUTAWAY,
82
63
  } from './EngineDefaults.js';
64
+ export { MAX_RESERVABLE_RENDER_SIZE } from './Processor/StorageTexturePool.js';
65
+ export {
66
+ DENOISER_DEFAULTS, ASVGF_QUALITY_PRESETS, NRD_DEFAULTS, NRD_QUALITY_PRESETS, NRD_PRESET_KEYS, NRD_HIT_DIST_A,
67
+ NRD_HIT_DIST_B,
68
+ } from './Stages/DenoiserSettings.js';
69
+ export { SKY_DEFAULTS, DEFAULT_SUN_PATH } from './managers/EnvironmentManager.js';
70
+ export { AUTO_EXPOSURE_DEFAULTS } from './Stages/AutoExposure.js';
71
+ export { AUTO_FOCUS_DEFAULTS } from './managers/CameraManager.js';
72
+ export { TRIANGLE_DATA_LAYOUT, BVH_LEAF_MARKERS } from './Processor/BufferLayout.js';
83
73
  export { sunPosition, timeForSunElevation, dayOfYearForMonth } from './Processor/SunPosition.js';
84
74
 
85
75
  // Settings & managers (for advanced consumers)
@@ -140,7 +130,7 @@ export { displayCanvasFit } from './Color/Displays.js';
140
130
  export {
141
131
  VIEW_TRANSFORMS, listViewTransforms, getViewTransform, addViewTransform, removeViewTransform,
142
132
  onRegistryChange, getRegistryVersion, buildToneMapWGSL,
143
- OCIO_VIEW_BASE, MAX_TABLE_TRANSFORMS,
133
+ OCIO_VIEW_BASE, MAX_TABLE_TRANSFORMS, DEFAULT_VIEW,
144
134
  } from './Color/ViewTransforms.js';
145
135
  export {
146
136
  buildOcioView, addOcioView, addAllOcioViews,