rayzee 11.3.0 → 11.5.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 (35) hide show
  1. package/README.md +33 -5
  2. package/dist/{ArchiveImporter-D735xX-4.js → ArchiveImporter-29Nl1567.js} +2 -2
  3. package/dist/{BidirectionalIntegrator-M89c0AlP.js → BidirectionalIntegrator-CJay8tXK.js} +2 -2
  4. package/dist/{NeuralRetouch-DiBH63kz.js → NeuralRetouch-KqGVPV7u.js} +4 -3
  5. package/dist/{NeuralSuperRes-CZNQP13W.js → NeuralSuperRes-BHxhYzlD.js} +11 -5
  6. package/dist/{PathTracer-BXCCVrPK.js → PathTracer-Cldt0mXi.js} +19 -12
  7. package/dist/{PhysicalSky-DqmaS0lb.js → PhysicalSky-CUWrTcmT.js} +1 -1
  8. package/dist/{RayzeeRenderer-DUSMFhmc.js → RayzeeRenderer-Dd-Dit0v.js} +313 -281
  9. package/dist/{ToneMapGPU-BOjpul7A.js → ToneMapGPU-sAs8wdgI.js} +44 -22
  10. package/dist/addons/archives.es.js +1 -1
  11. package/dist/addons/bidirectional.es.js +1 -1
  12. package/dist/addons/physical-sky.es.js +1 -1
  13. package/dist/rayzee-core.es.js +3 -3
  14. package/dist/rayzee.es.js +1428 -902
  15. package/dist/rayzee.umd.js +124 -113
  16. package/dist/{sceneCachePolicy-BAib5fCp.js → sceneCachePolicy--ta6moJu.js} +1 -1
  17. package/package.json +1 -1
  18. package/src/EngineDefaults.js +2 -2
  19. package/src/Passes/AIUpscaler.js +17 -12
  20. package/src/PathTracerApp.js +122 -16
  21. package/src/Pipeline/CompletionTracker.js +7 -3
  22. package/src/Processor/ToneMapCPU.js +16 -4
  23. package/src/Processor/ToneMapGPU.js +49 -14
  24. package/src/RayzeeRenderer.js +54 -7
  25. package/src/RenderSettings.js +4 -2
  26. package/src/Stages/AutoExposure.js +484 -494
  27. package/src/Stages/Compositor.js +27 -6
  28. package/src/Stages/LocalExposure.js +569 -0
  29. package/src/Stages/PathTracer.js +6 -4
  30. package/src/Stages/PathTracerStage.js +9 -7
  31. package/src/index.js +1 -0
  32. package/src/managers/DenoisingManager.js +93 -34
  33. package/src/managers/VideoRenderManager.js +30 -4
  34. package/src/neural/NeuralRetouch.js +1 -0
  35. package/src/neural/NeuralSuperRes.js +6 -1
@@ -532,6 +532,13 @@ export class RayzeeRenderer extends EventDispatcher {
532
532
 
533
533
  }
534
534
 
535
+ if ( this._settling() ) {
536
+
537
+ this.dispatchEvent( { type: EngineEvents.FRAME } );
538
+ return;
539
+
540
+ }
541
+
535
542
  // Stop the loop to avoid constant CPU usage while idle
536
543
  this.stopAnimation();
537
544
  return;
@@ -558,12 +565,7 @@ export class RayzeeRenderer extends EventDispatcher {
558
565
 
559
566
  this._traceFrame( { liveDenoise: true } );
560
567
 
561
- if ( this.stages.pathTracer.isComplete && this.completion.markComplete() ) {
562
-
563
- this._renderCompleted();
564
- this.dispatchEvent( { type: EngineEvents.RENDER_COMPLETE, ...this._completionInfo() } );
565
-
566
- }
568
+ if ( this.stages.pathTracer.isComplete && this.completion.markComplete() ) this._announceComplete();
567
569
 
568
570
  }
569
571
 
@@ -572,6 +574,25 @@ export class RayzeeRenderer extends EventDispatcher {
572
574
 
573
575
  }
574
576
 
577
+ // The closing passes and RENDER_COMPLETE wait for _finishImage(), so both see the finished image's exposure.
578
+ _announceComplete() {
579
+
580
+ const info = this._completionInfo();
581
+ const restarts = this.stages.pathTracer.resetCount;
582
+ const announce = () => {
583
+
584
+ if ( ! this.completion.renderCompleteDispatched || this.stages.pathTracer?.resetCount !== restarts ) return;
585
+ this._renderCompleted();
586
+ this.dispatchEvent( { type: EngineEvents.RENDER_COMPLETE, ...info } );
587
+
588
+ };
589
+
590
+ const finishing = this._finishImage();
591
+ if ( finishing ) finishing.then( announce, announce );
592
+ else announce();
593
+
594
+ }
595
+
575
596
  // One frame of a render and its bookkeeping, shared by animate() and renderUntilComplete().
