rayzee 9.5.0 → 11.0.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 (78) hide show
  1. package/README.md +22 -20
  2. package/dist/{ArchiveImporter-xuUJiklP.js → ArchiveImporter-BRQvLggb.js} +12 -13
  3. package/dist/{BidirectionalIntegrator-C5PKjJoT.js → BidirectionalIntegrator-9lZQxFVH.js} +87 -87
  4. package/dist/BufferLayout-D_IBo2ci.js +150 -0
  5. package/dist/{ColorManagement-CheBCPaW.js → ColorManagement-oeEk7oSu.js} +171 -171
  6. package/dist/{NeuralRetouch-CW11yLZ_.js → NeuralRetouch-BCXylThH.js} +3 -3
  7. package/dist/{NeuralSuperRes-BekaecYg.js → NeuralSuperRes-sZAeS142.js} +3 -3
  8. package/dist/{PathTracer-Ccl9KOuF.js → PathTracer-CQPW06Mm.js} +2911 -2669
  9. package/dist/{PhysicalSky-Dv2PMFGW.js → PhysicalSky-BvqCw_dy.js} +2 -2
  10. package/dist/{RayzeeRenderer-BQxnzCTD.js → RayzeeRenderer-COpwotpU.js} +338 -329
  11. package/dist/{SolarLimb-ken-JbDK.js → SolarLimb-CPaeZVwz.js} +10 -10
  12. package/dist/{ToneMapGPU-BHi5JzIq.js → ToneMapGPU-CjU3osDd.js} +1 -1
  13. package/dist/{ViewTransforms-D0rTLBsX.js → ViewTransforms-CYN7bq2w.js} +2 -2
  14. package/dist/addons/archives.es.js +1 -1
  15. package/dist/addons/bidirectional.es.js +1 -1
  16. package/dist/addons/color.es.js +1 -1
  17. package/dist/addons/physical-sky.es.js +1 -1
  18. package/dist/rayzee-core.es.js +11 -11
  19. package/dist/rayzee.es.js +734 -599
  20. package/dist/rayzee.umd.js +102 -102
  21. package/dist/sceneCachePolicy-BSSsKY98.js +443 -0
  22. package/package.json +1 -1
  23. package/src/Color/ViewTransforms.js +5 -1
  24. package/src/EngineDefaults.js +59 -1032
  25. package/src/Headless.js +6 -5
  26. package/src/Passes/OIDNTemporalHistory.js +1 -1
  27. package/src/PathTracerApp.js +5 -3
  28. package/src/Processor/AssetLoader.js +6 -5
  29. package/src/Processor/BVHBuilder.js +10 -31
  30. package/src/Processor/BVHLeafFold.js +4 -6
  31. package/src/Processor/BVHRefitter.js +3 -46
  32. package/src/Processor/BufferLayout.js +291 -0
  33. package/src/Processor/EmissiveTriangleBuilder.js +1 -1
  34. package/src/Processor/GeometryExtractor.js +3 -3
  35. package/src/Processor/HostMemory.js +7 -1
  36. package/src/Processor/InstanceTable.js +1 -1
  37. package/src/Processor/MaterialPacking.js +2 -1
  38. package/src/Processor/PBRT/PBRTSceneBuilder.js +1 -1
  39. package/src/Processor/QueueManager.js +28 -3
  40. package/src/Processor/SceneProcessor.js +4 -2
  41. package/src/Processor/SplitBLAS.js +1 -1
  42. package/src/Processor/StorageTexturePool.js +22 -1
  43. package/src/Processor/TLASBuilder.js +1 -3
  44. package/src/Processor/TextureBuckets.js +237 -0
  45. package/src/Processor/TextureCreator.js +10 -1
  46. package/src/Processor/Workers/TexturesWorker.js +5 -6
  47. package/src/RayzeeRenderer.js +29 -32
  48. package/src/RenderSettings.js +26 -28
  49. package/src/Stages/ASVGF.js +8 -7
  50. package/src/Stages/AutoExposure.js +14 -5
  51. package/src/Stages/BilateralFilter.js +2 -1
  52. package/src/Stages/DenoiserSettings.js +182 -0
  53. package/src/Stages/EdgeFilter.js +2 -1
  54. package/src/Stages/MotionVector.js +1 -1
  55. package/src/Stages/NRD.js +2 -3
  56. package/src/Stages/NormalDepth.js +3 -2
  57. package/src/Stages/PathTracer.js +72 -4
  58. package/src/Stages/PathTracerStage.js +2 -1
  59. package/src/Stages/Variance.js +1 -1
  60. package/src/TSL/BVHTraversal.js +4 -1
  61. package/src/TSL/Common.js +1 -1
  62. package/src/TSL/EmissiveSampling.js +1 -1
  63. package/src/TSL/LightVisibility.js +111 -0
  64. package/src/TSL/LightsSampling.js +151 -15
  65. package/src/TSL/Random.js +1 -1
  66. package/src/TSL/ShadeKernel.js +88 -3
  67. package/src/TSL/TextureSampling.js +1 -1
  68. package/src/core.js +5 -9
  69. package/src/index.js +10 -21
  70. package/src/integrators/BidirectionalIntegrator.js +2 -1
  71. package/src/managers/CameraManager.js +17 -7
  72. package/src/managers/DenoisingManager.js +14 -10
  73. package/src/managers/EnvironmentManager.js +32 -13
  74. package/src/managers/MaterialDataManager.js +3 -3
  75. package/src/managers/UniformManager.js +2 -2
  76. package/dist/EngineDefaults-DH3bI5t-.js +0 -844
  77. package/dist/sceneCachePolicy-BmwYOYDu.js +0 -183
  78. /package/dist/{Logger-BnHghprG.js → Logger-dDDGj9Av.js} +0 -0
