rayzee 4.8.13 → 4.8.15

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/README.md CHANGED
@@ -178,6 +178,7 @@ const engine = new PathTracerApp(canvas, options?)
178
178
  |---|---|---|
179
179
  | `canvas` | `HTMLCanvasElement` | Rendering target |
180
180
  | `options.autoResize` | `boolean` | Auto-resize on window resize (default: `true`) |
181
+ | `options.showStats` | `boolean` | Show the performance stats panel (default: `true`) |
181
182
  | `options.statsContainer` | `HTMLElement` | DOM element to append the stats panel to (defaults to `document.body`) |
182
183
 
183
184
  #### Lifecycle
@@ -233,6 +234,7 @@ Key settings:
233
234
  | `focalLength` | `number` | 50 | DOF focal length (mm) |
234
235
  | `adaptiveSampling` | `boolean` | false | Variance-guided sample distribution |
235
236
  | `transparentBackground` | `boolean` | false | Transparent canvas background |
237
+ | `interactionModeEnabled` | `boolean` | true | Lower quality during camera movement for smoother navigation |
236
238
  | `debugMode` | `number` | 0 | Debug visualization mode (0 = off) |
237
239
  | `environmentMode` | `string` | 'hdri' | Sky mode: `'hdri'` \| `'procedural'` \| `'gradient'` \| `'color'` |
238
240
 
