rayzee 7.12.0 → 7.13.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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Rayzee Engine
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/rayzee?label=npm)](https://www.npmjs.com/package/rayzee)
4
- [![minzipped size](https://img.shields.io/badge/minzipped-168.8%20KB-blue)](https://www.npmjs.com/package/rayzee)
4
+ [![minzipped size](https://img.shields.io/badge/minzipped-169%20KB-blue)](https://www.npmjs.com/package/rayzee)
5
5
  [![downloads](https://img.shields.io/npm/dw/rayzee?label=downloads)](https://www.npmjs.com/package/rayzee)
6
6
  [![jsDelivr](https://img.shields.io/jsdelivr/npm/hm/rayzee?label=jsDelivr)](https://www.jsdelivr.com/package/npm/rayzee)
7
7
 
package/dist/rayzee.es.js CHANGED
@@ -8722,7 +8722,7 @@ var vl = /* @__PURE__ */ G("\n fn equirectDirectionToUv( direction: vec3f, envir
8722
8722
  value: d,
8723
8723
  pdf: f
8724
8724
  });
8725
- }), Kl = /* @__PURE__ */ G("\n fn regularizePathContribution( contribution: vec3f, pathLength: f32, fireflyThreshold: f32, frame: i32 ) -> vec3f {\n let threshold = calculateFireflyThreshold( fireflyThreshold, i32( pathLength ), frame );\n return applySoftSuppressionRGB( contribution, threshold, 0.5f );\n }\n", [na, ia]), ql = /* @__PURE__ */ G("\n fn computeNDCDepth( worldPos: vec3f, cameraProjectionMatrix: mat4x4f, cameraViewMatrix: mat4x4f ) -> f32 {\n let clipPos = cameraProjectionMatrix * cameraViewMatrix * vec4f( worldPos, 1.0f );\n let ndcDepth = clipPos.z / clipPos.w * 0.5f + 0.5f;\n return clamp( ndcDepth, 0.0f, 1.0f );\n }\n"), Jl = f(([e, t, n, r, i, a, o]) => {
8725
+ }), Kl = /* @__PURE__ */ G("\n fn regularizePathContribution( contribution: vec3f, pathLength: f32, fireflyThreshold: f32, frame: i32 ) -> vec3f {\n // Indirect-only clamp: pathLength 0 is a direct/primary contribution (bounce-0 hit, direct NEE,\n // or a directly-viewed backdrop/sun) — that is signal, not a firefly, and clamping it darkens\n // legitimately bright pixels. Fireflies arise on indirect bounces, so only suppress pathLength>=1.\n if ( pathLength < 0.5 ) {\n return contribution;\n }\n let threshold = calculateFireflyThreshold( fireflyThreshold, i32( pathLength ), frame );\n return applySoftSuppressionRGB( contribution, threshold, 0.5f );\n }\n", [na, ia]), ql = /* @__PURE__ */ G("\n fn computeNDCDepth( worldPos: vec3f, cameraProjectionMatrix: mat4x4f, cameraViewMatrix: mat4x4f ) -> f32 {\n let clipPos = cameraProjectionMatrix * cameraViewMatrix * vec4f( worldPos, 1.0f );\n let ndcDepth = clipPos.z / clipPos.w * 0.5f + 0.5f;\n return clamp( ndcDepth, 0.0f, 1.0f );\n }\n"), Jl = f(([e, t, n, r, i, a, o]) => {
8726
8726
  let s = M(1).toVar();
8727
8727
  return p(e.greaterThanEqual(N(3)), () => {
8728
8728
  let c = F(F(F(t.x, t.y), t.z), 0).toVar();
@@ -16142,7 +16142,7 @@ var Yf = {
16142
16142
  } catch (e) {
16143
16143
  console.warn("PathTracerApp: prior canvas owner dispose failed", e);
16144
16144
  }
16145
- rp.set(e, this), this.canvas = e, this._autoResize = t.autoResize !== !1, this._container = t.container || null, this.settings = new cf(X), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this._animRefitInFlight = !1, this._maxTextureSize = X.maxTextureSize, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.goboManager = null, this.iesManager = null, this.denoisingManager = null, this.overlayManager = null, this.interactionManager = null, this.transformManager = null, this.animationManager = new tp(), this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this.pathTracerEnabled = !0, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this.completion = new Sd(), this._resizeDebounceTimer = null, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1;
16145
+ rp.set(e, this), this.canvas = e, this._autoResize = t.autoResize !== !1, this._container = t.container || null, this.settings = new cf(X), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this._animRefitInFlight = !1, this._maxTextureSize = X.maxTextureSize, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.goboManager = null, this.iesManager = null, this.denoisingManager = null, this.overlayManager = null, this.interactionManager = null, this.transformManager = null, this.animationManager = new tp(), this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this.pathTracerEnabled = !0, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this._emissiveSamplingUserSet = !1, this.completion = new Sd(), this._resizeDebounceTimer = null, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1;
16146
16146
  }
16147
16147
  _addTrackedListener(e, t, n) {
16148
16148
  e && (e.addEventListener(t, n), this._trackedListeners.push({
@@ -16306,7 +16306,7 @@ var Yf = {
16306
16306
  if (this._loadingInProgress) throw Error("PathTracerApp: another load is already in progress");
16307
16307
  this._loadingInProgress = !0;
16308
16308
  try {
16309
- await e(), this._clearAppendedModels(), this._syncControlsAfterLoad(), await this.loadSceneData(), this.pipeline?.eventBus.emit("autoexposure:resetHistory"), this.reset(), this.cameraManager.currentCameraIndex = 0, this.dispatchEvent(t), this.dispatchEvent({
16309
+ await e(), this._emissiveSamplingUserSet = !1, this._clearAppendedModels(), this._syncControlsAfterLoad(), await this.loadSceneData(), this.pipeline?.eventBus.emit("autoexposure:resetHistory"), this.reset(), this.cameraManager.currentCameraIndex = 0, this.dispatchEvent(t), this.dispatchEvent({
16310
16310
  type: "CamerasUpdated",
16311
16311
  cameras: this.cameraManager.cameras,
16312
16312
  cameraNames: this.cameraManager.getCameraNames()
@@ -16336,7 +16336,11 @@ var Yf = {
16336
16336
  progress: 95
16337
16337
  }), await n, this.stages.pathTracer.environment.applyCDFResults());
16338
16338
  let r = this.getSceneMinY();
16339
- return this.settings.set("groundProjectionLevel", r, { reset: !1 }), this.settings.set("groundCatcherHeight", r, { reset: !1 }), e.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), e.end("Apply settings"), e.print(), rr(), this._initAnimationAndTransforms(), this.dispatchEvent({ type: "SceneRebuild" }), !0;
16339
+ if (this.settings.set("groundProjectionLevel", r, { reset: !1 }), this.settings.set("groundCatcherHeight", r, { reset: !1 }), !this._emissiveSamplingUserSet) {
16340
+ let e = (this._sdf?.emissiveTriangleCount ?? 0) > 0;
16341
+ this.settings.set("enableEmissiveTriangleSampling", e, { reset: !1 });
16342
+ }
16343
+ return e.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), e.end("Apply settings"), e.print(), rr(), this._initAnimationAndTransforms(), this.dispatchEvent({ type: "SceneRebuild" }), !0;
16340
16344
  }
16341
16345
  _tagPrimarySceneObject() {
16342
16346
  let e = this.assetLoader?.targetModel;
@@ -16517,6 +16521,12 @@ var Yf = {
16517
16521
  }
16518
16522
  this.reset();
16519
16523
  }
16524
+ setEmissiveTriangleSampling(e) {
16525
+ this._emissiveSamplingUserSet = !0, this.settings.set("enableEmissiveTriangleSampling", e);
16526
+ }
16527
+ hasEmissiveGeometry() {
16528
+ return (this._sdf?.emissiveTriangleCount ?? 0) > 0;
16529
+ }
16520
16530
  setMeshVisibility(e, t) {
16521
16531
  this.stages.pathTracer?.updateMeshVisibility(e, t), this.reset();
16522
16532
  }