@@ -9,7 +9,10 @@ import { createLogger } from '../utils/Logger.js';
9
9
  // The neural passes live in `../neural/` but report through the manager that drives them, so they
10
10
  // share one namespace: `rayzee.log.only( 'neural' )` shows the whole chain.
11
11
  const neuralLog = createLogger( 'neural' );
12
- import { ENGINE_DEFAULTS as DEFAULT_STATE, ASVGF_QUALITY_PRESETS, NRD_DEFAULTS, NRD_QUALITY_PRESETS, NRD_PRESET_KEYS, CAMERA_PROJECTION_IDS } from '../EngineDefaults.js';
12
+ import { CAMERA_PROJECTION_IDS } from '../EngineDefaults.js';
13
+ import {
14
+ DENOISER_DEFAULTS, ASVGF_QUALITY_PRESETS, NRD_DEFAULTS, NRD_QUALITY_PRESETS, NRD_PRESET_KEYS,
15
+ } from '../Stages/DenoiserSettings.js';
13
16
 
14
17
  // A refresh slower than this is a slideshow, not a live view, so the cadence swaps to a cheaper
15
18
  // model and puts the chosen one back for the finished image. Resolution-aware by construction:
@@ -135,13 +138,13 @@ export class DenoisingManager extends EventDispatcher {
135
138
 
136
139
  // The tier the finished image uses. The loaded tier is not always this one: while the
137
140
  // image is still accumulating we run a cheaper model (see previewQuality).
138
- this._finalQuality = DEFAULT_STATE.oidnQuality;
141
+ this._finalQuality = DENOISER_DEFAULTS.oidnQuality;
139
142
  // Two independent decisions. `finalDenoise` is the OIDN pass on the finished image;
140
143
  // `continuousDenoise` is OIDN as the live-view denoiser. `denoiser.enabled` means only
141
144
  // "OIDN is in use at all", which is what the aux G-buffer wiring needs.
142
- this.finalDenoise = DEFAULT_STATE.enableOIDN;
143
- this.continuousDenoise = DEFAULT_STATE.continuousDenoise;
144
- this.continuousDenoiseInterval = DEFAULT_STATE.continuousDenoiseInterval;
145
+ this.finalDenoise = DENOISER_DEFAULTS.enableOIDN;
146
+ this.continuousDenoise = DENOISER_DEFAULTS.continuousDenoise;
147
+ this.continuousDenoiseInterval = DENOISER_DEFAULTS.continuousDenoiseInterval;
145
148
  // -Infinity, not 0: 0 reads as "denoised at time zero", which blocks the first cadence
146
149
  // denoise while performance.now() is still below the interval.
147
150
  this._lastCadenceAt = - Infinity;
@@ -160,7 +163,7 @@ export class DenoisingManager extends EventDispatcher {
160
163
  this._onPostProcessRefresh = null;
161
164
  this._onDisplayRefresh = null;
162
165
 
163
- this.temporalHistory = DEFAULT_STATE.oidnTemporalHistory;
166
+ this.temporalHistory = DENOISER_DEFAULTS.oidnTemporalHistory;
164
167
  this._history = null;
165
168
  // Stale after a scene-changing reset, or one the app did not announce (material/env edits).
166
169
  this._historyDirty = true;
@@ -307,7 +310,8 @@ export class DenoisingManager extends EventDispatcher {
307
310
  // Compositor decides what the single canvas shows. The exposure, grade and tone curve
308
311
  // come from the renderer's own output pass, so it is not told about them either.
309
312
  this.denoiser = new OIDNDenoiser( this.renderer, {
310
- ...DEFAULT_STATE,
313
+ enableOIDN: DENOISER_DEFAULTS.enableOIDN,
314
+ oidnQuality: DENOISER_DEFAULTS.oidnQuality,
311
315
 
312
316
  backendParams: () => ( {
313
317
  device: this.renderer.backend.device,
@@ -378,8 +382,8 @@ export class DenoisingManager extends EventDispatcher {
378
382
  const pt = this._stages.pathTracer;
379
383
 
380
384
  this.upscaler = new AIUpscaler( this.upscalerCanvas, this.renderer, {
381
- scaleFactor: DEFAULT_STATE.upscalerScale || 2,
382
- quality: DEFAULT_STATE.upscalerQuality || 'fast',
385
+ scaleFactor: DENOISER_DEFAULTS.upscalerScale || 2,
386
+ quality: DENOISER_DEFAULTS.upscalerQuality || 'fast',
383
387
 
384
388
  // One source: the render canvas shows whatever the Compositor picked — the denoised
385
389
  // picture when OIDN is on, the raw render otherwise — so the upscaler always enlarges
@@ -407,7 +411,7 @@ export class DenoisingManager extends EventDispatcher {
407
411
  getSaturation: () => this._getSaturation(),
408
412
  } );
409
413
 
410
- this.upscaler.enabled = DEFAULT_STATE.enableUpscaler || false;
414
+ this.upscaler.enabled = DENOISER_DEFAULTS.enableUpscaler || false;
411
415
 
412
416
  // Forward lifecycle events (store refs for removal on re-setup / dispose)
413
417
  this._upscalerResChangedHandler = ( e ) =>
@@ -15,13 +15,32 @@ import { packExactTable } from '../Processor/EnvironmentExactTable.js';
15
15
  import { SimpleSky } from '../Processor/SimpleSky.js';
16
16
  import { convertLinearTriple } from '../Color/WorkingMatrix.js';
17
17
  import { createLogger, fmt } from '../utils/Logger.js';
18
-
19
- const log = createLogger( 'env' );
20
- import { ENGINE_DEFAULTS as DEFAULT_STATE } from '../EngineDefaults.js';
18
+ import { sunPosition, dayOfYearForMonth } from '../Processor/SunPosition.js';
21
19
  import { getActiveColorManagement } from '../Color/ActiveColor.js';
22
20
  import { loadCDF, saveCDF } from '../Storage/CDFCache.js';
23
21
  import { ISSUE_CODES } from '../EngineIssues.js';
24
22
 
23
+ const log = createLogger( 'env' );
24
+
25
+ /** The default sun as a time of day (solar hours), month and latitude; north lies along −Z. */
26
+ export const DEFAULT_SUN_PATH = Object.freeze( { time: 10, month: 3, latitude: 40 } );
27
+
28
+ const DEFAULT_SUN = sunPosition( { hours: DEFAULT_SUN_PATH.time, dayOfYear: dayOfYearForMonth( DEFAULT_SUN_PATH.month ), latitude: DEFAULT_SUN_PATH.latitude } );
29
+
30
+ /** The skies an environment starts with: a solid colour, and the physical sky's Clear Day. */
31
+ export const SKY_DEFAULTS = Object.freeze( {
32
+ solidSkyColor: '#87CEEB',
33
+ skySunAzimuth: 180 - DEFAULT_SUN.azimuth,
34
+ skySunElevation: DEFAULT_SUN.elevation,
35
+ skySunStrength: 1, // artistic multiplier on the disc and its light; 1 is physical
36
+ skySunSize: 0.53, // angular diameter, degrees
37
+ skyTurbidity: 2, // 1 is aerosol-free air, ~2 a clear day, 6+ hazy
38
+ skyOzone: 300, // Dobson units
39
+ skyAirDensity: 1,
40
+ skyGroundAlbedo: '#959595', // 0.3 linear
41
+ skyAltitude: 50, // metres
42
+ } );
43
+
25
44
  const SKY_WIDTH = 1024;
26
45
  const SKY_HEIGHT = 512;
27
46
  const DEG2RAD = Math.PI / 180;
@@ -90,17 +109,17 @@ export class EnvironmentManager {
90
109
  mode: 'hdri',
91
110
 
92
111
  // Solid Color Sky
93
- solidSkyColor: new Color( DEFAULT_STATE.solidSkyColor ),
112
+ solidSkyColor: new Color( SKY_DEFAULTS.solidSkyColor ),
94
113
 
95
114
  // Physical sky. The sun direction is in the sky's own frame; environment rotation turns both.
96
115
  skySunDirection: this._calculateInitialSunDirection(),
97
- skySunStrength: DEFAULT_STATE.skySunStrength,
98
- skySunSize: DEFAULT_STATE.skySunSize,
99
- skyTurbidity: DEFAULT_STATE.skyTurbidity,
100
- skyOzone: DEFAULT_STATE.skyOzone,
101
- skyAirDensity: DEFAULT_STATE.skyAirDensity,
102
- skyGroundAlbedo: new Color( DEFAULT_STATE.skyGroundAlbedo ),
103
- skyAltitude: DEFAULT_STATE.skyAltitude,
116
+ skySunStrength: SKY_DEFAULTS.skySunStrength,
117
+ skySunSize: SKY_DEFAULTS.skySunSize,
118
+ skyTurbidity: SKY_DEFAULTS.skyTurbidity,
119
+ skyOzone: SKY_DEFAULTS.skyOzone,
120
+ skyAirDensity: SKY_DEFAULTS.skyAirDensity,
121
+ skyGroundAlbedo: new Color( SKY_DEFAULTS.skyGroundAlbedo ),
122
+ skyAltitude: SKY_DEFAULTS.skyAltitude,
104
123
  };
105
124
 
106
125
  /**
@@ -801,8 +820,8 @@ export class EnvironmentManager {
801
820
  /** @private */
802
821
  _calculateInitialSunDirection() {
803
822
 
804
- const azimuth = DEFAULT_STATE.skySunAzimuth * ( Math.PI / 180 );
805
- const elevation = DEFAULT_STATE.skySunElevation * ( Math.PI / 180 );
823
+ const azimuth = SKY_DEFAULTS.skySunAzimuth * ( Math.PI / 180 );
824
+ const elevation = SKY_DEFAULTS.skySunElevation * ( Math.PI / 180 );
806
825
  return new Vector3(
807
826
  Math.cos( elevation ) * Math.sin( azimuth ),
808
827
  Math.sin( elevation ),
@@ -10,9 +10,9 @@
10
10
  import { StorageInstancedBufferAttribute } from 'three/webgpu';
11
11
  import { storage } from 'three/tsl';
12
12
  import {
13
- MATERIAL_DATA_LAYOUT as M, TRIANGLE_DATA_LAYOUT as T, normalizeAttenuationDistance,
14
- TRI_MATERIAL_MASK, TRI_SIDE_SHIFT, TRI_BLOCKER_SHIFT, shadowBlockerBits
15
- } from '../EngineDefaults.js';
13
+ TRIANGLE_DATA_LAYOUT as T, TRI_MATERIAL_MASK, TRI_SIDE_SHIFT, TRI_BLOCKER_SHIFT, shadowBlockerBits,
14
+ MATERIAL_DATA_LAYOUT as M, normalizeAttenuationDistance,
15
+ } from '../Processor/BufferLayout.js';
16
16
  import { packMaterial, UNIT_RANGE_PROPERTIES, clampUnit } from '../Processor/MaterialPacking.js';
17
17
  import { resolveMaterialTextures, MATERIAL_VALUE_SOURCE } from '../Processor/GeometryExtractor.js';
18
18
  import { convertLinearTriple, convertLinearTriples, getWorkingMatrixSpace } from '../Color/WorkingMatrix.js';
@@ -218,12 +218,12 @@ export class UniformManager {
218
218
  // reset, and a camera move resets each frame of a drag, so the RNG redrew the identical
219
219
  // sequence and temporal denoising had nothing to average.
220
220
  u( 'seedFrame', 0, 'uint' );
221
- u( 'maxBounces', DEFAULT_STATE.bounces, 'int' );
221
+ u( 'maxBounces', DEFAULT_STATE.maxBounces, 'int' );
222
222
  u( 'maxSamples', DEFAULT_STATE.maxSamples, 'int' );
223
223
  u( 'transmissiveBounces', DEFAULT_STATE.transmissiveBounces, 'int' );
224
224
  u( 'maxSubsurfaceSteps', DEFAULT_STATE.maxSubsurfaceSteps, 'int' );
225
225
  u( 'maxTransparentBounces', DEFAULT_STATE.maxTransparentBounces, 'int' );
226
- u( 'visMode', DEFAULT_STATE.debugMode, 'int' );
226
+ u( 'visMode', DEFAULT_STATE.visMode, 'int' );
227
227
  u( 'debugVisScale', DEFAULT_STATE.debugVisScale, 'float' );
228
228
 
229
229
  // Tier-1 convergence early-stop (FinalWrite reads these; live-toggled, no shader rebuild)