rayzee 4.8.12 → 4.8.14

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": "4.8.12",
3
+ "version": "4.8.14",
4
4
  "type": "module",
5
5
  "description": "Real-time WebGPU path tracing engine built on Three.js",
6
6
  "main": "dist/rayzee.umd.js",
@@ -67,6 +67,7 @@ export class PathTracerApp extends EventDispatcher {
67
67
  * @param {HTMLCanvasElement} canvas - Canvas element for rendering
68
68
  * @param {Object} [options] - Engine options
69
69
  * @param {boolean} [options.autoResize=true] - Automatically listen for window resize events
70
+ * @param {boolean} [options.showStats=true] - Show the performance stats panel
70
71
  * @param {HTMLElement} [options.statsContainer] - DOM element to append the stats panel to (defaults to document.body)
71
72
  */
72
73
  constructor( canvas, options = {} ) {
@@ -76,6 +77,7 @@ export class PathTracerApp extends EventDispatcher {
76
77
  this.canvas = canvas;
77
78
  this.denoiserCanvas = null;
78
79
  this._autoResize = options.autoResize !== false;
80
+ this._showStats = options.showStats !== false;
79
81
  this._statsContainer = options.statsContainer || null;
80
82
 
81
83
  // ── Settings (single source of truth for all render parameters) ──
@@ -507,7 +509,7 @@ export class PathTracerApp extends EventDispatcher {
507
509
  this.stages.pathTracer.setupMaterial();
508
510
 
509
511
  // Setup stats panel
510
- this._initStats();
512
+ if ( this._showStats ) this._initStats();
511
513
 
512
514
  this.isInitialized = true;
513
515
  console.log( 'WebGPU Path Tracer App initialized' );
@@ -2236,6 +2238,12 @@ export class PathTracerApp extends EventDispatcher {
2236
2238
 
2237
2239
  },
2238
2240
 
2241
+ handleInteractionModeEnabled: ( value ) => {
2242
+
2243
+ this.setInteractionModeEnabled( value );
2244
+
2245
+ },
2246
+
2239
2247
  };
2240
2248
 
2241
2249
  }
@@ -1214,7 +1214,7 @@ export class AssetLoader extends EventDispatcher {
1214
1214
 
1215
1215
  const light = new RectAreaLight(
1216
1216
  new Color( ...userData.color ),
1217
- userData.intensity,
1217
+ userData.intensity / Math.PI, // Adjust intensity for better visual results
1218
1218
  userData.width,
1219
1219
  userData.height
1220
1220
  );
@@ -40,6 +40,7 @@ const SETTING_ROUTES = {
40
40
 
41
41
  // ── Multi-stage / special handling ────────────────────────────
42
42
 
43
+ interactionModeEnabled: { handler: 'handleInteractionModeEnabled', reset: false },
43
44
  maxSamples: { handler: 'handleMaxSamples', reset: false },
44
45
  transparentBackground: { handler: 'handleTransparentBackground' },
45
46
  exposure: { handler: 'handleExposure' },
@@ -391,11 +391,12 @@ export const traverseBVHShadow = Fn( ( [
391
391
  bvhBuffer,
392
392
  triangleBuffer,
393
393
  materialBuffer,
394
+ maxShadowDist,
394
395
  ] ) => {
395
396
 
396
397
  const closestHit = HitInfo( {
397
398
  didHit: false,
398
- dst: float( 1e20 ),
399
+ dst: maxShadowDist,
399
400
  hitPoint: vec3( 0.0 ),
400
401
  normal: vec3( 0.0 ),
401
402
  uv: vec2( 0.0 ),
@@ -79,6 +79,7 @@ export const traceShadowRay = Fn( ( [
79
79
 
80
80
  const transmittance = float( 1.0 ).toVar();
81
81
  const rayOrigin = origin.toVar();
82
+ const remainingDist = float( maxDist ).toVar();
82
83
 
83
84
  const MAX_SHADOW_TRANSMISSIONS = 8;
84
85
 
@@ -91,10 +92,11 @@ export const traceShadowRay = Fn( ( [
91
92
  bvhBuffer,
92
93
  triangleBuffer,
93
94
  materialBuffer,
95
+ remainingDist,
94
96
  ) );
95
97
 
96
- // No hit or hit beyond light distance
97
- If( shadowHit.didHit.not().or( shadowHit.dst.greaterThan( maxDist ) ), () => {
98
+ // No hit within remaining distance to light
99
+ If( shadowHit.didHit.not(), () => {
98
100
 
99
101
  Break();
100
102
 
@@ -139,8 +141,9 @@ export const traceShadowRay = Fn( ( [
139
141
 
140
142
  } );
141
143
 
142
- // Continue ray
144
+ // Continue ray past transmissive surface
143
145
  rayOrigin.assign( shadowHit.hitPoint.add( dir.mul( 0.001 ) ) );
146
+ remainingDist.subAssign( shadowHit.dst.add( 0.001 ) );
144
147
 
145
148
  } ).ElseIf( shadowMaterial.transparent, () => {
146
149
 
@@ -154,8 +157,9 @@ export const traceShadowRay = Fn( ( [
154
157
 
155
158
  } );
156
159
 
157
- // Continue ray
160
+ // Continue ray past transparent surface
158
161
  rayOrigin.assign( shadowHit.hitPoint.add( dir.mul( 0.001 ) ) );
162
+ remainingDist.subAssign( shadowHit.dst.add( 0.001 ) );
159
163
 
160
164
  } ).Else( () => {
161
165