576
597
  _traceFrame( { liveDenoise = false } = {} ) {
577
598
 
@@ -2499,6 +2520,7 @@ export class RayzeeRenderer extends EventDispatcher {
2499
2520
 
2500
2521
  }
2501
2522
 
2523
+ await this._finishImage();
2502
2524
  return stage.frameCount;
2503
2525
 
2504
2526
  }
@@ -2576,6 +2598,8 @@ export class RayzeeRenderer extends EventDispatcher {
2576
2598
  }
2577
2599
 
2578
2600
  const info = this._completionInfo();
2601
+ // Before it is announced: a listener reading pixels sees the finished image's exposure.
2602
+ await this._finishImage();
2579
2603
  if ( this.completion.markComplete() ) this.dispatchEvent( { type: EngineEvents.RENDER_COMPLETE, ...info } );
2580
2604
 
2581
2605
  const denoised = denoise ? await this._finalDenoise() : false;
@@ -2735,12 +2759,14 @@ export class RayzeeRenderer extends EventDispatcher {
2735
2759
  toneMapping: this.renderer.toneMapping,
2736
2760
  saturation: this.settings.get( 'saturation' ) ?? 1,
2737
2761
  preserveAlpha,
2762
+ gain: this._displayGain(),
2738
2763
  };
2739
2764
 
2740
2765
  const gpu = await this._toneMapOnGPU( shown?.texture ?? null, target, width, height, tone );
2766
+ const fn = ! gpu && tone.gain ? await tone.gain.cpu() : null;
2741
2767
  const data = gpu ?? toneMapToRGBA8( shown
2742
2768
  ? await this._readTexture( shown.texture, width, height )
2743
- : await this.renderer.readRenderTargetPixelsAsync( target, 0, 0, width, height, 0 ), tone );
2769
+ : await this.renderer.readRenderTargetPixelsAsync( target, 0, 0, width, height, 0 ), { ...tone, pixelGain: fn && { fn, width, height } } );
2744
2770
  return { data, width, height, colorSpace, source: shown?.source ?? 'accumulation', toneMappedOn: gpu ? 'gpu' : 'cpu' };
2745
2771
 
2746
2772
  }
@@ -3982,6 +4008,20 @@ export class RayzeeRenderer extends EventDispatcher {
3982
4008
  /** Once, on the loop frame the render completes. */
3983
4009
  _renderCompleted() {}
3984
4010
 
4011
+ /** True keeps the loop running over a finished render, to redraw what is still changing. */
4012
+ _settling() {
4013
+
4014
+ return false;
4015
+
4016
+ }
4017
+
4018
+ /** A render has its samples, before any closing pass or announcement: a promise to wait for, or null. */
4019
+ _finishImage() {
4020
+
4021
+ return null;
4022
+
4023
+ }
4024
+
3985
4025
  /** Draws what sits over the image. Here only brings the light scene's matrices up to date. */
3986
4026
  _renderHelperOverlay() {
3987
4027
 
@@ -4032,6 +4072,13 @@ export class RayzeeRenderer extends EventDispatcher {
4032
4072
 
4033
4073
  }
4034
4074
 
4075
+ /** A per-pixel gain the shown picture carries before the view (the compositor's), for tone-mapped readbacks; or null. */
4076
+ _displayGain() {
4077
+
4078
+ return null;
4079
+
4080
+ }
4081
+
4035
4082
  /** Whether a 'display' read should find a processed picture. */
4036
4083
  _denoiserInUse() {
4037
4084
 
@@ -258,7 +258,7 @@ export class RenderSettings extends EventDispatcher {
258
258
 
259
259
  handleRenderLimitMode: ( value ) => {
260
260
 
261
- stages.pathTracer?.setRenderLimitMode?.( value );
261
+ stages.pathTracer?.setRenderLimitMode?.( value, this.get( 'renderTimeLimit' ) );
262
262
  reconcileCompletion?.();
263
263
 
264
264
  },
@@ -271,8 +271,10 @@ export class RenderSettings extends EventDispatcher {
271
271
 
272
272
  },
273
273
 
274
- handleRenderTimeLimit: () => {
274
+ // Arming or disarming the deadline lifts or restores the ceiling in 'timeOnly'.
275
+ handleRenderTimeLimit: ( value ) => {
275
276
 
277
+ stages.pathTracer?.setRenderLimitMode?.( this.get( 'renderLimitMode' ), value );
276
278
  reconcileCompletion?.();
277
279
 
278
280
  },