rayzee 7.22.6 → 7.22.7
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/dist/rayzee.es.js +93 -73
- package/dist/rayzee.umd.js +22 -22
- package/package.json +1 -1
- package/src/PathTracerApp.js +33 -10
- package/src/Stages/PathTracer.js +64 -8
- package/src/TSL/FinalWriteKernel.js +5 -3
- package/src/managers/DenoisingManager.js +12 -0
- package/src/managers/UniformManager.js +4 -0
package/dist/rayzee.es.js
CHANGED
|
@@ -1244,7 +1244,7 @@ var di = class {
|
|
|
1244
1244
|
let r = V(t, n);
|
|
1245
1245
|
return this._uniforms.set(e, r), r;
|
|
1246
1246
|
}, r = (e, t) => (this._booleans.add(e), n(e, +!!t, "int"));
|
|
1247
|
-
n("frame", 0, "uint"), n("seedFrame", 0, "uint"), n("maxBounces", Y.bounces, "int"), n("maxSamples", Y.maxSamples, "int"), n("transmissiveBounces", Y.transmissiveBounces, "int"), n("maxSubsurfaceSteps", Y.maxSubsurfaceSteps, "int"), n("maxTransparentBounces", Y.maxTransparentBounces, "int"), n("visMode", Y.debugMode, "int"), n("debugVisScale", Y.debugVisScale, "float"), r("useAdaptiveSampling", Y.useAdaptiveSampling), n("noiseThreshold", Y.noiseThreshold, "float"), n("adaptiveMinSamples", Y.adaptiveMinSamples, "int"), n("adaptiveStopFraction", Y.adaptiveStopFraction, "float"), r("usePixelFreeze", Y.usePixelFreeze), n("pixelFreezeThreshold", Y.pixelFreezeThreshold, "float"), n("pixelFreezeStability", Y.pixelFreezeStability, "int"), r("convergenceOverlay", Y.convergenceOverlay), r("enableAccumulation", !0), n("accumulationAlpha", 0, "float"), r("cameraIsMoving", !1), r("hasPreviousAccumulated", !1), n("environmentIntensity", Y.environmentIntensity, "float"), n("backgroundIntensity", Y.backgroundIntensity, "float"), n("backgroundColor", new et(0, 0, 0), "color"), n("backgroundBlurriness", Y.backgroundBlurriness, "float"), n("backgroundBlurSamples", Y.backgroundBlurSamples, "int"), r("showBackground", Y.showBackground), r("transparentBackground", Y.transparentBackground), r("enableEnvironment", Y.enableEnvironment), n("environmentMatrix", new St(), "mat4"), n("envTotalSum", 0, "float"), n("envCompensationDelta", 0, "float"), n("envResolution", new on(1, 1), "vec2"), r("groundProjectionEnabled", Y.groundProjectionEnabled), n("groundProjectionRadius", Y.groundProjectionRadius, "float"), n("groundProjectionHeight", Y.groundProjectionHeight, "float"), n("groundProjectionLevel", Y.groundProjectionLevel, "float"), r("enableGroundCatcher", Y.enableGroundCatcher), n("groundCatcherHeight", Y.groundCatcherHeight, "float"), n("sunDirection", new sn(0, 1, 0), "vec3"), n("sunAngularSize", .0087, "float"), r("hasSun", !1), n("globalIlluminationIntensity", Y.globalIlluminationIntensity, "float"), n("exposure", Y.exposure, "float"), n("numDirectionalLights", 0, "int"), n("numAreaLights", 0, "int"), n("numPointLights", 0, "int"), n("numSpotLights", 0, "int"), this._lightBuffers = {
|
|
1247
|
+
n("frame", 0, "uint"), n("seedFrame", 0, "uint"), n("maxBounces", Y.bounces, "int"), n("maxSamples", Y.maxSamples, "int"), n("transmissiveBounces", Y.transmissiveBounces, "int"), n("maxSubsurfaceSteps", Y.maxSubsurfaceSteps, "int"), n("maxTransparentBounces", Y.maxTransparentBounces, "int"), n("visMode", Y.debugMode, "int"), n("debugVisScale", Y.debugVisScale, "float"), r("useAdaptiveSampling", Y.useAdaptiveSampling), n("noiseThreshold", Y.noiseThreshold, "float"), n("adaptiveMinSamples", Y.adaptiveMinSamples, "int"), n("adaptiveStopFraction", Y.adaptiveStopFraction, "float"), r("usePixelFreeze", Y.usePixelFreeze), n("pixelFreezeThreshold", Y.pixelFreezeThreshold, "float"), n("pixelFreezeStability", Y.pixelFreezeStability, "int"), r("convergenceOverlay", Y.convergenceOverlay), r("enableAccumulation", !0), n("accumulationAlpha", 0, "float"), r("cameraIsMoving", !1), r("hasPreviousAccumulated", !1), n("auxAccumulationAlpha", 1, "float"), r("hasPreviousAux", !1), n("environmentIntensity", Y.environmentIntensity, "float"), n("backgroundIntensity", Y.backgroundIntensity, "float"), n("backgroundColor", new et(0, 0, 0), "color"), n("backgroundBlurriness", Y.backgroundBlurriness, "float"), n("backgroundBlurSamples", Y.backgroundBlurSamples, "int"), r("showBackground", Y.showBackground), r("transparentBackground", Y.transparentBackground), r("enableEnvironment", Y.enableEnvironment), n("environmentMatrix", new St(), "mat4"), n("envTotalSum", 0, "float"), n("envCompensationDelta", 0, "float"), n("envResolution", new on(1, 1), "vec2"), r("groundProjectionEnabled", Y.groundProjectionEnabled), n("groundProjectionRadius", Y.groundProjectionRadius, "float"), n("groundProjectionHeight", Y.groundProjectionHeight, "float"), n("groundProjectionLevel", Y.groundProjectionLevel, "float"), r("enableGroundCatcher", Y.enableGroundCatcher), n("groundCatcherHeight", Y.groundCatcherHeight, "float"), n("sunDirection", new sn(0, 1, 0), "vec3"), n("sunAngularSize", .0087, "float"), r("hasSun", !1), n("globalIlluminationIntensity", Y.globalIlluminationIntensity, "float"), n("exposure", Y.exposure, "float"), n("numDirectionalLights", 0, "int"), n("numAreaLights", 0, "int"), n("numPointLights", 0, "int"), n("numSpotLights", 0, "int"), this._lightBuffers = {
|
|
1248
1248
|
directional: Pe(new Float32Array(192), "float"),
|
|
1249
1249
|
area: Pe(new Float32Array(256), "float"),
|
|
1250
1250
|
point: Pe(new Float32Array(144), "float"),
|
|
@@ -10468,47 +10468,47 @@ function Hd(e) {
|
|
|
10468
10468
|
}
|
|
10469
10469
|
var Ud = /* @__PURE__ */ K("\n fn nanInfToRed( c: vec3f ) -> vec3f {\n let isNan = c.x != c.x || c.y != c.y || c.z != c.z;\n let isInf = abs( c.x ) > 1e30f || abs( c.y ) > 1e30f || abs( c.z ) > 1e30f;\n if ( isNan || isInf ) { return vec3f( 1.0f, 0.0f, 0.0f ); }\n return vec3f( 0.0f );\n }\n");
|
|
10470
10470
|
function Wd(e) {
|
|
10471
|
-
let { rayBufferRO: t, gBufferRO: n, writeColorTex: r, writeNDTex: i, writeAlbedoTex: a, resolution: o, frame: s, enableAccumulation: c, hasPreviousAccumulated: l, accumulationAlpha: u, cameraIsMoving: d,
|
|
10471
|
+
let { rayBufferRO: t, gBufferRO: n, writeColorTex: r, writeNDTex: i, writeAlbedoTex: a, resolution: o, frame: s, enableAccumulation: c, hasPreviousAccumulated: l, accumulationAlpha: u, cameraIsMoving: d, hasPreviousAux: m, auxAccumulationAlpha: h, transparentBackground: g, prevAccumTexture: _, prevAlbedoTexture: v, prevNormalDepthTexture: y, renderWidth: b, chunkRowBase: x, chunkRows: S, visMode: C, auxGBufferEnabled: w, cleanAuxNormalEnabled: T, m2BufferRW: E, useAdaptiveSampling: D, noiseThreshold: O, adaptiveMinSamples: k, usePixelFreeze: A, pixelFreezeThreshold: ee, streakBufferRW: te, frozenMaskRO: ne, convergenceOverlay: re } = e, ie = w.greaterThan(B(0)), M = T.greaterThan(B(0)), P = D.greaterThan(N(0)), oe = A.greaterThan(N(0)), ce = P.or(oe).or(re.greaterThan(N(0)));
|
|
10472
10472
|
return f(() => {
|
|
10473
10473
|
let e = N(Ve.x).mul(16).add(N(se.x)), f = N(Ve.y).mul(16).add(N(se.y));
|
|
10474
|
-
p(e.lessThan(
|
|
10475
|
-
let
|
|
10476
|
-
p(
|
|
10477
|
-
let e = Dl(n,
|
|
10478
|
-
|
|
10474
|
+
p(e.lessThan(b).and(f.lessThan(S)), () => {
|
|
10475
|
+
let S = f.add(x), w = B(f.mul(b).add(e)), T = B(S.mul(b).add(e)), D = wl(t, w), A = D.xyz.toVar(), re = R(g, D.w, j(1)).toVar(), se = oe.and(s.greaterThan(B(0))).and(ne.element(T).equal(B(1))).toVar(), le = G(0).toVar(), ue = G(0).xyz.toVar();
|
|
10476
|
+
p(ie, () => {
|
|
10477
|
+
let e = Dl(n, w);
|
|
10478
|
+
le.assign(Ol(e)), ue.assign(G(kl(e), 0).xyz);
|
|
10479
10479
|
});
|
|
10480
|
-
let
|
|
10481
|
-
p(c.and(d.not()).and(s.greaterThan(B(0))).and(l).and(
|
|
10482
|
-
let e = Ae(
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
let e = Ae(
|
|
10486
|
-
|
|
10480
|
+
let F = U(j(e).add(.5), j(S).add(.5)).div(o);
|
|
10481
|
+
p(c.and(d.not()).and(s.greaterThan(B(0))).and(l).and(C.notEqual(N(11))), () => {
|
|
10482
|
+
let e = Ae(_, F, 0).toVar();
|
|
10483
|
+
A.assign(R(se, e.xyz, I(e.xyz, D.xyz, u))), p(ie.and(m), () => {
|
|
10484
|
+
ue.assign(I(Ae(v, F, 0).xyz, ue, h)), p(M, () => {
|
|
10485
|
+
let e = Ae(y, F, 0).xyz.mul(2).sub(1), t = le.xyz.mul(2).sub(1).toVar(), n = I(e, t, h).toVar(), r = ae(n), i = R(r.greaterThan(1e-4), n.div(r), t);
|
|
10486
|
+
le.assign(G(i.mul(.5).add(.5), le.w));
|
|
10487
10487
|
});
|
|
10488
|
-
}), p(
|
|
10489
|
-
|
|
10488
|
+
}), p(g, () => {
|
|
10489
|
+
re.assign(R(se, e.w, I(e.w, D.w, u)));
|
|
10490
10490
|
});
|
|
10491
|
-
}), p(
|
|
10492
|
-
let e = Oa(
|
|
10493
|
-
|
|
10494
|
-
let n = Oa(
|
|
10495
|
-
p(
|
|
10496
|
-
let e =
|
|
10497
|
-
p(
|
|
10491
|
+
}), p(ce, () => {
|
|
10492
|
+
let e = Oa(D.xyz), t = I(E.element(T).toVar(), e.mul(e), u).toVar();
|
|
10493
|
+
E.element(T).assign(t);
|
|
10494
|
+
let n = Oa(A).toVar(), r = t.sub(n.mul(n)).max(j(0)).div(j(s).add(1)).sqrt().toVar(), i = r.div(n.add(j(1e-4))), a = R(n.lessThan(j(1)), n.sqrt(), n), o = r.div(a.add(j(1e-4))).lessThan(O);
|
|
10495
|
+
p(P.or(oe), () => {
|
|
10496
|
+
let e = P.and(s.greaterThanEqual(B(k))).and(o), t = te.element(T).toVar(), r = t.bitAnd(B(1073741823)).toVar(), a = r.toVar(), c = D.w.greaterThan(j(.5)), l = t.bitAnd(B(1073741824)).notEqual(B(0)), u = R(s.equal(B(0)), R(c, B(1073741824), B(0)), R(c.or(l), B(1073741824), B(0))).toVar();
|
|
10497
|
+
p(oe, () => {
|
|
10498
10498
|
p(s.equal(B(0)), () => {
|
|
10499
10499
|
a.assign(B(0));
|
|
10500
|
-
}), p(
|
|
10501
|
-
let e = s.greaterThanEqual(B(
|
|
10500
|
+
}), p(se.not().and(s.greaterThan(B(0))), () => {
|
|
10501
|
+
let e = s.greaterThanEqual(B(k)).and(i.lessThan(ee)).and(n.greaterThan(j(0)));
|
|
10502
10502
|
a.assign(R(e, r.add(B(1)), B(0)));
|
|
10503
10503
|
});
|
|
10504
|
-
}),
|
|
10504
|
+
}), te.element(T).assign(a.bitOr(R(e, B(2147483648), B(0))).bitOr(u));
|
|
10505
10505
|
});
|
|
10506
|
-
}), p(
|
|
10507
|
-
|
|
10506
|
+
}), p(C.equal(N(11)), () => {
|
|
10507
|
+
A.assign(Ud(A));
|
|
10508
10508
|
});
|
|
10509
|
-
let
|
|
10510
|
-
Me(r,
|
|
10511
|
-
Me(i,
|
|
10509
|
+
let de = Le(B(e), B(S));
|
|
10510
|
+
Me(r, de, G(A, re)).toWriteOnly(), p(ie, () => {
|
|
10511
|
+
Me(i, de, le).toWriteOnly(), Me(a, de, G(ue, 1)).toWriteOnly();
|
|
10512
10512
|
});
|
|
10513
10513
|
});
|
|
10514
10514
|
});
|
|
@@ -10746,7 +10746,7 @@ var ef = ai("wavefront"), tf = 256, nf = [
|
|
|
10746
10746
|
"compactCopyback"
|
|
10747
10747
|
], rf = class extends dl {
|
|
10748
10748
|
constructor(e, t, n, r = {}) {
|
|
10749
|
-
super(e, t, n, r), this.name = "PathTracer", this._packedBuffers = null, this._queueManager = null, this._kernelManager = null, this._gBufferAttr = null, this._m2Attr = null, this._streakAttr = null, this._frozenMaskAttr = null, this._convDebugSource = null, this._dilateFrozenUniform = V(1, "int"), this._wavefrontReady = !1, this._auxGBufferEnabled = !1, this._auxGBufferUniform = V(0, "uint"), this._cleanAuxNormalEnabled = !1, this._cleanAuxNormalUniform = V(0, "uint"), this._useDynamicDispatch = !0, this._sortMaterials = !1, this._useSubgroupCompact = !1, this._lastBounceCounts = null, this._lastBounceCountsBudget = -1, this._readbackPending = !1, this._readbackEveryNFrames = 4, this._readbackFrameCounter = 0, this._readbackGeneration = 0, this._curveSizingValid = !1, this._bounceEarlyExitThreshold = 100, this._convergedFraction = 0, this._convergedGeometryFraction = 0, this._geometryPixelCount = 0, this._convergedReadbackPending = !1, this._lastActivePixelCount = 0, this._wfRenderWidth = V(1920, "int"), this._wfRenderHeight = V(1080, "int"), this._wfMaxRayCount = V(0, "uint"), this._wfCurrentBounce = V(0, "int"), this._wfChunkRowBase = V(0, "int"), this._wfChunkRows = V(0, "int"), this._wfIsFirstChunk = V(1, "uint"), this._pathBudget = 0, this._pathBudgetOverride = 0, this._chunkRows = 0, this._numChunks = 1, this.vramTracker = new uu(this.renderer), this._registerVRAMProviders(), ef.debug("initialized (wavefront)");
|
|
10749
|
+
super(e, t, n, r), this.name = "PathTracer", this._packedBuffers = null, this._queueManager = null, this._kernelManager = null, this._gBufferAttr = null, this._m2Attr = null, this._streakAttr = null, this._frozenMaskAttr = null, this._convDebugSource = null, this._dilateFrozenUniform = V(1, "int"), this._wavefrontReady = !1, this._auxGBufferEnabled = !1, this._auxGBufferUniform = V(0, "uint"), this._cleanAuxNormalEnabled = !1, this._cleanAuxNormalUniform = V(0, "uint"), this._auxSamples = 0, this._auxSeedPending = !1, this._useDynamicDispatch = !0, this._sortMaterials = !1, this._useSubgroupCompact = !1, this._lastBounceCounts = null, this._lastBounceCountsBudget = -1, this._readbackPending = !1, this._readbackEveryNFrames = 4, this._readbackFrameCounter = 0, this._readbackGeneration = 0, this._curveSizingValid = !1, this._bounceEarlyExitThreshold = 100, this._convergedFraction = 0, this._convergedGeometryFraction = 0, this._geometryPixelCount = 0, this._convergedReadbackPending = !1, this._lastActivePixelCount = 0, this._wfRenderWidth = V(1920, "int"), this._wfRenderHeight = V(1080, "int"), this._wfMaxRayCount = V(0, "uint"), this._wfCurrentBounce = V(0, "int"), this._wfChunkRowBase = V(0, "int"), this._wfChunkRows = V(0, "int"), this._wfIsFirstChunk = V(1, "uint"), this._pathBudget = 0, this._pathBudgetOverride = 0, this._chunkRows = 0, this._numChunks = 1, this.vramTracker = new uu(this.renderer), this._registerVRAMProviders(), ef.debug("initialized (wavefront)");
|
|
10750
10750
|
}
|
|
10751
10751
|
_registerVRAMProviders() {
|
|
10752
10752
|
let e = this.vramTracker;
|
|
@@ -10798,58 +10798,61 @@ var ef = ai("wavefront"), tf = 256, nf = [
|
|
|
10798
10798
|
}
|
|
10799
10799
|
render(e) {
|
|
10800
10800
|
if (!this.isReady || !this._wavefrontReady || this._lightBufferRealloc && (this._kernelManager && this._kernelManager.dispose(), this._wavefrontReady = !1, this._buildWavefrontKernels(), !this._wavefrontReady)) return;
|
|
10801
|
-
if (this.isComplete || this.frameCount >= this.completionThreshold || this._isConvergedComplete())
|
|
10801
|
+
if (this.isComplete || this.frameCount >= this.completionThreshold || this._isConvergedComplete()) if (this._auxSeedPending) this.isComplete = !1;
|
|
10802
|
+
else {
|
|
10802
10803
|
this.isComplete ||= !0;
|
|
10803
10804
|
return;
|
|
10804
10805
|
}
|
|
10805
10806
|
this.performanceMonitor?.start();
|
|
10806
10807
|
let t = this.frameCount, n = this.renderMode.value, r = null;
|
|
10807
|
-
n === 1 && t === 0 && (r = this.maxBounces.value, this.maxBounces.value = 1), this._handleResize(), this.manageASVGFForRenderMode(n), e && e.setState("tileRenderingComplete", !0), this.cameraChanged = this._updateCameraUniforms(), this.cameraOptimizer?.updateInteractionMode(this.cameraChanged), this.cameraChanged && (this._curveSizingValid = !1, this._readbackGeneration++, this._convergedFraction = 0, this._convergedGeometryFraction = 0, this._lastActivePixelCount = 0), this._updateAccumulationUniforms(t, n)
|
|
10808
|
-
let i = this.
|
|
10809
|
-
this.
|
|
10810
|
-
let a = this.
|
|
10808
|
+
n === 1 && t === 0 && (r = this.maxBounces.value, this.maxBounces.value = 1), this._handleResize(), this.manageASVGFForRenderMode(n), e && e.setState("tileRenderingComplete", !0), this.cameraChanged = this._updateCameraUniforms(), this.cameraOptimizer?.updateInteractionMode(this.cameraChanged), this.cameraChanged && (this._curveSizingValid = !1, this._readbackGeneration++, this._convergedFraction = 0, this._convergedGeometryFraction = 0, this._lastActivePixelCount = 0), this._updateAccumulationUniforms(t, n);
|
|
10809
|
+
let i = this._updateAuxAccumulationUniforms(t);
|
|
10810
|
+
this.frame.value = t, this.seedFrame.value = this._seedTick++, this._setWfDispatch();
|
|
10811
|
+
let a = this.storageTextures.getReadTextures();
|
|
10812
|
+
this.shaderBuilder.prevColorTexNode && (this.shaderBuilder.prevColorTexNode.value = a.color, this.shaderBuilder.prevAlbedoTexNode.value = a.albedo, this.shaderBuilder.prevNormalDepthTexNode.value = a.normalDepth), this._refreshWfTextureNodes();
|
|
10813
|
+
let o = this._kernelManager;
|
|
10811
10814
|
if ((this.visMode?.value | 0) > 0 && this.visMode.value !== 11) {
|
|
10812
|
-
|
|
10815
|
+
o.dispatch("debug"), this.storageTextures.copyToReadTargets(this.renderer);
|
|
10813
10816
|
let t = this.storageTextures.getReadTextures();
|
|
10814
10817
|
e && this._publishTexturesToContext(e, t), this._emitStateEvents(), this.cameraOptimizer?.isInInteractionMode() || this.frameCount++, r !== null && (this.maxBounces.value = r), this.performanceMonitor?.end();
|
|
10815
10818
|
return;
|
|
10816
10819
|
}
|
|
10817
|
-
let
|
|
10818
|
-
for (let e = 0, n = 0; n <
|
|
10819
|
-
let r = Math.min(
|
|
10820
|
-
if (
|
|
10821
|
-
let e = Math.min(i, Math.ceil(
|
|
10822
|
-
|
|
10823
|
-
} else
|
|
10824
|
-
e === 0 && t > 0 && this.useAdaptiveSampling.value > 0 && this._willReadCountersThisFrame() &&
|
|
10825
|
-
for (let e = 0; e <=
|
|
10820
|
+
let s = this.maxBounces.value, c = s + this.transmissiveBounces.value + this.maxSubsurfaceSteps.value, l = this._wfRenderHeight.value, u = this._chunkRows, d = this._numChunks <= 1, f = this._lastBounceCounts, p = d && f ? s <= this._lastBounceCountsBudget ? c + 1 : this._lastBounceCountsBudget : 0;
|
|
10821
|
+
for (let e = 0, n = 0; n < l; n += u, e++) {
|
|
10822
|
+
let r = Math.min(u, l - n), i = this._setChunk(n, r, e), a = this.usePixelFreeze.value > 0 && !this._auxSeedPending, s = d && a && this._curveSizingValid && this._lastActivePixelCount > 0 ? this._lastActivePixelCount : i;
|
|
10823
|
+
if (a) {
|
|
10824
|
+
let e = Math.min(i, Math.ceil(s * 1.5) + 1024);
|
|
10825
|
+
o.setDispatchForCount("generateList", e), o.dispatch("resetFrameCounters"), o.dispatch("buildActivePixels"), o.dispatch("seedEnter"), o.dispatch("generateList");
|
|
10826
|
+
} else o.dispatch("generate"), o.dispatch("initActiveIndices");
|
|
10827
|
+
e === 0 && t > 0 && this.useAdaptiveSampling.value > 0 && this._willReadCountersThisFrame() && o.dispatch("countConvergedDilated");
|
|
10828
|
+
for (let e = 0; e <= c; e++) {
|
|
10826
10829
|
this._wfCurrentBounce.value = e;
|
|
10827
10830
|
let t = this._useDynamicDispatch;
|
|
10828
10831
|
if (t) {
|
|
10829
10832
|
let t = i;
|
|
10830
|
-
if (
|
|
10833
|
+
if (d && e > 0 && this._curveSizingValid) {
|
|
10831
10834
|
let n = e - 1, r;
|
|
10832
|
-
n <
|
|
10833
|
-
} else e === 0 &&
|
|
10835
|
+
n < p && f[n] !== void 0 ? r = f[n] : p > 0 && (r = f[p - 1]), t = r > 0 ? r : i;
|
|
10836
|
+
} else e === 0 && a && (t = s);
|
|
10834
10837
|
let n = Math.min(i, Math.ceil(t * 1.5) + 1024);
|
|
10835
|
-
for (let e of nf)
|
|
10838
|
+
for (let e of nf) o.setDispatchForCount(e, n);
|
|
10836
10839
|
} else {
|
|
10837
|
-
|
|
10838
|
-
for (let e of nf)
|
|
10840
|
+
o.dispatch("enterFull");
|
|
10841
|
+
for (let e of nf) o.setDispatchForCount(e, i);
|
|
10839
10842
|
}
|
|
10840
|
-
if (
|
|
10843
|
+
if (o.dispatch("extend"), this._sortMaterials && (o.dispatch("resetGlobalHist"), o.dispatch("globalHist"), o.dispatch("globalPrefix"), o.dispatch("globalScatter")), o.dispatch("shade"), o.dispatch("compact"), t ? o.dispatch("compactCopyback") : o.dispatch("snapshotBounceCount"), e < p && e < c && f[e] !== void 0 && f[e] <= this._bounceEarlyExitThreshold) break;
|
|
10841
10844
|
}
|
|
10842
|
-
|
|
10845
|
+
o.dispatch("finalWrite");
|
|
10843
10846
|
}
|
|
10844
10847
|
this._maybeReadbackCounters(), this.storageTextures.copyToReadTargets(this.renderer, this._auxGBufferEnabled);
|
|
10845
|
-
let
|
|
10846
|
-
e && this._publishTexturesToContext(e,
|
|
10848
|
+
let m = this.storageTextures.getReadTextures();
|
|
10849
|
+
e && this._publishTexturesToContext(e, m), this._emitStateEvents(), this.cameraOptimizer?.isInInteractionMode() || this.frameCount++, this._auxGBufferEnabled && (this._auxSamples = i ? this._auxSamples + 1 : 1), this._auxSeedPending = !1, r !== null && (this.maxBounces.value = r), this.performanceMonitor?.end();
|
|
10847
10850
|
}
|
|
10848
10851
|
_isConvergedComplete() {
|
|
10849
10852
|
return this.useAdaptiveSampling.value > 0 && this.frameCount >= this.adaptiveMinSamples.value && this._convergedFraction >= this.adaptiveStopFraction.value && this._convergedGeometryFraction >= this.adaptiveStopFraction.value;
|
|
10850
10853
|
}
|
|
10851
10854
|
reset() {
|
|
10852
|
-
super.reset(), this._convergedFraction = 0, this._convergedGeometryFraction = 0, this._lastActivePixelCount = 0;
|
|
10855
|
+
super.reset(), this._convergedFraction = 0, this._convergedGeometryFraction = 0, this._lastActivePixelCount = 0, this._auxSamples = 0, this._auxSeedPending = !1;
|
|
10853
10856
|
}
|
|
10854
10857
|
getConvergenceDebugSource() {
|
|
10855
10858
|
return !this._m2Attr || !this._frozenMaskAttr ? null : (this._convDebugSource?.m2 === this._m2Attr && this._convDebugSource.frozenMask === this._frozenMaskAttr || (this._convDebugSource = {
|
|
@@ -10880,10 +10883,17 @@ var ef = ai("wavefront"), tf = 256, nf = [
|
|
|
10880
10883
|
super._handleResize(), this._rebuildKernelsIfResized(e, t);
|
|
10881
10884
|
}
|
|
10882
10885
|
setAuxGBufferEnabled(e) {
|
|
10883
|
-
e = !!e, this._auxGBufferEnabled !== e && (this._auxGBufferEnabled = e, this._auxGBufferUniform.value = +!!e, this.
|
|
10886
|
+
e = !!e, this._auxGBufferEnabled !== e && (this._auxGBufferEnabled = e, this._auxGBufferUniform.value = +!!e, this.restartAuxAccumulation());
|
|
10884
10887
|
}
|
|
10885
10888
|
setCleanAuxNormal(e) {
|
|
10886
|
-
e = !!e, this._cleanAuxNormalEnabled !== e && (this._cleanAuxNormalEnabled = e, this._cleanAuxNormalUniform.value = +!!e, this.
|
|
10889
|
+
e = !!e, this._cleanAuxNormalEnabled !== e && (this._cleanAuxNormalEnabled = e, this._cleanAuxNormalUniform.value = +!!e, this.restartAuxAccumulation());
|
|
10890
|
+
}
|
|
10891
|
+
restartAuxAccumulation() {
|
|
10892
|
+
this._auxSamples = 0, this._auxSeedPending = this._auxGBufferEnabled;
|
|
10893
|
+
}
|
|
10894
|
+
_updateAuxAccumulationUniforms(e) {
|
|
10895
|
+
let t = this.accumulationEnabled && !this.cameraIsMoving.value && e > 0 && this.hasPreviousAccumulated.value > 0 && this.visMode.value !== 11, n = this._auxGBufferEnabled && t && !this._auxSeedPending && this._auxSamples > 0;
|
|
10896
|
+
return this.hasPreviousAux.value = +!!n, this.auxAccumulationAlpha.value = n ? 1 / (this._auxSamples + 1) : 1, n;
|
|
10887
10897
|
}
|
|
10888
10898
|
setSize(e, t) {
|
|
10889
10899
|
let n = this.storageTextures.renderWidth, r = this.storageTextures.renderHeight;
|
|
@@ -11374,6 +11384,8 @@ var ef = ai("wavefront"), tf = 256, nf = [
|
|
|
11374
11384
|
enableAccumulation: this.enableAccumulation,
|
|
11375
11385
|
hasPreviousAccumulated: this.hasPreviousAccumulated,
|
|
11376
11386
|
accumulationAlpha: this.accumulationAlpha,
|
|
11387
|
+
hasPreviousAux: this.hasPreviousAux,
|
|
11388
|
+
auxAccumulationAlpha: this.auxAccumulationAlpha,
|
|
11377
11389
|
cameraIsMoving: this.cameraIsMoving,
|
|
11378
11390
|
transparentBackground: this.transparentBackground,
|
|
11379
11391
|
prevAccumTexture: b,
|
|
@@ -16888,7 +16900,7 @@ var _m = {
|
|
|
16888
16900
|
}
|
|
16889
16901
|
}, ym = class extends lt {
|
|
16890
16902
|
constructor({ renderer: e, mainCanvas: t, scene: n, camera: r, stages: i, pipeline: a, getExposure: o, getSaturation: s, getTransparentBg: c }) {
|
|
16891
|
-
super(), this.renderer = e, this.mainCanvas = t, this.denoiserCanvas = this._createDenoiserCanvas(t), this.scene = n, this.camera = r, this.pipeline = a, this._stages = i, this._getExposure = o, this._getSaturation = s, this._getTransparentBg = c, this.denoiser = null, this.upscaler = null, this._lastRenderWidth = 0, this._lastRenderHeight = 0, this._pendingStartUpscaler = null, this._denoiserStartHandler = null, this._denoiserEndHandler = null, this._upscalerResChangedHandler = null, this._upscalerStartHandler = null, this._upscalerProgressHandler = null, this._upscalerEndHandler = null;
|
|
16903
|
+
super(), this.renderer = e, this.mainCanvas = t, this.denoiserCanvas = this._createDenoiserCanvas(t), this.scene = n, this.camera = r, this.pipeline = a, this._stages = i, this._getExposure = o, this._getSaturation = s, this._getTransparentBg = c, this.denoiser = null, this.upscaler = null, this._onReset = null, this._onPostProcessRefresh = null, this._lastRenderWidth = 0, this._lastRenderHeight = 0, this._pendingStartUpscaler = null, this._denoiserStartHandler = null, this._denoiserEndHandler = null, this._upscalerResChangedHandler = null, this._upscalerStartHandler = null, this._upscalerProgressHandler = null, this._upscalerEndHandler = null;
|
|
16892
16904
|
}
|
|
16893
16905
|
_createDenoiserCanvas(e) {
|
|
16894
16906
|
let t = e.parentNode;
|
|
@@ -17013,6 +17025,9 @@ var _m = {
|
|
|
17013
17025
|
setResetCallback(e) {
|
|
17014
17026
|
this._onReset = e;
|
|
17015
17027
|
}
|
|
17028
|
+
setPostProcessRefreshCallback(e) {
|
|
17029
|
+
this._onPostProcessRefresh = e;
|
|
17030
|
+
}
|
|
17016
17031
|
setSettings(e) {
|
|
17017
17032
|
this._settings = e;
|
|
17018
17033
|
}
|
|
@@ -17032,10 +17047,10 @@ var _m = {
|
|
|
17032
17047
|
this._stages.autoExposure?.updateParameters(e);
|
|
17033
17048
|
}
|
|
17034
17049
|
setOIDNEnabled(e) {
|
|
17035
|
-
this.denoiser && (this.denoiser.enabled = e), this._syncGBufferStages();
|
|
17050
|
+
this.denoiser && (this.denoiser.enabled = e), this._syncGBufferStages(), this._onPostProcessRefresh?.();
|
|
17036
17051
|
}
|
|
17037
17052
|
setOIDNQuality(e) {
|
|
17038
|
-
this.denoiser?.updateQuality(e), this._stages.pathTracer?.setCleanAuxNormal?.(!!this.denoiser?.enabled && e !== "fast");
|
|
17053
|
+
this.denoiser?.updateQuality(e), this._stages.pathTracer?.setCleanAuxNormal?.(!!this.denoiser?.enabled && e !== "fast"), this._onPostProcessRefresh?.();
|
|
17039
17054
|
}
|
|
17040
17055
|
setTileHelperEnabled(e) {
|
|
17041
17056
|
this._setTileHelper(e);
|
|
@@ -17629,15 +17644,7 @@ var wm = 4096, Tm = class {
|
|
|
17629
17644
|
this._paused = !1, this.animationManagerId || this.animate();
|
|
17630
17645
|
}
|
|
17631
17646
|
reset(e = !1) {
|
|
17632
|
-
|
|
17633
|
-
let e = this.denoisingManager._lastRenderWidth, t = this.denoisingManager._lastRenderHeight;
|
|
17634
|
-
this.dispatchEvent({
|
|
17635
|
-
type: "resolution_changed",
|
|
17636
|
-
width: e,
|
|
17637
|
-
height: t
|
|
17638
|
-
});
|
|
17639
|
-
}
|
|
17640
|
-
this.completion.reset(), this.wake(), this.dispatchEvent({ type: "RenderReset" }), this.dispatchEvent({ type: ur.RENDER_RESET });
|
|
17647
|
+
this.pipeline && (this.pipeline.reset(), e || this.pipeline.eventBus.emit("asvgf:reset")), this._abortPostProcess(), this.completion.reset(), this.wake(), this.dispatchEvent({ type: "RenderReset" }), this.dispatchEvent({ type: ur.RENDER_RESET });
|
|
17641
17648
|
}
|
|
17642
17649
|
dispose() {
|
|
17643
17650
|
if (!this._disposed) {
|
|
@@ -17934,6 +17941,19 @@ var wm = 4096, Tm = class {
|
|
|
17934
17941
|
refreshFrame() {
|
|
17935
17942
|
this._needsDisplayRefresh = !0, this.wake();
|
|
17936
17943
|
}
|
|
17944
|
+
_abortPostProcess() {
|
|
17945
|
+
if (this.denoisingManager?.abort(this.canvas), this.denoisingManager?.restoreBaseResolution()) {
|
|
17946
|
+
let e = this.denoisingManager._lastRenderWidth, t = this.denoisingManager._lastRenderHeight;
|
|
17947
|
+
this.dispatchEvent({
|
|
17948
|
+
type: "resolution_changed",
|
|
17949
|
+
width: e,
|
|
17950
|
+
height: t
|
|
17951
|
+
});
|
|
17952
|
+
}
|
|
17953
|
+
}
|
|
17954
|
+
requestPostProcessRefresh() {
|
|
17955
|
+
!this.stages.pathTracer?.isReady || this._deviceLost || (this._abortPostProcess(), this.completion.renderCompleteDispatched = !1, this.wake());
|
|
17956
|
+
}
|
|
17937
17957
|
setDeterministicMode(e = !0, { pinDispatch: t = !0 } = {}) {
|
|
17938
17958
|
let n = this.stages.pathTracer;
|
|
17939
17959
|
if (!n) return !1;
|
|
@@ -18201,7 +18221,7 @@ var wm = 4096, Tm = class {
|
|
|
18201
18221
|
appDispatch: (e) => this.dispatchEvent(e),
|
|
18202
18222
|
orbitControls: this.cameraManager.controls,
|
|
18203
18223
|
helperScene: this._sceneHelpers.scene
|
|
18204
|
-
}), this.denoisingManager.setOverlayManager(this.overlayManager), this.denoisingManager.setResetCallback(() => this.reset()), this.denoisingManager.setSettings(this.settings), this.environmentManager = this.stages.pathTracer.environment, this.environmentManager.callbacks.onAutoExposureReset = () => this.pipeline.eventBus.emit("autoexposure:resetHistory");
|
|
18224
|
+
}), this.denoisingManager.setOverlayManager(this.overlayManager), this.denoisingManager.setResetCallback(() => this.reset()), this.denoisingManager.setPostProcessRefreshCallback(() => this.requestPostProcessRefresh()), this.denoisingManager.setSettings(this.settings), this.environmentManager = this.stages.pathTracer.environment, this.environmentManager.callbacks.onAutoExposureReset = () => this.pipeline.eventBus.emit("autoexposure:resetHistory");
|
|
18205
18225
|
}
|
|
18206
18226
|
_wireEvents() {
|
|
18207
18227
|
this._addTrackedListener(this.cameraManager, "CameraSwitched", (e) => this.dispatchEvent(e)), this._addTrackedListener(this.cameraManager, ur.AUTO_FOCUS_UPDATED, (e) => this.dispatchEvent(e)), this._forwardEvents(this.denoisingManager, [
|