package/dist/rayzee.es.js CHANGED
@@ -3456,7 +3456,7 @@ var to = M(([e, t, n, r]) => {
3456
3456
  let u = e.position.add(e.u.mul(n.x.mul(2).sub(1))).add(e.v.mul(n.y.mul(2).sub(1))).toVar().sub(t).toVar(), d = R(u, u).toVar();
3457
3457
  N(d.greaterThanEqual(1e-10), () => {
3458
3458
  let t = gt(d).toVar(), n = u.div(t).toVar(), f = U(Xe(e.u, e.v)).toVar(), p = R(n.negate(), f).toVar();
3459
- l.assign(B(1)), o.assign(e.color.mul(e.intensity).div(Lr)), s.assign(t), a.assign(n), c.assign(d.div(V(e.area.mul(V(p, .001)), 1e-10)).mul(r)), i.assign(p.greaterThan(0));
3459
+ l.assign(B(1)), o.assign(e.color.mul(e.intensity)), s.assign(t), a.assign(n), c.assign(d.div(V(e.area.mul(V(p, .001)), 1e-10)).mul(r)), i.assign(p.greaterThan(0));
3460
3460
  });
3461
3461
  }), Ia({
3462
3462
  valid: i,
@@ -3473,7 +3473,7 @@ M(([e, t, n, r]) => {
3473
3473
  let u = z(.5).mul(gt(n.x)).toVar(), d = n.y.mul(eo).toVar(), f = u.mul(Ye(d)).toVar(), p = u.mul(mt(d)).toVar(), m = e.position.add(e.u.mul(f)).add(e.v.mul(p)).toVar().sub(t).toVar(), h = R(m, m).toVar();
3474
3474
  N(h.greaterThanEqual(1e-10), () => {
3475
3475
  let t = gt(h).toVar(), n = m.div(t).toVar(), u = U(Xe(e.u, e.v)).toVar(), d = R(n.negate(), u).toVar();
3476
- l.assign(B(1)), o.assign(e.color.mul(e.intensity).div(Lr)), s.assign(t), a.assign(n), c.assign(h.div(V(e.area.mul(V(d, .001)), 1e-10)).mul(r)), i.assign(d.greaterThan(0));
3476
+ l.assign(B(1)), o.assign(e.color.mul(e.intensity)), s.assign(t), a.assign(n), c.assign(h.div(V(e.area.mul(V(d, .001)), 1e-10)).mul(r)), i.assign(d.greaterThan(0));
3477
3477
  });
3478
3478
  }), Ia({
3479
3479
  valid: i,
@@ -3768,23 +3768,18 @@ var oo = M(([e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S
3768
3768
  })), () => {
3769
3769
  let a = ot(i.distance.sub(.001), z(1e3)).toVar(), o = qa(A, i.direction, a, l, bi, v, y, b);
3770
3770
  N(o.greaterThan(0), () => {
3771
- let a = Oa(r, i.direction, t, n), s = ao(r, i.direction, t, n).toVar(), l = z(1).toVar();
3771
+ let a = Oa(r, i.direction, t, n), s = ao(r, i.direction, t, n).toVar(), c = z(1).toVar();
3772
3772
  N(s.greaterThan(0).and(te), () => {
3773
3773
  let e = i.pdf.mul(ie).toVar(), t = s.mul(re).toVar();
3774
3774
  N(i.lightType.equal(B(1)), () => {
3775
- l.assign(Yr({
3776
- pdf1: e,
3777
- pdf2: t
3778
- }));
3779
- }).ElseIf(c.equal(B(0)).and(i.lightType.equal(B(0))), () => {
3780
- l.assign(Yr({
3775
+ c.assign(Yr({
3781
3776
  pdf1: e,
3782
3777
  pdf2: t
3783
3778
  }));
3784
3779
  });
3785
3780
  });
3786
- let u = i.emission.mul(a).mul(e).mul(o).mul(l).div(V(i.pdf, 1e-10));
3787
- k.addAssign(u.mul(ce).div(V(ie, 1e-10)));
3781
+ let l = i.emission.mul(a).mul(e).mul(o).mul(c).div(V(i.pdf, 1e-10));
3782
+ k.addAssign(l.mul(ce).div(V(ie, 1e-10)));
3788
3783
  });
3789
3784
  });
3790
3785
  });
@@ -11011,7 +11006,7 @@ var oc = class extends fn {
11011
11006
  e.traverse((e) => {
11012
11007
  let n = e.userData;
11013
11008
  if (e.isRectAreaLight && !t.includes(e.uuid) && t.push(e.uuid), e.name.startsWith("RectAreaLightPlaceholder") && n.name && n.type === "RectAreaLight") {
11014
- let r = new we(new v(...n.color), n.intensity / Math.PI, n.width, n.height);
11009
+ let r = new we(new v(...n.color), n.intensity * .1 / Math.PI, n.width, n.height);
11015
11010
  r.position.z = -2, r.name = n.name, e.add(r), t.push(r.uuid);
11016
11011
  }
11017
11012
  if (e.isMesh && Array.isArray(e.material)) {
@@ -11398,6 +11393,10 @@ var oc = class extends fn {
11398
11393
  uniform: "adaptiveSamplingMax",
11399
11394
  reset: !0
11400
11395
  },
11396
+ interactionModeEnabled: {
11397
+ handler: "handleInteractionModeEnabled",
11398
+ reset: !1
11399
+ },
11401
11400
  maxSamples: {
11402
11401
  handler: "handleMaxSamples",
11403
11402
  reset: !1
@@ -12842,7 +12841,7 @@ var Wc = new Float32Array(3), Gc = {
12842
12841
  }
12843
12842
  }, nl = class extends E {
12844
12843
  constructor(e, t = {}) {
12845
- super(), this.canvas = e, this.denoiserCanvas = null, this._autoResize = t.autoResize !== !1, this._statsContainer = t.statsContainer || null, this.settings = new Tc(Z), this.renderer = null, this._camera = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this._controls = null, this.assetLoader = null, this._sdf = null, this.animationManager = new Qc(), this._animRefitInFlight = !1, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.denoisingManager = null, this.overlayManager = null, this.isInitialized = !1, this.pauseRendering = !1, this.pathTracerEnabled = !0, this.animationId = null, this.needsReset = !1, this._renderCompleteDispatched = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this.lastResetTime = performance.now(), this.timeElapsed = 0, this._lastRenderWidth = 0, this._lastRenderHeight = 0, this._resizeDebounceTimer = null, this._outputAPI = null, this._lightsAPI = null, this._animationAPI = null, this._selectionAPI = null, this._transformAPI = null, this._cameraAPI = null, this._environmentAPI = null, this._materialsAPI = null, this._denoisingAPI = null;
12844
+ super(), this.canvas = e, this.denoiserCanvas = null, this._autoResize = t.autoResize !== !1, this._showStats = t.showStats !== !1, this._statsContainer = t.statsContainer || null, this.settings = new Tc(Z), this.renderer = null, this._camera = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this._controls = null, this.assetLoader = null, this._sdf = null, this.animationManager = new Qc(), this._animRefitInFlight = !1, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.denoisingManager = null, this.overlayManager = null, this.isInitialized = !1, this.pauseRendering = !1, this.pathTracerEnabled = !0, this.animationId = null, this.needsReset = !1, this._renderCompleteDispatched = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this.lastResetTime = performance.now(), this.timeElapsed = 0, this._lastRenderWidth = 0, this._lastRenderHeight = 0, this._resizeDebounceTimer = null, this._outputAPI = null, this._lightsAPI = null, this._animationAPI = null, this._selectionAPI = null, this._transformAPI = null, this._cameraAPI = null, this._environmentAPI = null, this._materialsAPI = null, this._denoisingAPI = null;
12846
12845
  }
12847
12846
  set(e, t, n) {
12848
12847
  this.settings.set(e, t, n);
@@ -12954,7 +12953,7 @@ var Wc = new Float32Array(3), Gc = {
12954
12953
  }, this.assetLoader.addEventListener("load", this._onAssetLoaded), this.assetLoader.addEventListener("modelProcessed", (e) => {
12955
12954
  let t = [this._camera, ...e.cameras || []];
12956
12955
  this.cameraManager.setCameras(t), this._floorPlane = this.assetLoader.floorPlane, this._interactionManager && (this._interactionManager.floorPlane = this._floorPlane);
12957
- }), this.stages.pathTracer.setTriangleData(new Float32Array(32), 0), this.stages.pathTracer.setBVHData(new Float32Array(16)), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this._initStats(), this.isInitialized = !0, console.log("WebGPU Path Tracer App initialized"), this;
12956
+ }), this.stages.pathTracer.setTriangleData(new Float32Array(32), 0), this.stages.pathTracer.setBVHData(new Float32Array(16)), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this._showStats && this._initStats(), this.isInitialized = !0, console.log("WebGPU Path Tracer App initialized"), this;
12958
12957
  }
12959
12958
  animate() {
12960
12959
  if (this.animationId = requestAnimationFrame(() => this.animate()), this._loadingInProgress || this._sdf?.isProcessing) {
@@ -13498,6 +13497,9 @@ var Wc = new Float32Array(3), Gc = {
13498
13497
  },
13499
13498
  handleEnvironmentRotation: (e) => {
13500
13499
  this.stages.pathTracer?.environment.setEnvironmentRotation(e);
13500
+ },
13501
+ handleInteractionModeEnabled: (e) => {
13502
+ this.setInteractionModeEnabled(e);
13501
13503
  }
13502
13504
  };
13503
13505
  }