rayzee 7.12.1 → 7.14.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayzee",
3
- "version": "7.12.1",
3
+ "version": "7.14.0",
4
4
  "type": "module",
5
5
  "description": "Real-time WebGPU path tracing engine built on Three.js",
6
6
  "main": "dist/rayzee.umd.js",
@@ -146,6 +146,9 @@ export class PathTracerApp extends EventDispatcher {
146
146
  this._loadingInProgress = false;
147
147
  this._needsDisplayRefresh = false;
148
148
  this._paused = false;
149
+ // Emissive-triangle NEE auto-follows the scene (on when it has emissive geometry)
150
+ // until the user toggles it explicitly; reset on each fresh model load.
151
+ this._emissiveSamplingUserSet = false;
149
152
 
150
153
  // Render completion tracking
151
154
  this.completion = new CompletionTracker();
@@ -759,6 +762,9 @@ export class PathTracerApp extends EventDispatcher {
759
762
  try {
760
763
 
761
764
  await loadFn();
765
+ // A fresh model re-establishes the emissive-sampling auto-default (incremental
766
+ // rebuilds — add/remove object, texture reprocess — preserve the user's choice).
767
+ this._emissiveSamplingUserSet = false;
762
768
  // Replace-load clears any dynamically-appended models — but only AFTER
763
769
  // loadFn() succeeds, so a failed load leaves the current scene intact.
764
770
  // (The old primary was already released by releaseTargetModel() in loadFn.)
@@ -871,6 +877,16 @@ export class PathTracerApp extends EventDispatcher {
871
877
  this.settings.set( 'groundProjectionLevel', sceneMinY, { reset: false } );
872
878
  this.settings.set( 'groundCatcherHeight', sceneMinY, { reset: false } );
873
879
 
880
+ // Auto-follow the scene: enable emissive-triangle NEE when the scene has emissive
881
+ // geometry, disable it when it doesn't — unless the user set the toggle explicitly.
882
+ // Runs before applyAll()/SceneRebuild so the uniform and UI both pick up the new value.
883
+ if ( ! this._emissiveSamplingUserSet ) {
884
+
885
+ const hasEmissive = ( this._sdf?.emissiveTriangleCount ?? 0 ) > 0;
886
+ this.settings.set( 'enableEmissiveTriangleSampling', hasEmissive, { reset: false } );
887
+
888
+ }
889
+
874
890
  // Apply all settings to stages in one shot
875
891
  timer.start( 'Apply settings' );
876
892
  this.settings.applyAll();
@@ -1512,6 +1528,28 @@ export class PathTracerApp extends EventDispatcher {
1512
1528
 
1513
1529
  }
1514
1530
 
1531
+ /**
1532
+ * Explicitly enable/disable emissive-triangle next-event estimation. Marks the
1533
+ * setting as user-controlled so scene rebuilds stop auto-following the scene's
1534
+ * emissive content; the next fresh model load re-arms the auto-default.
1535
+ * @param {boolean} enabled
1536
+ */
1537
+ setEmissiveTriangleSampling( enabled ) {
1538
+
1539
+ this._emissiveSamplingUserSet = true;
1540
+ this.settings.set( 'enableEmissiveTriangleSampling', enabled );
1541
+
1542
+ }
1543
+
1544
+ /**
1545
+ * @returns {boolean} True if the current scene contains emissive geometry.
1546
+ */
1547
+ hasEmissiveGeometry() {
1548
+
1549
+ return ( this._sdf?.emissiveTriangleCount ?? 0 ) > 0;
1550
+
1551
+ }
1552
+
1515
1553
  /**
1516
1554
  * Update per-mesh visibility without rebuilding the scene.
1517
1555
  * Walks the parent chain to resolve world-space visibility.
@@ -90,6 +90,7 @@ export class LightSerializer {
90
90
 
91
91
  addDirectionalLight( light ) {
92
92
 
93
+ if ( ! light.visible ) return; // Skip hidden lights
93
94
  if ( light.intensity <= 0.0 ) return; // Skip zero intensity lights
94
95
 
95
96
  light.updateMatrixWorld();
@@ -146,6 +147,7 @@ export class LightSerializer {
146
147
 
147
148
  addRectAreaLight( light ) {
148
149
 
150
+ if ( ! light.visible ) return; // Skip hidden lights
149
151
  if ( light.intensity <= 0.0 ) return; // Skip zero intensity lights
150
152
 
151
153
  light.updateMatrixWorld();
@@ -190,6 +192,7 @@ export class LightSerializer {
190
192
 
191
193
  addPointLight( light ) {
192
194
 
195
+ if ( ! light.visible ) return; // Skip hidden lights
193
196
  if ( light.intensity <= 0.0 ) return; // Skip zero intensity lights
194
197
 
195
198
  light.updateMatrixWorld();
@@ -218,6 +221,7 @@ export class LightSerializer {
218
221
 
219
222
  addSpotLight( light ) {
220
223
 
224
+ if ( ! light.visible ) return; // Skip hidden lights
221
225
  if ( light.intensity <= 0.0 ) return; // Skip zero intensity lights
222
226
 
223
227
  light.updateMatrixWorld();
@@ -330,6 +330,7 @@ export class LightManager extends EventDispatcher {
330
330
  uuid: light.uuid,
331
331
  name: light.name,
332
332
  type: light.type,
333
+ visible: light.visible,
333
334
  intensity: light.intensity,
334
335
  color: `#${light.color.getHexString()}`,
335
336
  position: [ light.position.x, light.position.y, light.position.z ],