rayzee 11.2.0 → 11.3.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 +62 -33
- package/dist/ArchiveImporter-D735xX-4.js +7860 -0
- package/dist/BidirectionalIntegrator-M89c0AlP.js +954 -0
- package/dist/{BufferLayout-D_IBo2ci.js → BufferLayout-xPRH9jYD.js} +41 -5
- package/dist/{NeuralRetouch-DFGbnmLb.js → NeuralRetouch-DiBH63kz.js} +1 -1
- package/dist/{NeuralSuperRes-BtXvyJQl.js → NeuralSuperRes-CZNQP13W.js} +1 -1
- package/dist/{PathTracer-BHXGJtPN.js → PathTracer-BXCCVrPK.js} +4371 -4612
- package/dist/{PhysicalSky-DN6u8UX4.js → PhysicalSky-DqmaS0lb.js} +2 -2
- package/dist/{RayzeeRenderer-Dw1x8mVL.js → RayzeeRenderer-DUSMFhmc.js} +426 -363
- package/dist/SolarLimb-bZE6y63S.js +762 -0
- package/dist/addons/archives.es.js +1 -1
- package/dist/addons/bidirectional.es.js +1 -1
- package/dist/addons/physical-sky.es.js +1 -1
- package/dist/rayzee-core.es.js +7 -7
- package/dist/rayzee.es.js +472 -468
- package/dist/rayzee.umd.js +106 -105
- package/dist/sceneCachePolicy-BAib5fCp.js +1602 -0
- package/package.json +1 -1
- package/src/EngineDefaults.js +1 -1
- package/src/PathTracerApp.js +4 -3
- package/src/Processor/ArchiveImporter.js +173 -94
- package/src/Processor/ArchiveReader.js +20 -23
- package/src/Processor/AssetLoader.js +48 -1
- package/src/Processor/BVHRefitter.js +109 -13
- package/src/Processor/BufferLayout.js +115 -0
- package/src/Processor/ChunkedRecords.js +3 -2
- package/src/Processor/EmissiveTriangleBuilder.js +6 -6
- package/src/Processor/GeometryExtractor.js +189 -79
- package/src/Processor/HostMemory.js +39 -9
- package/src/Processor/InstanceTable.js +714 -42
- package/src/Processor/PBRT/PBRTCurves.js +224 -6
- package/src/Processor/PBRT/PBRTMaterials.js +3 -0
- package/src/Processor/PBRT/PBRTSceneBuilder.js +82 -25
- package/src/Processor/PackedRayBuffer.js +5 -2
- package/src/Processor/SceneProcessor.js +747 -141
- package/src/Processor/TLASBuilder.js +32 -17
- package/src/Processor/USD/USDLayer.js +1149 -0
- package/src/Processor/USD/USDScene.js +1655 -0
- package/src/Processor/USD/USDStage.js +682 -0
- package/src/Processor/USD/USDText.js +674 -0
- package/src/Processor/USD/index.js +138 -0
- package/src/Processor/Workers/BVHRefitWorker.js +3 -3
- package/src/RayzeeRenderer.js +168 -27
- package/src/Stages/NormalDepth.js +7 -12
- package/src/Stages/PathTracer.js +12 -17
- package/src/Stages/PathTracerStage.js +273 -96
- package/src/Storage/GeometrySpill.js +46 -14
- package/src/Storage/SceneGraphCodec.js +17 -3
- package/src/Storage/SpillStore.js +9 -0
- package/src/TSL/BVHTraversal.js +183 -7
- package/src/TSL/Common.js +57 -13
- package/src/TSL/ShadeKernel.js +3 -2
- package/src/TSL/TextureSampling.js +11 -8
- package/src/TSL/patches.js +84 -0
- package/src/integrators/BidirectionalIntegrator.js +20 -2
- package/src/managers/DenoisingManager.js +4 -4
- package/src/managers/InteractionManager.js +19 -6
- package/src/managers/MaterialDataManager.js +22 -5
- package/src/managers/UniformManager.js +3 -0
- package/dist/ArchiveImporter-eNlu0_6F.js +0 -5198
- package/dist/BidirectionalIntegrator-D1-6UySB.js +0 -946
- package/dist/SolarLimb-CPaeZVwz.js +0 -721
- package/dist/sceneCachePolicy-DA7iGoL4.js +0 -485
package/dist/rayzee.es.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { t as e } from "./BidirectionalIntegrator-
|
|
2
|
-
import { $t as t, Ft as n,
|
|
3
|
-
import { _ as u, a as d, c as f, d as p, f as m, g as h, h as g, i as _, l as v, m as y, n as b, o as x, p as S, r as ee, s as C, t as te, u as w } from "./RayzeeRenderer-
|
|
4
|
-
import { $ as ne, B as re,
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import { i as
|
|
8
|
-
import {
|
|
9
|
-
import { i as
|
|
10
|
-
import { i as
|
|
11
|
-
import { i as
|
|
12
|
-
import { n as
|
|
13
|
-
import { a as
|
|
14
|
-
import { a as
|
|
15
|
-
import { a as
|
|
16
|
-
import { t as
|
|
17
|
-
import { t as
|
|
18
|
-
import { A as
|
|
19
|
-
import { c as
|
|
20
|
-
import { n as
|
|
21
|
-
import { i as
|
|
22
|
-
import { i as
|
|
23
|
-
import { ExternalTexture as
|
|
24
|
-
import { Fn as
|
|
1
|
+
import { t as e } from "./BidirectionalIntegrator-M89c0AlP.js";
|
|
2
|
+
import { $t as t, Ft as n, Pt as r, Yt as i, en as a, jt as o, nn as s, rt as c, wt as l } from "./SolarLimb-bZE6y63S.js";
|
|
3
|
+
import { _ as u, a as d, c as f, d as p, f as m, g as h, h as g, i as _, l as v, m as y, n as b, o as x, p as S, r as ee, s as C, t as te, u as w } from "./RayzeeRenderer-DUSMFhmc.js";
|
|
4
|
+
import { $ as ne, B as re, Et as T, H as ie, K as ae, L as oe, N as se, Ot as E, P as D, Q as ce, R as O, Tt as k, X as le, Z as ue, _t as de, dt as A, et as fe, ft as pe, gt as me, ht as he, kt as ge, lt as _e, nt as ve, pt as ye, tt as be, ut as xe, wt as Se, z as Ce } from "./PathTracer-BXCCVrPK.js";
|
|
5
|
+
import { n as we, t as j } from "./EngineEvents-Ci8dVWCP.js";
|
|
6
|
+
import { D as Te, G as Ee, J as De, K as Oe, O as ke, W as Ae, Y as je, a as Me, c as Ne, et as Pe, i as Fe, m as Ie, ot as Le, p as Re, q as ze, r as Be, tt as Ve, x as He, y as Ue } from "./sceneCachePolicy-BAib5fCp.js";
|
|
7
|
+
import { i as We, n as Ge, r as Ke, t as qe } from "./Logger-dDDGj9Av.js";
|
|
8
|
+
import { f as Je, r as Ye } from "./BufferLayout-xPRH9jYD.js";
|
|
9
|
+
import { i as Xe, n as Ze, r as Qe, t as $e } from "./EngineIssues-CIZnXHsF.js";
|
|
10
|
+
import { i as et, r as tt } from "./shared-BGBcSxBQ.js";
|
|
11
|
+
import { i as nt, r as rt, t as it } from "./ActiveColor-YvuQq44O.js";
|
|
12
|
+
import { n as at, t as ot } from "./AssetConfig-DSEntE65.js";
|
|
13
|
+
import { a as st, d as ct, g as lt, i as ut, l as dt, o as ft, p as pt, r as mt, s as ht, t as gt, u as _t } from "./ViewTransforms-CYN7bq2w.js";
|
|
14
|
+
import { a as vt, i as yt, n as bt, r as xt } from "./identity-C1cLD1C0.js";
|
|
15
|
+
import { a as St, n as Ct, r as wt, t as Tt } from "./SceneMetadata-D2Sh-0e-.js";
|
|
16
|
+
import { t as Et } from "./ToneMapGPU-BOjpul7A.js";
|
|
17
|
+
import { t as Dt } from "./FileFormats-sPGJeCRc.js";
|
|
18
|
+
import { A as Ot, C as kt, D as At, E as jt, O as Mt, S as Nt, T as Pt, _ as Ft, a as It, b as Lt, c as Rt, d as zt, f as Bt, g as Vt, h as Ht, i as Ut, k as Wt, l as Gt, m as Kt, n as qt, o as Jt, p as Yt, r as Xt, s as Zt, t as Qt, u as $t, v as en, w as tn, x as nn, y as rn } from "./ColorManagement-oeEk7oSu.js";
|
|
19
|
+
import { c as an, l as on, n as sn, o as cn, t as ln } from "./openStorage-Fe9BoS1_.js";
|
|
20
|
+
import { n as un, t as dn } from "./ZipReader-gDSWr0I5.js";
|
|
21
|
+
import { i as fn, n as pn, r as mn } from "./NeuralSuperRes-CZNQP13W.js";
|
|
22
|
+
import { i as hn, n as gn, r as _n } from "./NeuralRetouch-DiBH63kz.js";
|
|
23
|
+
import { ExternalTexture as vn, MeshBasicNodeMaterial as yn, QuadMesh as bn, ReadbackBuffer as xn, RenderTarget as Sn, StorageTexture as M, TextureNode as N, WebGPURenderer as Cn } from "three/webgpu";
|
|
24
|
+
import { Fn as wn, If as P, Loop as Tn, Return as En, abs as Dn, atan as On, atomicAdd as kn, atomicLoad as An, atomicStore as jn, attributeArray as Mn, dot as Nn, exp as Pn, exp2 as Fn, float as F, floor as In, fract as Ln, int as I, ivec2 as L, localId as R, max as z, min as Rn, mix as B, normalize as zn, pow as Bn, round as Vn, saturate as V, select as H, smoothstep as Hn, sqrt as Un, storage as Wn, textureLoad as U, textureStore as W, uint as G, uniform as K, uvec2 as Gn, uvec4 as Kn, vec2 as qn, vec3 as q, vec4 as J, wgslFn as Jn, workgroupArray as Yn, workgroupBarrier as Xn, workgroupId as Y } from "three/tsl";
|
|
25
25
|
import { ACESFilmicToneMapping as Zn, AddEquation as Qn, AnimationMixer as $n, Box2 as er, Box3 as tr, ClampToEdgeWrapping as nr, Color as rr, Controls as ir, CustomBlending as ar, DataArrayTexture as or, DataTexture as sr, EventDispatcher as cr, FloatType as lr, HalfFloatType as ur, InterpolateSmooth as dr, LinearFilter as X, LoopOnce as fr, LoopRepeat as pr, MathUtils as mr, Matrix4 as hr, Mesh as gr, MeshBasicMaterial as _r, NearestFilter as Z, NoColorSpace as vr, NumberKeyframeTrack as yr, OneFactor as br, OrthographicCamera as xr, PerspectiveCamera as Sr, PropertyBinding as Cr, Quaternion as wr, RGBAFormat as Q, Raycaster as Tr, RedIntegerFormat as Er, SRGBColorSpace as Dr, Scene as Or, SphereGeometry as kr, Timer as Ar, UnsignedByteType as jr, UnsignedIntType as Mr, Vector2 as Nr, Vector3 as $, Vector4 as Pr, VectorKeyframeTrack as Fr } from "three";
|
|
26
26
|
import { OrbitControls as Ir } from "three/addons/controls/OrbitControls.js";
|
|
27
27
|
import { outline as Lr } from "three/addons/tsl/display/OutlineNode.js";
|
|
@@ -150,14 +150,14 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
150
150
|
showAsvgfHeatmap: !1,
|
|
151
151
|
nrdQualityPreset: "medium",
|
|
152
152
|
nrdDebugMode: 0
|
|
153
|
-
}, Xr = class extends
|
|
153
|
+
}, Xr = class extends E {
|
|
154
154
|
constructor(e, t = {}) {
|
|
155
155
|
super("NormalDepth", {
|
|
156
156
|
...t,
|
|
157
|
-
executionMode:
|
|
158
|
-
}), this.renderer = e, this.pathTracer = t.pathTracer, this._dirty = !0, this.cameraWorldMatrix =
|
|
157
|
+
executionMode: ge.ALWAYS
|
|
158
|
+
}), this.renderer = e, this.pathTracer = t.pathTracer, this._dirty = !0, this.cameraWorldMatrix = K(new hr(), "mat4"), this.cameraProjectionMatrixInverse = K(new hr(), "mat4"), this.cameraRay = ce(), this.resolutionWidth = K(t.width || 1), this.resolutionHeight = K(t.height || 1);
|
|
159
159
|
let n = t.width || 1, r = t.height || 1;
|
|
160
|
-
this._outputStorageTex = new
|
|
160
|
+
this._outputStorageTex = new M(k, k), this._outputStorageTex.type = ur, this._outputStorageTex.format = Q, this._outputStorageTex.minFilter = Z, this._outputStorageTex.magFilter = Z, this._shadingStorageTex = new M(k, k), this._shadingStorageTex.type = ur, this._shadingStorageTex.format = Q, this._shadingStorageTex.minFilter = Z, this._shadingStorageTex.magFilter = Z, this._shadingRT = new Sn(n, r, {
|
|
161
161
|
type: ur,
|
|
162
162
|
format: Q,
|
|
163
163
|
minFilter: Z,
|
|
@@ -173,7 +173,7 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
173
173
|
depthBuffer: !1,
|
|
174
174
|
stencilBuffer: !1
|
|
175
175
|
};
|
|
176
|
-
this._rtA = new
|
|
176
|
+
this._rtA = new Sn(n, r, i), this._rtB = new Sn(n, r, i), this._currentIdx = 0, this._hasHistory = !1, this._dispatchX = Math.ceil(n / 8), this._dispatchY = Math.ceil(r / 8), this._triStorageNode = null, this._bvhStorageNode = null, this._matStorageNode = null, this._lastTriAttr = null, this._lastBvhAttr = null, this._lastMatAttr = null, this._computeNode = null, this._computeBuilt = !1, this._linearBuckets = null;
|
|
177
177
|
}
|
|
178
178
|
setupEventListeners() {
|
|
179
179
|
this.on("camera:moved", () => {
|
|
@@ -186,40 +186,41 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
186
186
|
let e = this.pathTracer;
|
|
187
187
|
if (!e) return !1;
|
|
188
188
|
let t = e.materialData?.materialStorageAttr, n = e.triangleGeoAttr && e.triangleGeoAttr !== this._lastTriAttr, r = e.bvhStorageAttr && e.bvhStorageAttr !== this._lastBvhAttr, i = t && t !== this._lastMatAttr;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
189
|
+
if ((n || r || i) && (this._computeNode?.dispose?.(), this._computeNode = null, this._computeBuilt = !1, this._triStorageNode = null, this._bvhStorageNode = null, this._matStorageNode = null, this._dirty = !0, this._hasHistory = !1), !this._triStorageNode || !this._bvhStorageNode) {
|
|
190
|
+
let t = e.sceneStorageNodes?.();
|
|
191
|
+
t && (this._triStorageNode = t.triangles, this._bvhStorageNode = t.bvh);
|
|
192
|
+
}
|
|
193
|
+
return t && !this._matStorageNode && (this._matStorageNode = Wn(t, "vec4", t.count).toReadOnly()), this._linearBuckets && re(this._linearBuckets, e.materialData?.linearBuckets), this._lastTriAttr = e.triangleGeoAttr || this._lastTriAttr, this._lastBvhAttr = e.bvhStorageAttr || this._lastBvhAttr, this._lastMatAttr = t || this._lastMatAttr, !!(this._triStorageNode && this._bvhStorageNode && this._matStorageNode);
|
|
193
194
|
}
|
|
194
195
|
_buildCompute() {
|
|
195
|
-
let e = this._triStorageNode, n = this._bvhStorageNode,
|
|
196
|
-
this._linearBuckets =
|
|
196
|
+
let e = this._triStorageNode, n = this._bvhStorageNode, r = this._matStorageNode;
|
|
197
|
+
this._linearBuckets = se(this.pathTracer?.materialData?.linearBuckets);
|
|
197
198
|
let o = {
|
|
198
|
-
srgbBuckets:
|
|
199
|
+
srgbBuckets: se(null),
|
|
199
200
|
linearBuckets: this._linearBuckets,
|
|
200
201
|
shadowAlbedoMaps: null,
|
|
201
202
|
goboMaps: null,
|
|
202
203
|
iesProfiles: null,
|
|
203
204
|
alphaShadows: null
|
|
204
|
-
},
|
|
205
|
-
this._computeNode =
|
|
206
|
-
let u =
|
|
207
|
-
|
|
208
|
-
let _ =
|
|
209
|
-
|
|
210
|
-
let S = v.normal.toVar(), ee =
|
|
211
|
-
|
|
212
|
-
let
|
|
213
|
-
|
|
214
|
-
o.assign(
|
|
205
|
+
}, c = this.cameraWorldMatrix, u = this.cameraProjectionMatrixInverse, d = this.resolutionWidth, f = this.resolutionHeight, p = this._outputStorageTex, m = this._shadingStorageTex, h = this._leafStorageTex;
|
|
206
|
+
this._computeNode = he(wn(([o, c]) => {
|
|
207
|
+
let u = I(Y.x).mul(8).add(I(R.x)), g = I(Y.y).mul(8).add(I(R.y));
|
|
208
|
+
P(u.lessThan(I(d)).and(g.lessThan(I(f))), () => {
|
|
209
|
+
let _ = t(le(qn(F(u).add(.5).div(d), F(g).add(.5).div(f)), o, c, this.cameraRay)), v = i.wrap(ae(_, n, e)), y = v.normal.mul(.5).add(.5), b = Rn(v.dst, F(65504)), x = v.didHit.select(J(y, b), J(0, 0, 0, F(zr)));
|
|
210
|
+
W(p, Gn(G(u), G(g)), x).toWriteOnly(), h && W(h, Gn(G(u), G(g)), Kn(G(v.instanceLeaf.add(1)), 0, 0, 0)).toWriteOnly();
|
|
211
|
+
let S = v.normal.toVar(), ee = F(1).toVar();
|
|
212
|
+
P(v.didHit, () => {
|
|
213
|
+
let t = a.wrap(l(v.materialIndex, r)).toVar(), i = s.wrap(D(v.uv, t)).toVar(), o = J(0).toVar();
|
|
214
|
+
P(t.normalMapIndex.greaterThanEqual(I(0)), () => {
|
|
215
|
+
o.assign(ie(e, v.triangleIndex, v.normal, t.normalTransform, n, v.instanceLeaf));
|
|
215
216
|
});
|
|
216
|
-
let
|
|
217
|
-
S.assign(
|
|
217
|
+
let c = Ce(v.normal, t, i, o).toVar();
|
|
218
|
+
S.assign(oe(c, t, i)), ee.assign(O(t, i).y.clamp(.05, 1));
|
|
218
219
|
});
|
|
219
220
|
let C = v.didHit.select(J(S.mul(.5).add(.5), ee), J(0, 0, 0, 1));
|
|
220
|
-
|
|
221
|
+
W(m, Gn(G(u), G(g)), C).toWriteOnly();
|
|
221
222
|
});
|
|
222
|
-
})(
|
|
223
|
+
})(c, u), o).compute([
|
|
223
224
|
this._dispatchX,
|
|
224
225
|
this._dispatchY,
|
|
225
226
|
1
|
|
@@ -263,13 +264,13 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
263
264
|
reallocateReservedStorage() {
|
|
264
265
|
this._computeNode?.dispose(), this._computeNode = null, this._outputStorageTex?.dispose(), this._shadingStorageTex?.dispose();
|
|
265
266
|
let e = () => {
|
|
266
|
-
let e = new
|
|
267
|
+
let e = new M(k, k);
|
|
267
268
|
return e.type = ur, e.format = Q, e.minFilter = Z, e.magFilter = Z, e;
|
|
268
269
|
};
|
|
269
270
|
this._outputStorageTex = e(), this._shadingStorageTex = e(), this._leafStorageTex &&= (this._leafStorageTex.dispose(), this._makeLeafStorage()), this._computeBuilt = !1;
|
|
270
271
|
}
|
|
271
272
|
setInstanceLeafOutput(e) {
|
|
272
|
-
e = !!e, e !== !!this._leafStorageTex && (this._computeNode?.dispose(), this._computeNode = null, this._computeBuilt = !1, this._dirty = !0, e ? (this._leafStorageTex = this._makeLeafStorage(), this._leafRT = new
|
|
273
|
+
e = !!e, e !== !!this._leafStorageTex && (this._computeNode?.dispose(), this._computeNode = null, this._computeBuilt = !1, this._dirty = !0, e ? (this._leafStorageTex = this._makeLeafStorage(), this._leafRT = new Sn(this._rtA.width, this._rtA.height, {
|
|
273
274
|
type: Mr,
|
|
274
275
|
format: Er,
|
|
275
276
|
minFilter: Z,
|
|
@@ -282,20 +283,20 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
282
283
|
this._leafRT ? e.setTexture("pathtracer:instanceLeaf", this._leafRT.texture) : e.getTexture("pathtracer:instanceLeaf") && e.removeTexture("pathtracer:instanceLeaf");
|
|
283
284
|
}
|
|
284
285
|
_makeLeafStorage() {
|
|
285
|
-
let e = new
|
|
286
|
+
let e = new M(k, k);
|
|
286
287
|
return e.type = Mr, e.format = Er, e.minFilter = Z, e.magFilter = Z, e;
|
|
287
288
|
}
|
|
288
289
|
dispose() {
|
|
289
290
|
this._computeNode?.dispose(), this._outputStorageTex?.dispose(), this._shadingStorageTex?.dispose(), this._shadingRT?.dispose(), this._leafStorageTex?.dispose(), this._leafRT?.dispose(), this._rtA?.dispose(), this._rtB?.dispose();
|
|
290
291
|
}
|
|
291
|
-
}, Zr = class extends
|
|
292
|
+
}, Zr = class extends E {
|
|
292
293
|
constructor(e, t, n = {}) {
|
|
293
294
|
super("MotionVector", {
|
|
294
295
|
...n,
|
|
295
|
-
executionMode:
|
|
296
|
+
executionMode: ge.ALWAYS
|
|
296
297
|
}), this.renderer = e, this.camera = t, this.pathTracer = n.pathTracer || null;
|
|
297
298
|
let r = n.width || 1, i = n.height || 1;
|
|
298
|
-
this.prevViewProjectionMatrix = new hr(), this.currentViewProjectionMatrix = new hr(), this.matricesInitialized = !1, this.isFirstFrame = !0, this.frameCount = 0, this.cameraWorldMatrix =
|
|
299
|
+
this.prevViewProjectionMatrix = new hr(), this.currentViewProjectionMatrix = new hr(), this.matricesInitialized = !1, this.isFirstFrame = !0, this.frameCount = 0, this.cameraWorldMatrix = K(new hr(), "mat4"), this.cameraProjectionMatrixInverse = K(new hr(), "mat4"), this.cameraRay = ce(), this.prevVP = K(new hr(), "mat4"), this.isFirstFrameU = K(1), this.deltaTime = K(1 / 60), this.velocityScale = K(1), this.resolutionWidth = K(r), this.resolutionHeight = K(i), this._normalDepthTexNode = new N(), this._screenSpaceStorageTex = new M(k, k), this._screenSpaceStorageTex.type = ur, this._screenSpaceStorageTex.format = Q, this._screenSpaceStorageTex.minFilter = Z, this._screenSpaceStorageTex.magFilter = Z, this._worldSpaceStorageTex = new M(k, k), this._worldSpaceStorageTex.type = ur, this._worldSpaceStorageTex.format = Q, this._worldSpaceStorageTex.minFilter = Z, this._worldSpaceStorageTex.magFilter = Z, this._srcRegion = new er(new Nr(0, 0), new Nr(0, 0));
|
|
299
300
|
let a = {
|
|
300
301
|
type: ur,
|
|
301
302
|
format: Q,
|
|
@@ -304,18 +305,18 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
304
305
|
depthBuffer: !1,
|
|
305
306
|
stencilBuffer: !1
|
|
306
307
|
};
|
|
307
|
-
this.screenSpaceTarget = new
|
|
308
|
+
this.screenSpaceTarget = new Sn(r, i, a), this.worldSpaceTarget = new Sn(r, i, a), this._dispatchX = Math.ceil(r / 16), this._dispatchY = Math.ceil(i / 16), this._buildScreenSpaceCompute(), this._buildWorldSpaceCompute();
|
|
308
309
|
}
|
|
309
310
|
_buildScreenSpaceCompute() {
|
|
310
311
|
let e = this._normalDepthTexNode, t = this.cameraWorldMatrix, n = this.cameraProjectionMatrixInverse, r = this.prevVP, i = this.resolutionWidth, a = this.resolutionHeight, o = this._screenSpaceStorageTex;
|
|
311
|
-
this._screenSpaceComputeNode =
|
|
312
|
-
let s =
|
|
313
|
-
|
|
314
|
-
let l =
|
|
315
|
-
|
|
316
|
-
let e =
|
|
317
|
-
d.assign(c.select(J(s, l, 1), J(
|
|
318
|
-
}),
|
|
312
|
+
this._screenSpaceComputeNode = wn(([t, n]) => {
|
|
313
|
+
let s = I(Y.x).mul(16).add(I(R.x)), c = I(Y.y).mul(16).add(I(R.y));
|
|
314
|
+
P(s.lessThan(I(i)).and(c.lessThan(I(a))), () => {
|
|
315
|
+
let l = U(e, L(s, c)).w, u = qn(F(s).add(.5).div(i), F(c).add(.5).div(a)), d = J(0, 0, l, 1).toVar();
|
|
316
|
+
P(l.lessThan(F(6e4)), () => {
|
|
317
|
+
let e = ue(u, l, t, n, this.cameraRay), i = r.mul(J(e, 1)), a = i.xy.div(i.w), o = qn(a.x.mul(.5).add(.5), a.y.mul(-.5).add(.5)), s = u.sub(o), c = o.x.greaterThanEqual(0).and(o.x.lessThanEqual(1)).and(o.y.greaterThanEqual(0)).and(o.y.lessThanEqual(1));
|
|
318
|
+
d.assign(c.select(J(s, l, 1), J(F(1e3), F(1e3), l, 0)));
|
|
319
|
+
}), W(o, Gn(G(s), G(c)), d).toWriteOnly();
|
|
319
320
|
});
|
|
320
321
|
})(t, n).compute([
|
|
321
322
|
this._dispatchX,
|
|
@@ -329,14 +330,14 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
329
330
|
}
|
|
330
331
|
_buildWorldSpaceCompute() {
|
|
331
332
|
let e = this._normalDepthTexNode, t = this.cameraWorldMatrix, n = this.cameraProjectionMatrixInverse, r = this.prevVP, i = this.isFirstFrameU, a = this.deltaTime, o = this.velocityScale, s = this.resolutionWidth, c = this.resolutionHeight, l = this._worldSpaceStorageTex;
|
|
332
|
-
this._worldSpaceComputeNode =
|
|
333
|
-
let u =
|
|
334
|
-
|
|
335
|
-
let f =
|
|
336
|
-
|
|
337
|
-
let e =
|
|
333
|
+
this._worldSpaceComputeNode = wn(([t, n]) => {
|
|
334
|
+
let u = I(Y.x).mul(16).add(I(R.x)), d = I(Y.y).mul(16).add(I(R.y));
|
|
335
|
+
P(u.lessThan(I(s)).and(d.lessThan(I(c))), () => {
|
|
336
|
+
let f = U(e, L(u, d)).w, p = J(0, 0, 0, 0).toVar();
|
|
337
|
+
P(i.lessThan(.5).and(f.lessThan(F(6e4))), () => {
|
|
338
|
+
let e = qn(F(u).add(.5).div(s), F(d).add(.5).div(c)), i = ue(e, f, t, n, this.cameraRay), l = r.mul(J(i, 1)), m = l.xy.div(l.w), h = qn(m.x.mul(.5).add(.5), m.y.mul(-.5).add(.5)), g = h.x.greaterThanEqual(0).and(h.x.lessThanEqual(1)).and(h.y.greaterThanEqual(0)).and(h.y.lessThanEqual(1)), _ = e.sub(h), v = q(_.x.div(a).mul(o), _.y.div(a).mul(o), 0);
|
|
338
339
|
p.assign(g.select(J(v, 1), J(0, 0, 0, .5)));
|
|
339
|
-
}),
|
|
340
|
+
}), W(l, Gn(G(u), G(d)), p).toWriteOnly();
|
|
340
341
|
});
|
|
341
342
|
})(t, n).compute([
|
|
342
343
|
this._dispatchX,
|
|
@@ -400,7 +401,7 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
400
401
|
reallocateReservedStorage() {
|
|
401
402
|
this._screenSpaceComputeNode?.dispose(), this._worldSpaceComputeNode?.dispose(), this._screenSpaceStorageTex?.dispose(), this._worldSpaceStorageTex?.dispose();
|
|
402
403
|
let e = () => {
|
|
403
|
-
let e = new
|
|
404
|
+
let e = new M(k, k);
|
|
404
405
|
return e.type = ur, e.format = Q, e.minFilter = Z, e.magFilter = Z, e;
|
|
405
406
|
};
|
|
406
407
|
this._screenSpaceStorageTex = e(), this._worldSpaceStorageTex = e(), this._buildScreenSpaceCompute(), this._buildWorldSpaceCompute();
|
|
@@ -408,75 +409,75 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
408
409
|
dispose() {
|
|
409
410
|
this._screenSpaceComputeNode?.dispose(), this._worldSpaceComputeNode?.dispose(), this._screenSpaceStorageTex?.dispose(), this._worldSpaceStorageTex?.dispose(), this.screenSpaceTarget?.dispose(), this.worldSpaceTarget?.dispose(), this._normalDepthTexNode?.dispose();
|
|
410
411
|
}
|
|
411
|
-
}, Qr = (e) =>
|
|
412
|
+
}, Qr = (e) => H(e.equal(e), e, F(0)).clamp(0, 1e7), $r = (e) => q(Qr(e.x), Qr(e.y), Qr(e.z)), ei = class extends E {
|
|
412
413
|
constructor(e, t = {}) {
|
|
413
414
|
super("ASVGF", {
|
|
414
415
|
...t,
|
|
415
|
-
executionMode:
|
|
416
|
-
}), this.renderer = e, this.temporalAlpha =
|
|
416
|
+
executionMode: ge.PER_CYCLE
|
|
417
|
+
}), this.renderer = e, this.temporalAlpha = K(t.temporalAlpha ?? Hr.medium.temporalAlpha), this.gradientStrength = K(t.gradientStrength ?? Hr.medium.gradientStrength), this.gradientSigmaScale = K(t.gradientSigmaScale ?? Hr.medium.gradientSigmaScale), this.gradientNoiseFloor = K(t.gradientNoiseFloor ?? Hr.medium.gradientNoiseFloor), this.maxAccumFrames = K(t.maxAccumFrames ?? Hr.medium.maxAccumFrames), this.resW = K(t.width || 1), this.resH = K(t.height || 1), this.temporalEnabledU = K(1), this.forceResetU = K(0), this._colorTexNode = new N(), this._albedoTexNode = new N(), this._motionTexNode = new N(), this._normalDepthTexNode = new N(), this._prevNormalDepthTexNode = new N(), this._readTemporalTexNode = new N(), this._gradientReadTexNode = new N();
|
|
417
418
|
let n = t.width || 1, r = t.height || 1;
|
|
418
|
-
this._temporalTexA = new
|
|
419
|
+
this._temporalTexA = new M(k, k), this._temporalTexA.type = lr, this._temporalTexA.format = Q, this._temporalTexA.minFilter = X, this._temporalTexA.magFilter = X, this._temporalTexB = new M(k, k), this._temporalTexB.type = lr, this._temporalTexB.format = Q, this._temporalTexB.minFilter = X, this._temporalTexB.magFilter = X, this._outputModulatedTex = new M(k, k), this._outputModulatedTex.type = lr, this._outputModulatedTex.format = Q, this._outputModulatedTex.minFilter = X, this._outputModulatedTex.magFilter = X, this._gradientStorageTex = new M(k, k), this._gradientStorageTex.type = ur, this._gradientStorageTex.format = Q, this._gradientStorageTex.minFilter = X, this._gradientStorageTex.magFilter = X, this._srcRegion = new er(new Nr(0, 0), new Nr(0, 0)), this._demodulatedRT = new Sn(n, r, {
|
|
419
420
|
type: lr,
|
|
420
421
|
format: Q,
|
|
421
422
|
minFilter: X,
|
|
422
423
|
magFilter: X,
|
|
423
424
|
depthBuffer: !1,
|
|
424
425
|
stencilBuffer: !1
|
|
425
|
-
}), this._outputRT = new
|
|
426
|
+
}), this._outputRT = new Sn(n, r, {
|
|
426
427
|
type: lr,
|
|
427
428
|
format: Q,
|
|
428
429
|
minFilter: X,
|
|
429
430
|
magFilter: X,
|
|
430
431
|
depthBuffer: !1,
|
|
431
432
|
stencilBuffer: !1
|
|
432
|
-
}), this._gradientRT = new
|
|
433
|
+
}), this._gradientRT = new Sn(n, r, {
|
|
433
434
|
type: ur,
|
|
434
435
|
format: Q,
|
|
435
436
|
minFilter: X,
|
|
436
437
|
magFilter: X,
|
|
437
438
|
depthBuffer: !1,
|
|
438
439
|
stencilBuffer: !1
|
|
439
|
-
}), this.currentMoments = 0, this._compiled = !1, this._needsWarmReset = !1, this._dispatchX = Math.ceil(n / 8), this._dispatchY = Math.ceil(r / 8), this._buildGradientCompute(), this._buildTemporalCompute(), this.showHeatmap = !1, this.debugMode =
|
|
440
|
+
}), this.currentMoments = 0, this._compiled = !1, this._needsWarmReset = !1, this._dispatchX = Math.ceil(n / 8), this._dispatchY = Math.ceil(r / 8), this._buildGradientCompute(), this._buildTemporalCompute(), this.showHeatmap = !1, this.debugMode = K(0, "int"), this._heatmapStorageTex = new M(k, k), this._heatmapStorageTex.type = lr, this._heatmapStorageTex.format = Q, this._heatmapStorageTex.minFilter = Z, this._heatmapStorageTex.magFilter = Z, this.heatmapTarget = new Sn(n, r, {
|
|
440
441
|
type: lr,
|
|
441
442
|
format: Q,
|
|
442
443
|
minFilter: Z,
|
|
443
444
|
magFilter: Z,
|
|
444
445
|
depthBuffer: !1,
|
|
445
446
|
stencilBuffer: !1
|
|
446
|
-
}), this._heatmapRawColorTexNode = new
|
|
447
|
+
}), this._heatmapRawColorTexNode = new N(), this._heatmapColorTexNode = new N(), this._heatmapTemporalTexNode = new N(), this._heatmapNDTexNode = new N(), this._heatmapMotionTexNode = new N(), this._heatmapGradientTexNode = new N(), this._buildHeatmapCompute();
|
|
447
448
|
}
|
|
448
449
|
_buildGradientCompute() {
|
|
449
450
|
let e = this._colorTexNode, t = this._albedoTexNode, n = this._motionTexNode, r = this._readTemporalTexNode, i = this.gradientNoiseFloor, a = this.gradientSigmaScale, s = this._gradientStorageTex, c = this.resW, l = this.resH, u = Yn("float", 144), d = Yn("float", 144);
|
|
450
|
-
this._gradientNode =
|
|
451
|
-
let f =
|
|
452
|
-
let a = i.mod(
|
|
451
|
+
this._gradientNode = wn(() => {
|
|
452
|
+
let f = R.x, p = R.y, m = p.mul(8).add(f), h = I(Y.x).mul(8).sub(2).toVar(), g = I(Y.y).mul(8).sub(2).toVar(), _ = (i) => {
|
|
453
|
+
let a = i.mod(G(12)), s = i.div(G(12)), f = h.add(I(a)).clamp(I(0), I(c).sub(1)), p = g.add(I(s)).clamp(I(0), I(l).sub(1)), m = U(e, L(f, p)).xyz, _ = U(t, L(f, p)).xyz, v = o($r(m.div(z(_, q(Vr))))).toVar();
|
|
453
454
|
u.element(i).assign(v);
|
|
454
|
-
let y =
|
|
455
|
+
let y = U(n, L(f, p)), b = F(f).sub(y.x.mul(c)), x = F(p).sub(y.y.mul(l)), S = I(b.add(.5)).clamp(I(0), I(c).sub(1)), ee = I(x.add(.5)).clamp(I(0), I(l).sub(1)), C = y.w.greaterThan(.5), te = U(r, L(S, ee)).xyz, w = C.select(o(te), v);
|
|
455
456
|
d.element(i).assign(w);
|
|
456
457
|
};
|
|
457
458
|
_(m);
|
|
458
|
-
let v = m.add(
|
|
459
|
-
|
|
459
|
+
let v = m.add(G(64));
|
|
460
|
+
P(v.lessThan(G(144)), () => {
|
|
460
461
|
_(v);
|
|
461
462
|
});
|
|
462
|
-
let y = m.add(
|
|
463
|
-
|
|
463
|
+
let y = m.add(G(128));
|
|
464
|
+
P(y.lessThan(G(144)), () => {
|
|
464
465
|
_(y);
|
|
465
466
|
}), Xn();
|
|
466
|
-
let b =
|
|
467
|
-
|
|
468
|
-
let e =
|
|
467
|
+
let b = I(Y.x).mul(8).add(I(f)), x = I(Y.y).mul(8).add(I(p));
|
|
468
|
+
P(b.lessThan(I(c)).and(x.lessThan(I(l))), () => {
|
|
469
|
+
let e = F(0).toVar(), t = F(0).toVar();
|
|
469
470
|
for (let n = -2; n <= 2; n++) for (let r = -2; r <= 2; r++) {
|
|
470
|
-
let i = p.add(
|
|
471
|
+
let i = p.add(G(2 + n)).mul(G(12)).add(f.add(G(2 + r))), a = u.element(i);
|
|
471
472
|
e.addAssign(a), t.addAssign(a.mul(a));
|
|
472
473
|
}
|
|
473
|
-
let o = e.div(25), m =
|
|
474
|
+
let o = e.div(25), m = Un(z(t.div(25).sub(o.mul(o)), F(0))).mul(a).toVar(), h = F(0).toVar();
|
|
474
475
|
for (let e = -2; e <= 2; e++) for (let t = -2; t <= 2; t++) {
|
|
475
|
-
let n = p.add(
|
|
476
|
+
let n = p.add(G(2 + e)).mul(G(12)).add(f.add(G(2 + t))), r = u.element(n), a = d.element(n), o = z(z(Dn(r.sub(a)).sub(m), F(0)).div(z(z(r, a), F(.001))).sub(i), F(0)).div(z(F(1).sub(i), F(1e-4)));
|
|
476
477
|
h.addAssign(o.mul(o));
|
|
477
478
|
}
|
|
478
|
-
let g = h.div(25).clamp(0, 1).toVar(), _ =
|
|
479
|
-
|
|
479
|
+
let g = h.div(25).clamp(0, 1).toVar(), _ = U(n, L(b, x)), v = I(F(b).sub(_.x.mul(c)).add(.5)).clamp(I(0), I(c).sub(1)), y = I(F(x).sub(_.y.mul(l)).add(.5)).clamp(I(0), I(l).sub(1)), S = _.w.greaterThan(.5).select(U(r, L(v, y)).w, F(0)).div(4).clamp(0, 1), ee = g.mul(S);
|
|
480
|
+
W(s, Gn(G(b), G(x)), J(ee, g, m, 1)).toWriteOnly();
|
|
480
481
|
});
|
|
481
482
|
})().compute([
|
|
482
483
|
this._dispatchX,
|
|
@@ -493,23 +494,23 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
493
494
|
}
|
|
494
495
|
_buildTemporalForDirection(e) {
|
|
495
496
|
let t = this._colorTexNode, n = this._albedoTexNode, r = this._motionTexNode, i = this._normalDepthTexNode, a = this._prevNormalDepthTexNode, o = this._readTemporalTexNode, s = this._gradientReadTexNode, c = this._outputModulatedTex, l = this.maxAccumFrames, u = this.temporalAlpha, d = this.gradientStrength, f = this.temporalEnabledU, p = this.forceResetU, m = this.resW, h = this.resH;
|
|
496
|
-
return
|
|
497
|
-
let g =
|
|
498
|
-
|
|
499
|
-
let v =
|
|
500
|
-
|
|
501
|
-
let e =
|
|
502
|
-
|
|
503
|
-
let e =
|
|
504
|
-
let o =
|
|
497
|
+
return wn(() => {
|
|
498
|
+
let g = I(Y.x).mul(8).add(I(R.x)), _ = I(Y.y).mul(8).add(I(R.y));
|
|
499
|
+
P(g.lessThan(I(m)).and(_.lessThan(I(h))), () => {
|
|
500
|
+
let v = L(g, _), y = U(t, v), b = y.xyz, x = y.w, S = U(n, v).xyz, ee = z(S, q(Vr)), C = $r(b.div(ee)), te = J(C, 1).toVar(), w = J(b, x).toVar();
|
|
501
|
+
P(f.greaterThan(.5).and(p.lessThan(.5)), () => {
|
|
502
|
+
let e = U(r, v), t = e.w.greaterThan(.5), n = F(g).sub(e.x.mul(m)), c = F(_).sub(e.y.mul(h)), f = n.greaterThanEqual(0).and(n.lessThan(F(m))).and(c.greaterThanEqual(0)).and(c.lessThan(F(h)));
|
|
503
|
+
P(t.and(f), () => {
|
|
504
|
+
let e = U(i, v), t = e.xyz.mul(2).sub(1), r = e.w, f = I(n), p = I(c), g = f.add(I(1)), _ = p.add(I(1)), y = n.sub(F(f)), b = c.sub(F(p)), S = f.clamp(I(0), I(m).sub(1)), ne = g.clamp(I(0), I(m).sub(1)), re = p.clamp(I(0), I(h).sub(1)), T = _.clamp(I(0), I(h).sub(1)), ie = F(1).sub(y).mul(F(1).sub(b)), ae = y.mul(F(1).sub(b)), oe = F(1).sub(y).mul(b), se = y.mul(b), E = (e, n, i) => {
|
|
505
|
+
let o = U(a, L(e, n)), s = o.xyz.mul(2).sub(1), c = o.w, l = Bn(Nn(t, s).clamp(0, 1), F(16)), u = Pn(Dn(r.sub(c)).div(z(r, F(.001))).div(F(.05)).negate());
|
|
505
506
|
return i.mul(l).mul(u);
|
|
506
|
-
},
|
|
507
|
-
|
|
508
|
-
let e =
|
|
507
|
+
}, D = E(S, re, ie), ce = E(ne, re, ae), O = E(S, T, oe), k = E(ne, T, se), le = D.add(ce).add(O).add(k);
|
|
508
|
+
P(le.greaterThan(F(.01)), () => {
|
|
509
|
+
let e = U(o, L(S, re)), t = U(o, L(ne, re)), n = U(o, L(S, T)), r = U(o, L(ne, T)), i = F(1).div(le), a = e.xyz.mul(D).add(t.xyz.mul(ce)).add(n.xyz.mul(O)).add(r.xyz.mul(k)).mul(i), c = e.w.mul(D).add(t.w.mul(ce)).add(n.w.mul(O)).add(r.w.mul(k)).mul(i), f = U(s, v).x.mul(d).clamp(0, 1), p = $r(B(a, C, B(z(F(1).div(c.add(1)), u), F(1), f))), m = Rn(c.add(1), l);
|
|
509
510
|
te.assign(J(p, m)), w.assign(J(p.mul(ee), x));
|
|
510
511
|
});
|
|
511
512
|
});
|
|
512
|
-
}),
|
|
513
|
+
}), W(e, Gn(G(g), G(_)), te).toWriteOnly(), W(c, Gn(G(g), G(_)), w).toWriteOnly();
|
|
513
514
|
});
|
|
514
515
|
})().compute([
|
|
515
516
|
this._dispatchX,
|
|
@@ -523,35 +524,35 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
523
524
|
}
|
|
524
525
|
_buildHeatmapCompute() {
|
|
525
526
|
let e = this._heatmapRawColorTexNode, t = this._heatmapColorTexNode, n = this._heatmapTemporalTexNode, r = this._heatmapNDTexNode, i = this._heatmapMotionTexNode, a = this._heatmapGradientTexNode, s = this._heatmapStorageTex, c = this.debugMode, l = this.resW, u = this.resH;
|
|
526
|
-
this._heatmapComputeNode =
|
|
527
|
-
let d =
|
|
528
|
-
|
|
529
|
-
let p =
|
|
530
|
-
|
|
531
|
-
let e =
|
|
527
|
+
this._heatmapComputeNode = wn(() => {
|
|
528
|
+
let d = I(Y.x).mul(8).add(I(R.x)), f = I(Y.y).mul(8).add(I(R.y));
|
|
529
|
+
P(d.lessThan(I(l)).and(f.lessThan(I(u))), () => {
|
|
530
|
+
let p = L(d, f), m = J(0, 0, 0, 1).toVar();
|
|
531
|
+
P(c.equal(I(0)), () => {
|
|
532
|
+
let e = U(t, p).xyz;
|
|
532
533
|
m.assign(J(e, 1));
|
|
533
|
-
}).ElseIf(c.equal(
|
|
534
|
-
let t =
|
|
534
|
+
}).ElseIf(c.equal(I(1)), () => {
|
|
535
|
+
let t = F(0).toVar(), n = F(0).toVar();
|
|
535
536
|
for (let r = -1; r <= 1; r++) for (let i = -1; i <= 1; i++) {
|
|
536
|
-
let a =
|
|
537
|
+
let a = U(e, L(d.add(i).clamp(I(0), I(l).sub(1)), f.add(r).clamp(I(0), I(u).sub(1)))).xyz, s = o(a);
|
|
537
538
|
t.addAssign(s), n.addAssign(s.mul(s));
|
|
538
539
|
}
|
|
539
540
|
t.divAssign(9), n.divAssign(9);
|
|
540
|
-
let r =
|
|
541
|
+
let r = z(n.sub(t.mul(t)), F(0)).div(z(t.mul(t), F(1e-4))).mul(10).clamp(0, 1), i = r.sub(.5).mul(4).clamp(0, 1), a = r.mul(4).clamp(0, 1).sub(r.sub(.75).mul(4).clamp(0, 1)), s = F(1).sub(r.sub(.25).mul(4).clamp(0, 1));
|
|
541
542
|
m.assign(J(i, a, s, 1));
|
|
542
|
-
}).ElseIf(c.equal(
|
|
543
|
-
let e =
|
|
544
|
-
m.assign(J(
|
|
545
|
-
}).ElseIf(c.equal(
|
|
546
|
-
let e =
|
|
543
|
+
}).ElseIf(c.equal(I(2)), () => {
|
|
544
|
+
let e = U(n, p).w.div(32).clamp(0, 1);
|
|
545
|
+
m.assign(J(F(1).sub(e), e, F(.2), 1));
|
|
546
|
+
}).ElseIf(c.equal(I(3)), () => {
|
|
547
|
+
let e = U(i, p), t = Dn(e.x).mul(100).clamp(0, 1), n = Dn(e.y).mul(100).clamp(0, 1), r = t.add(n).clamp(0, 1);
|
|
547
548
|
m.assign(J(t, n, r.mul(.3), 1));
|
|
548
|
-
}).ElseIf(c.equal(
|
|
549
|
-
let e =
|
|
549
|
+
}).ElseIf(c.equal(I(4)), () => {
|
|
550
|
+
let e = U(r, p);
|
|
550
551
|
m.assign(J(e.xyz, 1));
|
|
551
552
|
}).Else(() => {
|
|
552
|
-
let e =
|
|
553
|
-
m.assign(J(e, e.mul(.5),
|
|
554
|
-
}),
|
|
553
|
+
let e = U(a, p).x.mul(5).clamp(0, 1);
|
|
554
|
+
m.assign(J(e, e.mul(.5), F(1).sub(e), 1));
|
|
555
|
+
}), W(s, Gn(G(d), G(f)), m).toWriteOnly();
|
|
555
556
|
});
|
|
556
557
|
})().compute([
|
|
557
558
|
this._dispatchX,
|
|
@@ -592,7 +593,7 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
592
593
|
reallocateReservedStorage() {
|
|
593
594
|
this._gradientNode?.dispose(), this._temporalNodeA?.dispose(), this._temporalNodeB?.dispose(), this._heatmapComputeNode?.dispose(), this._temporalTexA?.dispose(), this._temporalTexB?.dispose(), this._outputModulatedTex?.dispose(), this._gradientStorageTex?.dispose(), this._heatmapStorageTex?.dispose();
|
|
594
595
|
let e = (e, t) => {
|
|
595
|
-
let n = new
|
|
596
|
+
let n = new M(k, k);
|
|
596
597
|
return n.type = e, n.format = Q, n.minFilter = t, n.magFilter = t, n;
|
|
597
598
|
};
|
|
598
599
|
this._temporalTexA = e(lr, X), this._temporalTexB = e(lr, X), this._outputModulatedTex = e(lr, X), this._gradientStorageTex = e(ur, X), this._heatmapStorageTex = e(lr, Z), this._buildGradientCompute(), this._buildTemporalCompute(), this._buildHeatmapCompute(), this._compiled = !1, this.currentMoments = 0, this._needsWarmReset = !0;
|
|
@@ -677,43 +678,43 @@ var zr = 65504, Br = 6e4, Vr = .01, Hr = {
|
|
|
677
678
|
-gi,
|
|
678
679
|
.5
|
|
679
680
|
]
|
|
680
|
-
], vi = (e, t, n) =>
|
|
681
|
+
], vi = (e, t, n) => Hn(0, 1, F(1).sub(e.mul(t).add(n).abs())), yi = (e, t, n) => {
|
|
681
682
|
let r = e.mul(t).add(n).abs().mul(-ii);
|
|
682
|
-
return
|
|
683
|
-
}, bi = (e) =>
|
|
684
|
-
let i =
|
|
685
|
-
return
|
|
683
|
+
return F(1).div(r.mul(r).sub(r).add(1));
|
|
684
|
+
}, bi = (e) => B(F(1.570796), F(1.395402), V(e)).mul(Un(V(F(1).sub(e)))), xi = (e, t) => F(1).sub(Fn(e.mul(e).mul(-200))).mul(Bn(V(e), t)), Si = (e, t) => V(e).mul(Un(t.div(F(1).sub(t).add(ti)))), Ci = (e, t, n, r) => {
|
|
685
|
+
let i = z(On(Si(n, r.mul(B(V(t), F(1), e)))), F(ni));
|
|
686
|
+
return F(1).div(i);
|
|
686
687
|
}, wi = (e, t) => {
|
|
687
|
-
let n =
|
|
688
|
-
return
|
|
688
|
+
let n = F(1).div(B(F(ri), F(1), V(e.mul(t))));
|
|
689
|
+
return qn(n, e.mul(n).negate());
|
|
689
690
|
}, Ti = (e, t, n) => {
|
|
690
|
-
let r =
|
|
691
|
-
return
|
|
691
|
+
let r = F(1).div(B(F(n), F(1), B(e.mul(e), e, V(t))));
|
|
692
|
+
return qn(r, e.mul(r).negate());
|
|
692
693
|
}, Ei = (e, t) => {
|
|
693
|
-
let n =
|
|
694
|
-
return
|
|
694
|
+
let n = F(1).div(t);
|
|
695
|
+
return qn(n, e.mul(n).negate());
|
|
695
696
|
}, Di = (e, t, n, r) => {
|
|
696
|
-
let i =
|
|
697
|
-
return
|
|
698
|
-
}, Oi = (e) =>
|
|
697
|
+
let i = F(1).div(e.mul(t));
|
|
698
|
+
return qn(i, Nn(r, n).mul(i).negate());
|
|
699
|
+
}, Oi = (e) => qn(1).sub(qn(1).sub(Ln(e.mul(.5)).mul(2)).abs()).min(.99999), ki = (e) => q(Nn(e, q(.25, .5, .25)), Nn(e, q(.5, 0, -.5)), Nn(e, q(-.25, .5, -.25))), Ai = (e) => {
|
|
699
700
|
let t = e.x.sub(e.z);
|
|
700
|
-
return
|
|
701
|
-
}, ji = (e, t) => t.add(ti).div(e.add(ti)), Mi = (e, t) => J(e.xyz.mul(ji(e.x, t)), e.w), Ni = (e) => J(ki(Ai(e.xyz)),
|
|
701
|
+
return z(q(t.add(e.y), e.x.add(e.z), t.sub(e.y)), q(0));
|
|
702
|
+
}, ji = (e, t) => t.add(ti).div(e.add(ti)), Mi = (e, t) => J(e.xyz.mul(ji(e.x, t)), e.w), Ni = (e) => J(ki(Ai(e.xyz)), V(e.w)), Pi = (e, t) => Un(t.sub(e.mul(e)).abs()), Fi = (e, t) => qn(e.x.mul(t.x).add(e.y.mul(t.y)), e.z.mul(t.x).add(e.w.mul(t.y))), Ii = (e, t) => H(e.equal(0), J(0), t);
|
|
702
703
|
function Li(e) {
|
|
703
704
|
let t = Math.imul(e | 0, 2654435761) >>> 0;
|
|
704
705
|
return t ^= t >>> 15, t = Math.imul(t, 2246822507) >>> 0, t ^= t >>> 13, t = Math.imul(t, 3266489909) >>> 0, t ^= t >>> 16, t / 4294967296;
|
|
705
706
|
}
|
|
706
|
-
var Ri = class extends
|
|
707
|
+
var Ri = class extends E {
|
|
707
708
|
constructor(e, t = {}) {
|
|
708
709
|
super("NRD", {
|
|
709
710
|
...t,
|
|
710
|
-
executionMode:
|
|
711
|
+
executionMode: ge.PER_CYCLE
|
|
711
712
|
}), this.renderer = e, this.pathTracer = t.pathTracer || null, this.settings = {
|
|
712
713
|
...Gr,
|
|
713
714
|
...t.settings || {}
|
|
714
|
-
}, this._releaseHitDistance = this.pathTracer?.requestOutput?.("hitDistance", { encode: (e, t) => e.div(
|
|
715
|
+
}, this._releaseHitDistance = this.pathTracer?.requestOutput?.("hitDistance", { encode: (e, t) => e.div(z(t.mul(.1).add(3), F(1e-4))).clamp(0, 1) }) ?? null;
|
|
715
716
|
let n = t.width || 1, r = t.height || 1;
|
|
716
|
-
this.resW =
|
|
717
|
+
this.resW = K(n), this.resH = K(r), this.minRectDimMulUnproject = K(1), this.inputFrames = K(0), this.resetU = K(0), this.debugMode = K(0, "int"), this.rotPre = K(new Pr(1, 0, 0, 1), "vec4"), this.rotBlur = K(new Pr(1, 0, 0, 1), "vec4"), this.rotPost = K(new Pr(1, 0, 0, 1), "vec4"), this.camWorld = K(new hr(), "mat4"), this.camProjInv = K(new hr(), "mat4"), this.camView = K(new hr(), "mat4"), this.prevCamView = K(new hr(), "mat4"), this.camPos = K(new $(), "vec3"), this.prevCamPos = K(new $(), "vec3"), this.viewVector = K(new $(), "vec3"), this.prevViewVector = K(new $(), "vec3"), this.cameraRay = ce(), this.u = {};
|
|
717
718
|
for (let e of [
|
|
718
719
|
"maxAccum",
|
|
719
720
|
"maxFast",
|
|
@@ -733,15 +734,15 @@ var Ri = class extends oe {
|
|
|
733
734
|
"disocclusionThreshold",
|
|
734
735
|
"lobeVolumePercent",
|
|
735
736
|
"handoverFrames"
|
|
736
|
-
]) this.u[e] =
|
|
737
|
-
this.u.antilag =
|
|
737
|
+
]) this.u[e] = K(0);
|
|
738
|
+
this.u.antilag = K(new Nr(), "vec2"), this.u.convergence = K(new $(), "vec3"), this._syncUniforms(), this._colorTexNode = new N(), this._albedoTexNode = new N(), this._ndTexNode = new N(), this._snTexNode = new N(), this._motionTexNode = new N(), this._placeholders = /* @__PURE__ */ new Map();
|
|
738
739
|
let i = () => {
|
|
739
740
|
let e = new sr(new Float32Array(4), 1, 1, Q, lr);
|
|
740
741
|
e.needsUpdate = !0;
|
|
741
|
-
let t = new
|
|
742
|
+
let t = new N(e);
|
|
742
743
|
return this._placeholders.set(t, e), t;
|
|
743
744
|
};
|
|
744
|
-
this._nTmpA = i(), this._nTmpB = i(), this._nHist = i(), this._nFast = i(), this._nInternal = i(), this._nGeom = i(), this._nData = i(), this._nStabRead = i(), this._allocStorage(), this._srcRegion = new er(new Nr(0, 0), new Nr(0, 0)), this.outputTarget = new
|
|
745
|
+
this._nTmpA = i(), this._nTmpB = i(), this._nHist = i(), this._nFast = i(), this._nInternal = i(), this._nGeom = i(), this._nData = i(), this._nStabRead = i(), this._allocStorage(), this._srcRegion = new er(new Nr(0, 0), new Nr(0, 0)), this.outputTarget = new Sn(n, r, {
|
|
745
746
|
type: ur,
|
|
746
747
|
format: Q,
|
|
747
748
|
minFilter: X,
|
|
@@ -751,7 +752,7 @@ var Ri = class extends oe {
|
|
|
751
752
|
}), this._compiled = !1, this._needsReset = !0, this._stabPing = 0, this._camInitialized = !1, this._dispatchX = Math.ceil(n / mi), this._dispatchY = Math.ceil(r / mi), this._buildKernels();
|
|
752
753
|
}
|
|
753
754
|
_allocStorage() {
|
|
754
|
-
let e = () =>
|
|
755
|
+
let e = () => T(ur);
|
|
755
756
|
this._tmpA = e(), this._tmpB = e(), this._hist = e(), this._fastHist = e(), this._internal = e(), this._geomPrev = e(), this._stabA = e(), this._stabB = e(), this._dataT = e();
|
|
756
757
|
}
|
|
757
758
|
_disposeStorage() {
|
|
@@ -783,32 +784,32 @@ var Ri = class extends oe {
|
|
|
783
784
|
t.fastClampSigmaScale.value = 3 + (e.fastHistoryClampingSigmaScale - 3) * a, t.fireflyMinRelativeScale.value = e.fireflySuppressorMinRelativeScale, t.antiFirefly.value = +!!e.enableAntiFirefly, t.antilag.value.set(e.antilagLuminanceSigmaScale, e.antilagLuminanceSensitivity), t.disocclusionThreshold.value = e.disocclusionThreshold, t.convergence.value.set(e.convergenceS, e.convergenceB, e.convergenceP), t.lobeVolumePercent.value = e.lobeVolumePercent, t.handoverFrames.value = e.handoverFrames > 0 ? e.handoverFrames : 2 * n;
|
|
784
785
|
}
|
|
785
786
|
_worldPosAt(e, t, n, r) {
|
|
786
|
-
return
|
|
787
|
+
return ue(e, t, n, r, this.cameraRay);
|
|
787
788
|
}
|
|
788
789
|
_viewVector(e, t, n) {
|
|
789
|
-
return
|
|
790
|
+
return H(ne(this.cameraRay.cameraProjection), n, zn(t.sub(e)));
|
|
790
791
|
}
|
|
791
792
|
_frustumSize(e) {
|
|
792
|
-
return this.minRectDimMulUnproject.mul(
|
|
793
|
+
return this.minRectDimMulUnproject.mul(H(ne(this.cameraRay.cameraProjection), F(1), e));
|
|
793
794
|
}
|
|
794
795
|
_pixelUv(e, t) {
|
|
795
|
-
return
|
|
796
|
+
return qn(F(e).add(.5).div(this.resW), F(t).add(.5).div(this.resH));
|
|
796
797
|
}
|
|
797
798
|
_clampCoord(e, t) {
|
|
798
|
-
return
|
|
799
|
+
return L(e.clamp(I(0), I(this.resW).sub(1)), t.clamp(I(0), I(this.resH).sub(1)));
|
|
799
800
|
}
|
|
800
801
|
_uvToCoord(e) {
|
|
801
|
-
return this._clampCoord(
|
|
802
|
+
return this._clampCoord(I(e.x.mul(this.resW)), I(e.y.mul(this.resH)));
|
|
802
803
|
}
|
|
803
804
|
_advancedNonLinear(e) {
|
|
804
|
-
let t = this.u.convergence, n =
|
|
805
|
-
return
|
|
805
|
+
let t = this.u.convergence, n = V(e.div(F(1).add(this.u.maxAccum.mul(t.z)))), r = t.x.mul(B(t.y, F(1), n));
|
|
806
|
+
return F(1).div(F(1).add(r.mul(e)));
|
|
806
807
|
}
|
|
807
808
|
_handover(e) {
|
|
808
|
-
return
|
|
809
|
+
return V(e.div(z(this.u.handoverFrames, 1)));
|
|
809
810
|
}
|
|
810
811
|
_bilinear(e) {
|
|
811
|
-
let t = e.mul(
|
|
812
|
+
let t = e.mul(qn(this.resW, this.resH)).sub(.5), n = In(t), r = V(t.sub(n)), i = I(n.x), a = I(n.y), o = (e, t) => H(e.greaterThanEqual(I(0)).and(t.greaterThanEqual(I(0))).and(e.lessThan(I(this.resW))).and(t.lessThan(I(this.resH))), F(1), F(0));
|
|
812
813
|
return {
|
|
813
814
|
f: r,
|
|
814
815
|
taps: [
|
|
@@ -824,22 +825,22 @@ var Ri = class extends oe {
|
|
|
824
825
|
o(i.add(1), a.add(1))
|
|
825
826
|
],
|
|
826
827
|
customWeights: (e) => [
|
|
827
|
-
e[0].mul(
|
|
828
|
-
e[1].mul(r.x).mul(
|
|
829
|
-
e[2].mul(
|
|
828
|
+
e[0].mul(F(1).sub(r.x)).mul(F(1).sub(r.y)),
|
|
829
|
+
e[1].mul(r.x).mul(F(1).sub(r.y)),
|
|
830
|
+
e[2].mul(F(1).sub(r.x)).mul(r.y),
|
|
830
831
|
e[3].mul(r.x).mul(r.y)
|
|
831
832
|
],
|
|
832
|
-
filter: (e) =>
|
|
833
|
+
filter: (e) => B(B(e[0], e[1], r.x), B(e[2], e[3], r.x), r.y)
|
|
833
834
|
};
|
|
834
835
|
}
|
|
835
836
|
_applyCustomWeights(e, t, n) {
|
|
836
837
|
let r = e[0].mul(t[0]).add(e[1].mul(t[1])).add(e[2].mul(t[2])).add(e[3].mul(t[3])), i = t[0].add(t[1]).add(t[2]).add(t[3]);
|
|
837
|
-
return
|
|
838
|
+
return H(i.lessThan(1e-4), n, r.div(z(i, 1e-4)));
|
|
838
839
|
}
|
|
839
840
|
_sampleHistory(e, t, n, r, i) {
|
|
840
841
|
let a = J(0).toVar();
|
|
841
|
-
return
|
|
842
|
-
let n =
|
|
842
|
+
return P(i, () => {
|
|
843
|
+
let n = V(t).mul(qn(this.resW, this.resH)), r = In(n.sub(.5)).add(.5), i = V(n.sub(r)), o = pi, s = i.mul(i.mul(i.mul(-o).add(2 * o)).sub(o)), c = i.mul(i.mul(i.mul(2 - o).sub(3 - o))).add(1), l = i.mul(i.mul(i.mul(-(2 - o)).add(3 - 2 * o)).add(o)), u = i.mul(i.mul(i.mul(o).sub(o))), d = [
|
|
843
844
|
s.x,
|
|
844
845
|
c.x,
|
|
845
846
|
l.x,
|
|
@@ -849,13 +850,13 @@ var Ri = class extends oe {
|
|
|
849
850
|
c.y,
|
|
850
851
|
l.y,
|
|
851
852
|
u.y
|
|
852
|
-
], p =
|
|
853
|
+
], p = I(r.x).sub(1), m = I(r.y).sub(1), h = J(0).toVar(), g = F(0).toVar();
|
|
853
854
|
for (let t = 0; t < 4; t++) for (let n = 0; n < 4; n++) {
|
|
854
855
|
if ((n === 0 || n === 3) && (t === 0 || t === 3)) continue;
|
|
855
856
|
let r = d[n].mul(f[t]);
|
|
856
857
|
h.addAssign(e(this._clampCoord(p.add(n), m.add(t))).mul(r)), g.addAssign(r);
|
|
857
858
|
}
|
|
858
|
-
a.assign(
|
|
859
|
+
a.assign(H(g.lessThan(1e-4), J(0), h.div(z(g, 1e-4))));
|
|
859
860
|
}).Else(() => {
|
|
860
861
|
a.assign(this._applyCustomWeights(n.taps.map((t) => e(t)), r, J(0)));
|
|
861
862
|
}), a;
|
|
@@ -883,162 +884,162 @@ var Ri = class extends oe {
|
|
|
883
884
|
]);
|
|
884
885
|
}
|
|
885
886
|
_buildSpatial(e) {
|
|
886
|
-
let t = e === "pre", { radiusScale:
|
|
887
|
-
let t =
|
|
888
|
-
return J(ki(n(t.xyz.div(
|
|
889
|
-
} : (e) =>
|
|
890
|
-
let s =
|
|
891
|
-
|
|
892
|
-
let l =
|
|
893
|
-
|
|
894
|
-
let e = this._pixelUv(s, c), p = this._worldPosAt(e, C, n,
|
|
895
|
-
T.assign(v.mul(J(p, 1)).z.abs()),
|
|
896
|
-
let s =
|
|
897
|
-
t || (
|
|
898
|
-
let
|
|
887
|
+
let t = e === "pre", { radiusScale: i, fractionScale: a } = hi[e], o = this.u, s = this._colorTexNode, l = this._albedoTexNode, u = this._ndTexNode, d = this._snTexNode, f = this._nData, p = e === "blur" ? this._nTmpA : this._nTmpB, m = e === "blur" ? this._tmpB : t ? this._tmpA : this._hist, h = this._geomPrev, g = t ? this.rotPre : e === "blur" ? this.rotBlur : this.rotPost, _ = t ? o.prepassBlurRadius : o.maxBlurRadius, v = this.camView, y = this.camPos, b = this.resW, x = this.resH, S = this.inputFrames, ee = t ? (e) => {
|
|
888
|
+
let t = U(s, e), i = U(l, e);
|
|
889
|
+
return J(ki(n(t.xyz.div(z(i.xyz, q(Vr))))), r(i.w, c).min(1));
|
|
890
|
+
} : (e) => U(p, e), C = wn(([n, r]) => {
|
|
891
|
+
let s = I(Y.x).mul(mi).add(I(R.x)), c = I(Y.y).mul(mi).add(I(R.y));
|
|
892
|
+
P(s.lessThan(I(b)).and(c.lessThan(I(x))), () => {
|
|
893
|
+
let l = L(s, c), p = Gn(G(s), G(c)), C = U(u, l).w.toVar(), te = C.greaterThanEqual(Br), w = U(d, l).toVar(), ne = zn(w.xyz.mul(2).sub(1)).toVar(), re = w.w.clamp(.05, 1).toVar(), T = F(Br).toVar(), ie = ee(l).toVar();
|
|
894
|
+
P(te.not(), () => {
|
|
895
|
+
let e = this._pixelUv(s, c), p = this._worldPosAt(e, C, n, r).toVar();
|
|
896
|
+
T.assign(v.mul(J(p, 1)).z.abs()), P(_.greaterThan(0), () => {
|
|
897
|
+
let s = Nn(ne, this._viewVector(p, y, this.viewVector)).abs().toVar(), c = this._frustumSize(T).toVar(), m = S.add(1), h = t ? z(S, F(10)) : U(f, l).y.add(S), C = (t ? F(1).div(h.add(1)) : this._advancedNonLinear(h)).toVar(), te = xi(re, .5).toVar(), w = T.mul(Wr).add(3), ae = ie.w.toVar(), oe = V(ae.mul(w).div(c)), se = F(1).sub(this._handover(m)), E = (t ? oe.div(m) : oe.mul(C)).mul(se), D = o.minBlurRadius.mul(V(F(2).sub(h.div(z(o.maxAccum, 1))))), ce = z(V(Un(V(E)).mul(i)).mul(_).mul(te), D.mul(te)).toVar(), O = Di(o.planeDistSensitivity, c, p, ne).toVar(), k = Ci(C, o.lobeAngleFraction, re, o.lobeVolumePercent).div(a).toVar(), le = wi(re, o.roughnessFraction.mul(a)).toVar(), ue = Ei(ae, C).toVar(), de = o.minHitDistanceWeight.mul(a).mul(te);
|
|
898
|
+
t || (de = de.mul(C)), de = de.toVar();
|
|
899
|
+
let A = qn(1);
|
|
899
900
|
if (!t) {
|
|
900
901
|
let e = v.mul(J(ne, 0)).xy;
|
|
901
|
-
|
|
902
|
+
A = B(qn(1).sub(e.abs()), qn(1), s), A = A.div(z(A.x, A.y));
|
|
902
903
|
}
|
|
903
|
-
let
|
|
904
|
+
let fe = A.mul(qn(F(1).div(b), F(1).div(x))).mul(ce).toVar(), pe = F(1).toVar();
|
|
904
905
|
for (let t = 0; t < _i.length; t++) {
|
|
905
|
-
let
|
|
906
|
-
s.mulAssign(vi(m,
|
|
906
|
+
let i = _i[t], a = e.add(Fi(g, qn(i[0], i[1])).mul(fe)), o = Oi(a), s = H(o.x.notEqual(a.x).or(o.y.notEqual(a.y)), F(1), F(Math.exp(-.66 * i[2] * i[2]))).toVar(), c = this._uvToCoord(o), l = U(u, c).w, f = this._worldPosAt(o, l, n, r), p = U(d, c), m = bi(Nn(ne, zn(p.xyz.mul(2).sub(1))));
|
|
907
|
+
s.mulAssign(vi(m, k, F(0))), s.mulAssign(vi(p.w, le.x, le.y)), s.mulAssign(vi(Nn(ne, f), O.x, O.y)), s.assign(H(l.greaterThanEqual(Br), F(0), s));
|
|
907
908
|
let h = Ii(s, ee(c));
|
|
908
|
-
s.mulAssign(
|
|
909
|
+
s.mulAssign(de.add(yi(h.w, ue.x, ue.y))), pe.addAssign(s), ie.addAssign(h.mul(s));
|
|
909
910
|
}
|
|
910
|
-
ie.divAssign(
|
|
911
|
+
ie.divAssign(z(pe, 1e-6)), t || ie.assign(J(ie.xyz, ae));
|
|
911
912
|
});
|
|
912
|
-
}),
|
|
913
|
+
}), W(m, p, ie).toWriteOnly(), e === "post" && W(h, p, J(ne, T)).toWriteOnly();
|
|
913
914
|
});
|
|
914
915
|
});
|
|
915
916
|
return this._dispatchOf(C);
|
|
916
917
|
}
|
|
917
918
|
_buildTemporalAccumulation() {
|
|
918
|
-
let e = this.u, t = this._ndTexNode, n = this._snTexNode, r = this._motionTexNode, i = this._nTmpA, a = this._nHist, o = this._nFast, s = this._nInternal, c = this._nGeom, l = this._tmpB, u = this._dataT, d = this.camView, f = this.prevCamView, p = this.camPos, m = this.prevCamPos, h = this.resW, g = this.resH, _ = this.inputFrames, v = this.resetU, y =
|
|
919
|
-
let x =
|
|
920
|
-
|
|
921
|
-
let h =
|
|
922
|
-
|
|
923
|
-
|
|
919
|
+
let e = this.u, t = this._ndTexNode, n = this._snTexNode, r = this._motionTexNode, i = this._nTmpA, a = this._nHist, o = this._nFast, s = this._nInternal, c = this._nGeom, l = this._tmpB, u = this._dataT, d = this.camView, f = this.prevCamView, p = this.camPos, m = this.prevCamPos, h = this.resW, g = this.resH, _ = this.inputFrames, v = this.resetU, y = wn(([y, b]) => {
|
|
920
|
+
let x = I(Y.x).mul(mi).add(I(R.x)), S = I(Y.y).mul(mi).add(I(R.y));
|
|
921
|
+
P(x.lessThan(I(h)).and(S.lessThan(I(g))), () => {
|
|
922
|
+
let h = L(x, S), g = Gn(G(x), G(S)), ee = U(t, h).w, C = U(i, h).toVar();
|
|
923
|
+
P(ee.greaterThanEqual(Br), () => {
|
|
924
|
+
W(l, g, C).toWriteOnly(), W(u, g, J(0)).toWriteOnly(), En();
|
|
924
925
|
});
|
|
925
|
-
let te = e.maxAccum.mul(
|
|
926
|
-
|
|
926
|
+
let te = e.maxAccum.mul(F(1).sub(v)).toVar(), w = e.maxFast.mul(F(1).sub(v)).toVar(), ne = U(n, h), re = zn(ne.xyz.mul(2).sub(1)).toVar(), T = ne.w.clamp(.05, 1).toVar(), ie = this._pixelUv(x, S), ae = this._worldPosAt(ie, ee, y, b).toVar(), oe = d.mul(J(ae, 1)).z.abs().toVar(), se = Nn(re, this._viewVector(ae, p, this.viewVector)).abs().toVar(), E = this._frustumSize(oe).toVar(), D = q(0).toVar();
|
|
927
|
+
D.addAssign(re.mul(.25));
|
|
927
928
|
for (let e = -1; e <= 0; e++) for (let r = -1; r <= 0; r++) {
|
|
928
929
|
if (r === 0 && e === 0) continue;
|
|
929
|
-
let i = this._clampCoord(x.add(r), S.add(e)), a =
|
|
930
|
-
|
|
930
|
+
let i = this._clampCoord(x.add(r), S.add(e)), a = zn(U(n, i).xyz.mul(2).sub(1)), o = U(t, i).w.lessThan(Br);
|
|
931
|
+
D.addAssign(H(o, a, re).mul(.25));
|
|
931
932
|
}
|
|
932
|
-
let
|
|
933
|
+
let ce = U(r, h), O = ie.sub(ce.xy).toVar(), k = f.mul(J(ae, 1)).z.abs().toVar(), le = this._bilinear(O), ue = E.mul(V(e.disocclusionThreshold.div(z(se, .05)))).sub(ti).toVar(), de = F(1).sub(v), A = [], fe = [];
|
|
933
934
|
for (let e = 0; e < 4; e++) {
|
|
934
|
-
let t =
|
|
935
|
-
|
|
935
|
+
let t = U(c, le.taps[e]), n = H(Nn(t.xyz, D).greaterThan(fi), F(1), F(0)), r = H(t.w.sub(k).abs().lessThanEqual(ue), F(1), F(0)), i = H(t.w.lessThan(Br), F(1), F(0));
|
|
936
|
+
A.push(n.mul(r).mul(i).mul(le.inScreen[e]).mul(de).toVar()), fe.push(U(s, le.taps[e]).x);
|
|
936
937
|
}
|
|
937
|
-
let
|
|
938
|
-
|
|
939
|
-
let
|
|
940
|
-
|
|
941
|
-
let
|
|
942
|
-
|
|
943
|
-
let
|
|
944
|
-
|
|
945
|
-
let
|
|
946
|
-
|
|
947
|
-
let
|
|
948
|
-
|
|
938
|
+
let pe = le.customWeights(A).map((e) => e.toVar()), me = A[0].add(A[1]).add(A[2]).add(A[3]).greaterThan(3.5).toVar(), he = A[0].add(A[1].mul(2)).add(A[2].mul(4)).add(A[3].mul(8)), ge = this._applyCustomWeights(fe, pe, F(0)).toVar(), _e = Nn(re, this._viewVector(ae, m, this.prevViewVector)).abs().add(.001).div(se.add(.001)).toVar();
|
|
939
|
+
_e.assign(B(F(.1), F(1), V(_e.mul(_e))));
|
|
940
|
+
let ve = Un(V(le.filter(A))).mul(_e).toVar();
|
|
941
|
+
ge.assign(ge.mul(B(ve, F(1), F(1).div(ge.add(1))))), ge.assign(Rn(ge, te));
|
|
942
|
+
let ye = Ni(this._sampleHistory((e) => U(a, e), O, le, pe, me)).toVar(), be = z(this._applyCustomWeights(le.taps.map((e) => U(o, e).x), pe, F(0)), 0).toVar(), xe = _.add(1), Se = this._handover(xe).toVar(), Ce = ge.mul(F(1).sub(Se)), we = xe.div(xe.add(Ce)).toVar(), j = F(1).div(F(1).add(xi(T, .25).mul(.5).mul(te))), Te = J(B(ye.xyz, C.xyz, we), B(ye.w, C.w, z(we, j))).toVar(), Ee = e.fireflyMinRelativeScale.add(F(li).div(ge.add(1))).toVar(), De = ge.mul(e.maxBlurRadius).mul(ui).toVar();
|
|
943
|
+
De.assign(De.div(De.add(1)).mul(F(1).sub(Se)));
|
|
944
|
+
let Oe = B(Te.x, Rn(Te.x, ye.x.mul(Ee)), De);
|
|
945
|
+
Te.assign(Mi(Te, Oe));
|
|
946
|
+
let ke = F(1.2).add(F(1).div(ge.add(1)));
|
|
947
|
+
Te.assign(J(Te.xyz, B(Te.w, Rn(Te.w, ye.w.mul(ke)), De))), W(l, g, Te).toWriteOnly();
|
|
948
|
+
let Ae = Rn(ge, w).mul(F(1).sub(Se)), je = xe.div(xe.add(Ae)), Me = B(be, C.x, je).toVar(), Ne = Rn(Me, ye.x.mul(Ee).mul(di));
|
|
949
|
+
Me.assign(B(Me, Ne, De)), W(u, g, J(Me, ge, he, H(me, F(1), F(0)))).toWriteOnly();
|
|
949
950
|
});
|
|
950
951
|
});
|
|
951
952
|
return this._dispatchOf(y);
|
|
952
953
|
}
|
|
953
954
|
_buildHistoryFix() {
|
|
954
|
-
let e = this.u, t = this._ndTexNode, n = this._snTexNode, r = this._nTmpB, i = this._nData, a = this._tmpA, o = this._fastHist, s = this.camView, c = this.resW, l = this.resH, u = this.inputFrames, d =
|
|
955
|
-
let p =
|
|
956
|
-
|
|
957
|
-
let h =
|
|
958
|
-
|
|
959
|
-
let e =
|
|
960
|
-
|
|
955
|
+
let e = this.u, t = this._ndTexNode, n = this._snTexNode, r = this._nTmpB, i = this._nData, a = this._tmpA, o = this._fastHist, s = this.camView, c = this.resW, l = this.resH, u = this.inputFrames, d = wn(([d, f]) => {
|
|
956
|
+
let p = I(Y.x).mul(mi).add(I(R.x)), m = I(Y.y).mul(mi).add(I(R.y));
|
|
957
|
+
P(p.lessThan(I(c)).and(m.lessThan(I(l))), () => {
|
|
958
|
+
let h = L(p, m), g = Gn(G(p), G(m)), _ = U(t, h).w;
|
|
959
|
+
P(_.greaterThanEqual(Br), () => {
|
|
960
|
+
let e = U(r, h);
|
|
961
|
+
W(a, g, e).toWriteOnly(), W(o, g, J(e.x, 0, 0, 0)).toWriteOnly(), En();
|
|
961
962
|
});
|
|
962
|
-
let v =
|
|
963
|
-
|
|
964
|
-
let a = Ci(ie, e.lobeAngleFraction, C, e.lobeVolumePercent).toVar(), o = Di(e.planeDistSensitivity, re, w, ee).toVar(), s = Ei(se, ie).toVar(), u = Ti(C.mul(C),
|
|
963
|
+
let v = U(i, h).toVar(), y = v.y.toVar(), b = y.add(u), x = this._handover(u.add(1)).toVar(), S = U(n, h), ee = zn(S.xyz.mul(2).sub(1)).toVar(), C = S.w.clamp(.05, 1).toVar(), te = this._pixelUv(p, m), w = this._worldPosAt(te, _, d, f).toVar(), ne = s.mul(J(w, 1)).z.abs(), re = this._frustumSize(ne).toVar(), T = U(r, h).toVar(), ie = F(1).div(b.add(1)).toVar(), ae = ne.mul(Wr).add(3), oe = V(T.w.mul(ae).div(re)), se = T.w.toVar(), E = Vn(H(b.lessThan(e.historyFixFrameNum), F(1), F(0)).mul(.5).mul(2 / ai).mul(e.historyFixStride).mul(B(F(.25).add(Un(oe).mul(.75)), F(1), ie))).toVar();
|
|
964
|
+
P(E.notEqual(0), () => {
|
|
965
|
+
let a = Ci(ie, e.lobeAngleFraction, C, e.lobeVolumePercent).toVar(), o = Di(e.planeDistSensitivity, re, w, ee).toVar(), s = Ei(se, ie).toVar(), u = Ti(C.mul(C), Un(e.roughnessFraction), ri).toVar(), p = F(1).add(y).toVar();
|
|
965
966
|
T.mulAssign(p);
|
|
966
967
|
for (let e = -ai; e <= ai; e++) for (let m = -ai; m <= ai; m++) {
|
|
967
968
|
if (m === 0 && e === 0 || Math.abs(m) + Math.abs(e) === ai * 2) continue;
|
|
968
|
-
let h = Oi(te.add(
|
|
969
|
-
b.mulAssign(yi(y.w.mul(y.w), u.x, u.y)), b.mulAssign(
|
|
970
|
-
let x = Ii(b,
|
|
969
|
+
let h = Oi(te.add(qn(m, e).mul(E).mul(qn(F(1).div(c), F(1).div(l))))), g = this._uvToCoord(h), _ = U(t, g).w, v = this._worldPosAt(h, _, d, f), y = U(n, g), b = yi(bi(Nn(zn(y.xyz.mul(2).sub(1)), ee)), a, F(0)).toVar();
|
|
970
|
+
b.mulAssign(yi(y.w.mul(y.w), u.x, u.y)), b.mulAssign(F(1).add(U(i, g).y)), b.mulAssign(vi(Nn(ee, v), o.x, o.y)), b.assign(H(_.greaterThanEqual(Br), F(0), b));
|
|
971
|
+
let x = Ii(b, U(r, g));
|
|
971
972
|
b.mulAssign(yi(x.w, s.x, s.y)), p.addAssign(b), T.addAssign(x.mul(b));
|
|
972
973
|
}
|
|
973
|
-
T.divAssign(
|
|
974
|
+
T.divAssign(z(p, 1e-6));
|
|
974
975
|
});
|
|
975
|
-
let
|
|
976
|
-
|
|
977
|
-
let
|
|
978
|
-
let a = this._clampCoord(p.add(e), m.add(n)), o =
|
|
979
|
-
Math.abs(e) <= oi && Math.abs(n) <= oi && (
|
|
980
|
-
},
|
|
981
|
-
for (let e = -oi; e <= oi; e++) for (let t = -oi; t <= oi; t++) t === 0 && e === 0 ||
|
|
982
|
-
|
|
983
|
-
for (let e = -si; e <= si; e++) for (let t = -si; t <= si; t++) Math.abs(t) <= oi && Math.abs(e) <= oi ||
|
|
984
|
-
}),
|
|
985
|
-
let e = 1 / ((si * 2 + 1) ** 2 - 9), t =
|
|
986
|
-
|
|
976
|
+
let D = T.x.toVar(), ce = V(y.div(z(e.historyFixFrameNum, ti))), O = B(D, v.x, ce).toVar();
|
|
977
|
+
W(o, g, J(O, 0, 0, 0)).toWriteOnly();
|
|
978
|
+
let k = O.toVar(), le = O.mul(O).toVar(), ue = F(0).toVar(), de = F(0).toVar(), A = (e, n, r) => {
|
|
979
|
+
let a = this._clampCoord(p.add(e), m.add(n)), o = U(t, a).w, s = H(o.greaterThanEqual(Br), O, U(i, a).x);
|
|
980
|
+
Math.abs(e) <= oi && Math.abs(n) <= oi && (k.addAssign(s), le.addAssign(s.mul(s))), r && (ue.addAssign(s), de.addAssign(s.mul(s)));
|
|
981
|
+
}, fe = e.antiFirefly.greaterThan(.5);
|
|
982
|
+
for (let e = -oi; e <= oi; e++) for (let t = -oi; t <= oi; t++) t === 0 && e === 0 || A(t, e, Math.abs(t) > 1 || Math.abs(e) > 1);
|
|
983
|
+
P(fe, () => {
|
|
984
|
+
for (let e = -si; e <= si; e++) for (let t = -si; t <= si; t++) Math.abs(t) <= oi && Math.abs(e) <= oi || A(t, e, !0);
|
|
985
|
+
}), P(fe, () => {
|
|
986
|
+
let e = 1 / ((si * 2 + 1) ** 2 - 9), t = ue.mul(e), n = Pi(t, de.mul(e)).mul(ci);
|
|
987
|
+
D.assign(B(D.clamp(t.sub(n), t.add(n)), D, x));
|
|
987
988
|
});
|
|
988
989
|
{
|
|
989
|
-
let t = 1 / (oi * 2 + 1) ** 2, n =
|
|
990
|
-
|
|
990
|
+
let t = 1 / (oi * 2 + 1) ** 2, n = k.mul(t), r = Pi(n, le.mul(t)).mul(e.fastClampSigmaScale), i = D.clamp(n.sub(r), n.add(r)), a = H(e.maxFast.lessThan(e.maxAccum), F(1), F(0)), o = B(F(1).div(F(1).add(a.mul(y).mul(2))), F(1), x);
|
|
991
|
+
D.assign(B(i, D, o));
|
|
991
992
|
}
|
|
992
|
-
|
|
993
|
+
W(a, g, Mi(T, D)).toWriteOnly();
|
|
993
994
|
});
|
|
994
995
|
});
|
|
995
996
|
return this._dispatchOf(d);
|
|
996
997
|
}
|
|
997
998
|
_buildTemporalStabilization(e) {
|
|
998
999
|
let t = this.u, n = this._colorTexNode, r = this._albedoTexNode, i = this._ndTexNode, a = this._snTexNode, o = this._motionTexNode, s = this._nHist, c = this._nData, l = this._nStabRead, u = this._internal, d = this._tmpA, f = this.resW, p = this.resH, m = this.inputFrames, h = this.resetU, g = this.debugMode;
|
|
999
|
-
return
|
|
1000
|
-
let _ =
|
|
1001
|
-
|
|
1002
|
-
let f =
|
|
1003
|
-
|
|
1004
|
-
|
|
1000
|
+
return wn(() => {
|
|
1001
|
+
let _ = I(Y.x).mul(mi).add(I(R.x)), v = I(Y.y).mul(mi).add(I(R.y));
|
|
1002
|
+
P(_.lessThan(I(f)).and(v.lessThan(I(p))), () => {
|
|
1003
|
+
let f = L(_, v), p = Gn(G(_), G(v)), y = U(i, f).w, b = U(n, f).toVar();
|
|
1004
|
+
P(y.greaterThanEqual(Br), () => {
|
|
1005
|
+
W(d, p, b).toWriteOnly(), W(e, p, J(U(s, f).x, 0, 0, 0)).toWriteOnly(), W(u, p, J(0, 1, 0, 0)).toWriteOnly(), En();
|
|
1005
1006
|
});
|
|
1006
|
-
let x =
|
|
1007
|
+
let x = U(a, f).w.clamp(.05, 1), S = this._pixelUv(_, v), ee = U(o, f), C = S.sub(ee.xy).toVar(), te = U(c, f).toVar(), w = te.y.toVar(), ne = G(te.z.add(.5)).toVar(), re = te.w.greaterThan(.5), T = this._bilinear(C), ie = [
|
|
1007
1008
|
1,
|
|
1008
1009
|
2,
|
|
1009
1010
|
4,
|
|
1010
1011
|
8
|
|
1011
|
-
].map((e) =>
|
|
1012
|
+
].map((e) => H(ne.bitAnd(G(e)).notEqual(G(0)), F(1), F(0))), ae = T.customWeights(ie).map((e) => e.toVar()), oe = Un(V(T.filter(ie))).toVar(), se = U(s, f).toVar(), E = se.x.toVar(), D = E.toVar(), ce = E.mul(E).toVar();
|
|
1012
1013
|
for (let e = -1; e <= 1; e++) for (let t = -1; t <= 1; t++) {
|
|
1013
1014
|
if (t === 0 && e === 0) continue;
|
|
1014
|
-
let n = this._clampCoord(_.add(t), v.add(e)), r =
|
|
1015
|
-
|
|
1015
|
+
let n = this._clampCoord(_.add(t), v.add(e)), r = U(i, n).w, a = H(r.greaterThanEqual(Br), E, U(s, n).x);
|
|
1016
|
+
D.addAssign(a), ce.addAssign(a.mul(a));
|
|
1016
1017
|
}
|
|
1017
|
-
|
|
1018
|
-
let
|
|
1019
|
-
|
|
1020
|
-
|
|
1018
|
+
D.divAssign(9), ce.divAssign(9);
|
|
1019
|
+
let O = Pi(D, ce).toVar();
|
|
1020
|
+
P(w.lessThan(t.historyFixFrameNum), () => {
|
|
1021
|
+
E.assign(Rn(E, D.mul(F(1.2).add(F(1).div(w.add(1))))));
|
|
1021
1022
|
});
|
|
1022
|
-
let
|
|
1023
|
-
w.assign(
|
|
1024
|
-
let
|
|
1025
|
-
se.assign(Mi(se,
|
|
1026
|
-
let
|
|
1027
|
-
|
|
1028
|
-
let
|
|
1029
|
-
|
|
1030
|
-
let e =
|
|
1031
|
-
|
|
1032
|
-
}).ElseIf(g.equal(
|
|
1033
|
-
|
|
1034
|
-
}).ElseIf(g.equal(
|
|
1035
|
-
|
|
1036
|
-
}).ElseIf(g.equal(
|
|
1023
|
+
let k = z(this._sampleHistory((e) => U(l, e), C, T, ae, re).x, 0).toVar(), le = O.mul(t.antilag.x), ue = t.antilag.y.mul(4), de = k.clamp(D.sub(le), D.add(le)), A = k.sub(de).abs().div(z(k, de).add(ti)), fe = F(1).div(F(1).add(A.mul(w.mul(oe)).div(ue))).toVar(), pe = Rn(w, t.historyFixFrameNum);
|
|
1024
|
+
w.assign(B(pe, w, fe));
|
|
1025
|
+
let me = m.add(1), he = this._handover(me), ge = oe.mul(F(1).sub(this._advancedNonLinear(w.mul(F(1).sub(he)).div(me)))).mul(fe).toVar(), _e = F(1).add(ge.mul(6)), ve = t.stabilizationStrength.mul(F(1).sub(h)), ye = B(E, k.clamp(D.sub(O.mul(_e)), D.add(O.mul(_e))), Rn(ge, ve)).toVar();
|
|
1026
|
+
se.assign(Mi(se, ye)), W(e, p, J(ye, 0, 0, 0)).toWriteOnly();
|
|
1027
|
+
let be = t.maxAccum.mul(F(1).sub(h));
|
|
1028
|
+
W(u, p, J(Rn(w.add(1), be), x, 0, 0)).toWriteOnly();
|
|
1029
|
+
let xe = U(r, f), Se = J(Ai(se.xyz).mul(z(xe.xyz, q(Vr))), b.w).toVar();
|
|
1030
|
+
P(g.equal(I(1)), () => {
|
|
1031
|
+
let e = V(w.div(z(t.maxAccum, 1)));
|
|
1032
|
+
Se.assign(J(F(1).sub(e), e, .2, 1));
|
|
1033
|
+
}).ElseIf(g.equal(I(2)), () => {
|
|
1034
|
+
Se.assign(J(q(se.w), 1));
|
|
1035
|
+
}).ElseIf(g.equal(I(3)), () => {
|
|
1036
|
+
Se.assign(J(q(x), 1));
|
|
1037
|
+
}).ElseIf(g.equal(I(4)), () => {
|
|
1037
1038
|
let e = te.x.div(te.x.add(1));
|
|
1038
|
-
|
|
1039
|
-
}).ElseIf(g.equal(
|
|
1040
|
-
|
|
1041
|
-
}),
|
|
1039
|
+
Se.assign(J(q(e), 1));
|
|
1040
|
+
}).ElseIf(g.equal(I(5)), () => {
|
|
1041
|
+
Se.assign(J(q(te.z.div(15)), 1));
|
|
1042
|
+
}), W(d, p, Se).toWriteOnly();
|
|
1042
1043
|
});
|
|
1043
1044
|
})().compute([
|
|
1044
1045
|
this._dispatchX,
|
|
@@ -1122,14 +1123,14 @@ var Ri = class extends oe {
|
|
|
1122
1123
|
for (let [e, t] of this._placeholders) e.dispose(), t.dispose();
|
|
1123
1124
|
this._placeholders.clear();
|
|
1124
1125
|
}
|
|
1125
|
-
}, zi = (e) =>
|
|
1126
|
+
}, zi = (e) => H(e.equal(e), e, F(0)).clamp(0, 1e7), Bi = /* @__PURE__ */ Jn("\n fn temporalAccumulate(\n lum: f32,\n prevMean: f32,\n prevMeanSq: f32,\n alpha: f32,\n spatialVariance: f32,\n varianceBoost: f32\n ) -> vec4f {\n\n let newMean = prevMean + ( lum - prevMean ) * alpha;\n let newMeanSq = prevMeanSq + ( lum * lum - prevMeanSq ) * alpha;\n let temporalVariance = max( newMeanSq - newMean * newMean, 0.0 );\n\n return vec4f(\n newMean,\n newMeanSq,\n temporalVariance * varianceBoost,\n spatialVariance * varianceBoost\n );\n\n }\n"), Vi = class extends E {
|
|
1126
1127
|
constructor(e, t = {}) {
|
|
1127
1128
|
super("VarianceEstimation", {
|
|
1128
1129
|
...t,
|
|
1129
|
-
executionMode:
|
|
1130
|
-
}), this.renderer = e, this.inputTextureName = t.inputTextureName || "pathtracer:color", this.varianceBoost =
|
|
1130
|
+
executionMode: ge.ALWAYS
|
|
1131
|
+
}), this.renderer = e, this.inputTextureName = t.inputTextureName || "pathtracer:color", this.varianceBoost = K(t.varianceBoost ?? 1), this.temporalAlpha = K(t.temporalAlpha ?? .1), this.resW = K(t.width || 1), this.resH = K(t.height || 1), this._colorTexNode = new N();
|
|
1131
1132
|
let n = t.width || 1, r = t.height || 1;
|
|
1132
|
-
this._storageTexA = new
|
|
1133
|
+
this._storageTexA = new M(k, k), this._storageTexA.type = lr, this._storageTexA.format = Q, this._storageTexA.minFilter = X, this._storageTexA.magFilter = X, this._storageTexB = new M(k, k), this._storageTexB.type = lr, this._storageTexB.format = Q, this._storageTexB.minFilter = X, this._storageTexB.magFilter = X, this._srcRegion = new er(new Nr(0, 0), new Nr(0, 0)), this._outputTarget = new Sn(n, r, {
|
|
1133
1134
|
type: lr,
|
|
1134
1135
|
format: Q,
|
|
1135
1136
|
minFilter: X,
|
|
@@ -1142,26 +1143,26 @@ var Ri = class extends oe {
|
|
|
1142
1143
|
this.on("pathtracer:viewpointChanged", () => this.reset());
|
|
1143
1144
|
}
|
|
1144
1145
|
_buildCompute() {
|
|
1145
|
-
this._readTexNodeA = new
|
|
1146
|
+
this._readTexNodeA = new N(), this._readTexNodeB = new N(), this._computeNodeA = this._buildComputeForDirection(this._storageTexA, this._readTexNodeB), this._computeNodeB = this._buildComputeForDirection(this._storageTexB, this._readTexNodeA);
|
|
1146
1147
|
}
|
|
1147
1148
|
_buildComputeForDirection(e, t) {
|
|
1148
1149
|
let n = this._colorTexNode, r = this.temporalAlpha, i = this.varianceBoost, a = this.resW, s = this.resH, c = Yn("float", 100);
|
|
1149
|
-
return
|
|
1150
|
-
let l =
|
|
1151
|
-
c.element(d).assign(zi(o(g))),
|
|
1152
|
-
let e = d.add(
|
|
1150
|
+
return wn(() => {
|
|
1151
|
+
let l = R.x, u = R.y, d = u.mul(8).add(l), f = I(Y.x).mul(8).sub(1), p = I(Y.y).mul(8).sub(1), m = d.mod(10), h = d.div(10), g = U(n, L(f.add(I(m)).clamp(I(0), I(a).sub(1)), p.add(I(h)).clamp(I(0), I(s).sub(1)))).xyz;
|
|
1152
|
+
c.element(d).assign(zi(o(g))), P(d.lessThan(G(36)), () => {
|
|
1153
|
+
let e = d.add(G(64)), t = e.mod(10), r = e.div(10), i = U(n, L(f.add(I(t)).clamp(I(0), I(a).sub(1)), p.add(I(r)).clamp(I(0), I(s).sub(1)))).xyz;
|
|
1153
1154
|
c.element(e).assign(zi(o(i)));
|
|
1154
1155
|
}), Xn();
|
|
1155
|
-
let _ =
|
|
1156
|
-
|
|
1157
|
-
let n =
|
|
1156
|
+
let _ = I(Y.x).mul(8).add(I(l)), v = I(Y.y).mul(8).add(I(u));
|
|
1157
|
+
P(_.lessThan(I(a)).and(v.lessThan(I(s))), () => {
|
|
1158
|
+
let n = F(0).toVar(), a = F(0).toVar();
|
|
1158
1159
|
for (let e = -1; e <= 1; e++) for (let t = -1; t <= 1; t++) {
|
|
1159
1160
|
let r = c.element(u.add(1 + e).mul(10).add(l.add(1 + t)));
|
|
1160
1161
|
n.addAssign(r), a.addAssign(r.mul(r));
|
|
1161
1162
|
}
|
|
1162
1163
|
n.divAssign(9), a.divAssign(9);
|
|
1163
|
-
let o =
|
|
1164
|
-
|
|
1164
|
+
let o = z(a.sub(n.mul(n)), F(0)), s = c.element(u.add(1).mul(10).add(l.add(1))), d = U(t, L(_, v));
|
|
1165
|
+
W(e, Gn(G(_), G(v)), Bi(s, d.x, d.y, r, o, i)).toWriteOnly();
|
|
1165
1166
|
});
|
|
1166
1167
|
})().compute([
|
|
1167
1168
|
this._dispatchX,
|
|
@@ -1207,7 +1208,7 @@ var Ri = class extends oe {
|
|
|
1207
1208
|
reallocateReservedStorage() {
|
|
1208
1209
|
this._computeNodeA?.dispose(), this._computeNodeB?.dispose(), this._storageTexA?.dispose(), this._storageTexB?.dispose();
|
|
1209
1210
|
let e = () => {
|
|
1210
|
-
let e = new
|
|
1211
|
+
let e = new M(k, k);
|
|
1211
1212
|
return e.type = lr, e.format = Q, e.minFilter = X, e.magFilter = X, e;
|
|
1212
1213
|
};
|
|
1213
1214
|
this._storageTexA = e(), this._storageTexB = e(), this._buildCompute(), this._compiled = !1;
|
|
@@ -1215,14 +1216,14 @@ var Ri = class extends oe {
|
|
|
1215
1216
|
dispose() {
|
|
1216
1217
|
this._computeNodeA?.dispose(), this._computeNodeB?.dispose(), this._storageTexA?.dispose(), this._storageTexB?.dispose(), this._outputTarget?.dispose(), this._colorTexNode?.dispose(), this._readTexNodeA?.dispose(), this._readTexNodeB?.dispose();
|
|
1217
1218
|
}
|
|
1218
|
-
}, Hi = /* @__PURE__ */ Jn("\n fn bilateralWeight(\n centerLum: f32, sLum: f32,\n centerNormal: vec3f, sNormal: vec3f,\n centerDepth: f32, sDepth: f32,\n centerColor: vec3f, sColor: vec3f,\n kernelW: f32,\n sigmaL: f32, phiNorm: f32, phiDep: f32, phiCol: f32\n ) -> f32 {\n\n let lumW = exp( -abs( centerLum - sLum ) / sigmaL );\n // clamp dot to [0,1]: miss-ray normals decode to (-1,-1,-1) with\n // dot=3 → pow saturates to +inf → inf*0 = NaN. See project_tsl_pitfalls.\n // max(phiNorm, 1e-6): pow(0.0, 0.0) is undefined in WGSL and returned NaN on ~12%\n // of pixels when phiNormal was set to 0.\n let normW = pow( clamp( dot( centerNormal, sNormal ), 0.0, 1.0 ), max( phiNorm, 1e-6 ) );\n let depW = exp( -abs( centerDepth - sDepth ) / max( centerDepth * phiDep, 0.001 ) );\n let maxDiff = max( max( abs( centerColor.x - sColor.x ),\n abs( centerColor.y - sColor.y ) ),\n abs( centerColor.z - sColor.z ) );\n let avgLum = max( ( centerLum + sLum ) * 0.5, 0.0001 );\n let colW = exp( -( maxDiff / avgLum ) / max( phiCol, 0.0001 ) );\n return kernelW * lumW * normW * depW * colW;\n\n }\n"), Ui = class extends
|
|
1219
|
+
}, Hi = /* @__PURE__ */ Jn("\n fn bilateralWeight(\n centerLum: f32, sLum: f32,\n centerNormal: vec3f, sNormal: vec3f,\n centerDepth: f32, sDepth: f32,\n centerColor: vec3f, sColor: vec3f,\n kernelW: f32,\n sigmaL: f32, phiNorm: f32, phiDep: f32, phiCol: f32\n ) -> f32 {\n\n let lumW = exp( -abs( centerLum - sLum ) / sigmaL );\n // clamp dot to [0,1]: miss-ray normals decode to (-1,-1,-1) with\n // dot=3 → pow saturates to +inf → inf*0 = NaN. See project_tsl_pitfalls.\n // max(phiNorm, 1e-6): pow(0.0, 0.0) is undefined in WGSL and returned NaN on ~12%\n // of pixels when phiNormal was set to 0.\n let normW = pow( clamp( dot( centerNormal, sNormal ), 0.0, 1.0 ), max( phiNorm, 1e-6 ) );\n let depW = exp( -abs( centerDepth - sDepth ) / max( centerDepth * phiDep, 0.001 ) );\n let maxDiff = max( max( abs( centerColor.x - sColor.x ),\n abs( centerColor.y - sColor.y ) ),\n abs( centerColor.z - sColor.z ) );\n let avgLum = max( ( centerLum + sLum ) * 0.5, 0.0001 );\n let colW = exp( -( maxDiff / avgLum ) / max( phiCol, 0.0001 ) );\n return kernelW * lumW * normW * depW * colW;\n\n }\n"), Ui = class extends E {
|
|
1219
1220
|
constructor(e, t = {}) {
|
|
1220
1221
|
super("BilateralFiltering", {
|
|
1221
1222
|
...t,
|
|
1222
|
-
executionMode:
|
|
1223
|
-
}), this.renderer = e, this.inputTextureName = t.inputTextureName || "asvgf:demodulated", this.normalDepthTextureName = t.normalDepthTextureName || "pathtracer:normalDepth", this.shadingNormalTextureName = t.shadingNormalTextureName || "pathtracer:shadingNormal", this.albedoTextureName = t.albedoTextureName || "pathtracer:albedo", this.varianceTextureName = t.varianceTextureName || "variance:output", this.iterations = t.iterations ?? 4, this.phiColor =
|
|
1223
|
+
executionMode: ge.ALWAYS
|
|
1224
|
+
}), this.renderer = e, this.inputTextureName = t.inputTextureName || "asvgf:demodulated", this.normalDepthTextureName = t.normalDepthTextureName || "pathtracer:normalDepth", this.shadingNormalTextureName = t.shadingNormalTextureName || "pathtracer:shadingNormal", this.albedoTextureName = t.albedoTextureName || "pathtracer:albedo", this.varianceTextureName = t.varianceTextureName || "variance:output", this.iterations = t.iterations ?? 4, this.phiColor = K(t.phiColor ?? .5), this.phiNormal = K(t.phiNormal ?? 128), this.phiDepth = K(t.phiDepth ?? .05), this.phiLuminance = K(t.phiLuminance ?? 4), this.spatialVarianceWeight = K(t.spatialVarianceWeight ?? 1), this.stepSizeU = K(1, "int"), this.isLastIterationU = K(0, "int"), this.isFirstIterationU = K(1, "int"), this.resW = K(t.width || 1), this.resH = K(t.height || 1), this._readTexNode = new N(), this._normalDepthTexNode = new N(), this._shadingNormalTexNode = new N(), this._albedoTexNode = new N(), this._varianceTexNode = new N(), this._srcAlphaTexNode = new N();
|
|
1224
1225
|
let n = t.width || 1, r = t.height || 1;
|
|
1225
|
-
this._storageTexA = new
|
|
1226
|
+
this._storageTexA = new M(k, k), this._storageTexA.type = ur, this._storageTexA.format = Q, this._storageTexA.minFilter = X, this._storageTexA.magFilter = X, this._storageTexB = new M(k, k), this._storageTexB.type = ur, this._storageTexB.format = Q, this._storageTexB.minFilter = X, this._storageTexB.magFilter = X, this._srcRegion = new er(new Nr(0, 0), new Nr(0, 0)), this._outputTarget = new Sn(n, r, {
|
|
1226
1227
|
type: ur,
|
|
1227
1228
|
format: Q,
|
|
1228
1229
|
minFilter: X,
|
|
@@ -1262,19 +1263,19 @@ var Ri = class extends oe {
|
|
|
1262
1263
|
4 / 256,
|
|
1263
1264
|
1 / 256
|
|
1264
1265
|
];
|
|
1265
|
-
return
|
|
1266
|
-
let y =
|
|
1267
|
-
|
|
1268
|
-
let x =
|
|
1269
|
-
let t =
|
|
1270
|
-
return
|
|
1271
|
-
}, oe = ie.select(ae(x), S.w.mul(S.w)).toVar(), se = d.mul(
|
|
1266
|
+
return wn(() => {
|
|
1267
|
+
let y = I(Y.x).mul(8).add(I(R.x)), b = I(Y.y).mul(8).add(I(R.y));
|
|
1268
|
+
P(y.lessThan(I(g)).and(b.lessThan(I(_))), () => {
|
|
1269
|
+
let x = L(y, b), S = U(t, x), ee = S.xyz, C = U(n, x), te = U(r, x).xyz.mul(2).sub(1), w = C.w, ne = o(ee), re = z(U(i, x).xyz, q(Vr)), T = z(o(re), F(Vr)).toVar(), ie = h.equal(I(1)), ae = (e) => {
|
|
1270
|
+
let t = U(a, e);
|
|
1271
|
+
return B(t.z, z(t.z, t.w), f);
|
|
1272
|
+
}, oe = ie.select(ae(x), S.w.mul(S.w)).toVar(), se = d.mul(Un(z(oe, F(0)))).div(T).add(F(1e-4)), E = q(0).toVar(), D = F(0).toVar(), ce = F(0).toVar();
|
|
1272
1273
|
for (let e = 0; e < 5; e++) for (let i = 0; i < 5; i++) {
|
|
1273
|
-
let a = i - 2, s = e - 2, d = v[e * 5 + i], f = y.add(p.mul(a)).clamp(
|
|
1274
|
-
|
|
1274
|
+
let a = i - 2, s = e - 2, d = v[e * 5 + i], f = y.add(p.mul(a)).clamp(I(0), I(g).sub(1)), m = b.add(p.mul(s)).clamp(I(0), I(_).sub(1)), h = U(t, L(f, m)), x = h.xyz, S = U(n, L(f, m)), C = U(r, L(f, m)).xyz.mul(2).sub(1), re = S.w, T = Hi(ne, o(x), te, C, w, re, ee, x, F(d), se, l, u, c), oe = ie.select(ae(L(f, m)), h.w.mul(h.w));
|
|
1275
|
+
E.addAssign(x.mul(T)), D.addAssign(T), ce.addAssign(T.mul(T).mul(z(oe, F(0))));
|
|
1275
1276
|
}
|
|
1276
|
-
let
|
|
1277
|
-
|
|
1277
|
+
let O = E.div(z(D, F(1e-4))), k = ce.div(z(D.mul(D), F(1e-8))), le = m.equal(I(1)), ue = le.select(O.mul(re), O), de = le.select(U(s, x).w, Un(z(k, F(0))));
|
|
1278
|
+
W(e, Gn(G(y), G(b)), J(ue, de)).toWriteOnly();
|
|
1278
1279
|
});
|
|
1279
1280
|
})().compute([
|
|
1280
1281
|
this._dispatchX,
|
|
@@ -1321,7 +1322,7 @@ var Ri = class extends oe {
|
|
|
1321
1322
|
reallocateReservedStorage() {
|
|
1322
1323
|
this._computeNodeA?.dispose(), this._computeNodeB?.dispose(), this._storageTexA?.dispose(), this._storageTexB?.dispose();
|
|
1323
1324
|
let e = () => {
|
|
1324
|
-
let e = new
|
|
1325
|
+
let e = new M(k, k);
|
|
1325
1326
|
return e.type = ur, e.format = Q, e.minFilter = X, e.magFilter = X, e;
|
|
1326
1327
|
};
|
|
1327
1328
|
this._storageTexA = e(), this._storageTexB = e(), this._buildCompute(), this._compiled = !1;
|
|
@@ -1329,7 +1330,7 @@ var Ri = class extends oe {
|
|
|
1329
1330
|
dispose() {
|
|
1330
1331
|
this._computeNodeA?.dispose(), this._computeNodeB?.dispose(), this._storageTexA?.dispose(), this._storageTexB?.dispose(), this._outputTarget?.dispose(), this._readTexNode?.dispose(), this._normalDepthTexNode?.dispose(), this._shadingNormalTexNode?.dispose(), this._albedoTexNode?.dispose(), this._varianceTexNode?.dispose(), this._srcAlphaTexNode?.dispose();
|
|
1331
1332
|
}
|
|
1332
|
-
}, Wi = 6e4, Gi = (e) =>
|
|
1333
|
+
}, Wi = 6e4, Gi = (e) => H(e.equal(e), e, F(0)).clamp(0, 1e7), Ki = (e) => q(Gi(e.x), Gi(e.y), Gi(e.z)), qi = 4, Ji = [
|
|
1333
1334
|
1 / 256,
|
|
1334
1335
|
4 / 256,
|
|
1335
1336
|
6 / 256,
|
|
@@ -1355,14 +1356,14 @@ var Ri = class extends oe {
|
|
|
1355
1356
|
6 / 256,
|
|
1356
1357
|
4 / 256,
|
|
1357
1358
|
1 / 256
|
|
1358
|
-
], Yi = class extends
|
|
1359
|
+
], Yi = class extends E {
|
|
1359
1360
|
constructor(e, t = {}) {
|
|
1360
1361
|
super("EdgeAwareFiltering", {
|
|
1361
1362
|
...t,
|
|
1362
|
-
executionMode:
|
|
1363
|
-
}), this.renderer = e, this.filterStrength =
|
|
1363
|
+
executionMode: ge.PER_CYCLE
|
|
1364
|
+
}), this.renderer = e, this.filterStrength = K(t.filterStrength ?? 1), this.phiLuminance = K(t.phiLuminance ?? 1), this.phiNormal = K(t.phiNormal ?? 64), this.phiDepth = K(t.phiDepth ?? .1), this.iterations = t.atrousIterations ?? t.edgeAtrousIterations ?? 5, this.stepSizeU = K(1, "int"), this.isLastIterationU = K(0, "int"), this.isFirstIterationU = K(1, "int"), this.varianceHistoryU = K(0, "int"), this.resW = K(t.width || 1), this.resH = K(t.height || 1), this._colorTexNode = new N(), this._ndTexNode = new N(), this._snTexNode = new N(), this._albedoTexNode = new N(), this._varTexNode = new N(), this._readTexNode = new N();
|
|
1364
1365
|
let n = t.width || 1, r = t.height || 1;
|
|
1365
|
-
this._demodTex = this._makeStorageTex(), this._storageTexA = this._makeStorageTex(), this._storageTexB = this._makeStorageTex(), this._srcRegion = new er(new Nr(0, 0), new Nr(0, 0)), this.outputTarget = new
|
|
1366
|
+
this._demodTex = this._makeStorageTex(), this._storageTexA = this._makeStorageTex(), this._storageTexB = this._makeStorageTex(), this._srcRegion = new er(new Nr(0, 0), new Nr(0, 0)), this.outputTarget = new Sn(n, r, {
|
|
1366
1367
|
type: lr,
|
|
1367
1368
|
format: Q,
|
|
1368
1369
|
minFilter: X,
|
|
@@ -1372,7 +1373,7 @@ var Ri = class extends oe {
|
|
|
1372
1373
|
}), this._compiled = !1, this._dispatchX = Math.ceil(n / 16), this._dispatchY = Math.ceil(r / 16), this._buildCompute();
|
|
1373
1374
|
}
|
|
1374
1375
|
_makeStorageTex() {
|
|
1375
|
-
let e = new
|
|
1376
|
+
let e = new M(k, k);
|
|
1376
1377
|
return e.type = lr, e.format = Q, e.minFilter = X, e.magFilter = X, e;
|
|
1377
1378
|
}
|
|
1378
1379
|
_buildCompute() {
|
|
@@ -1380,11 +1381,11 @@ var Ri = class extends oe {
|
|
|
1380
1381
|
}
|
|
1381
1382
|
_buildDemod() {
|
|
1382
1383
|
let e = this._colorTexNode, t = this._ndTexNode, n = this._albedoTexNode, r = this._demodTex, i = this.resW, a = this.resH;
|
|
1383
|
-
return
|
|
1384
|
-
let o =
|
|
1385
|
-
|
|
1386
|
-
let i =
|
|
1387
|
-
|
|
1384
|
+
return wn(() => {
|
|
1385
|
+
let o = I(Y.x).mul(16).add(I(R.x)), s = I(Y.y).mul(16).add(I(R.y));
|
|
1386
|
+
P(o.lessThan(I(i)).and(s.lessThan(I(a))), () => {
|
|
1387
|
+
let i = L(o, s), a = U(e, i).xyz, c = U(t, i).w.lessThan(F(Wi)), l = U(n, i).xyz, u = H(c, z(l, q(Vr)), q(1)), d = Ki(a.div(u));
|
|
1388
|
+
W(r, Gn(G(o), G(s)), J(d, 1)).toWriteOnly();
|
|
1388
1389
|
});
|
|
1389
1390
|
})().compute([
|
|
1390
1391
|
this._dispatchX,
|
|
@@ -1398,19 +1399,19 @@ var Ri = class extends oe {
|
|
|
1398
1399
|
}
|
|
1399
1400
|
_buildAtrous(e) {
|
|
1400
1401
|
let t = this._readTexNode, n = this._colorTexNode, r = this._ndTexNode, i = this._snTexNode, a = this._albedoTexNode, s = this._varTexNode, c = this.filterStrength, l = this.phiLuminance, u = this.phiNormal, d = this.phiDepth, f = this.stepSizeU, p = this.isLastIterationU, m = this.isFirstIterationU, h = this.varianceHistoryU, g = this.resW, _ = this.resH;
|
|
1401
|
-
return
|
|
1402
|
-
let v =
|
|
1403
|
-
|
|
1404
|
-
let b =
|
|
1405
|
-
let t =
|
|
1406
|
-
return
|
|
1407
|
-
},
|
|
1402
|
+
return wn(() => {
|
|
1403
|
+
let v = I(Y.x).mul(16).add(I(R.x)), y = I(Y.y).mul(16).add(I(R.y));
|
|
1404
|
+
P(v.lessThan(I(g)).and(y.lessThan(I(_))), () => {
|
|
1405
|
+
let b = L(v, y), x = U(t, b), S = x.xyz, ee = o(S), C = U(r, b).w, te = U(i, b).xyz.mul(2).sub(1), w = C.lessThan(F(Wi)), ne = H(w, F(1), F(0)), re = U(a, b).xyz, T = H(w, z(re, q(Vr)), q(1)), ie = z(o(T), F(Vr)), ae = m.equal(I(1)), oe = h.lessThan(I(qi)), se = (e) => {
|
|
1406
|
+
let t = U(s, e);
|
|
1407
|
+
return H(oe, z(t.z, t.w), t.z);
|
|
1408
|
+
}, E = ae.select(se(b), x.w.mul(x.w)).toVar(), D = l.mul(Un(z(E, F(0)))).div(ie).add(F(1e-4)), ce = q(0).toVar(), O = F(0).toVar(), k = F(0).toVar();
|
|
1408
1409
|
for (let e = 0; e < 5; e++) for (let n = 0; n < 5; n++) {
|
|
1409
|
-
let a = n - 2, s = e - 2, c = Ji[e * 5 + n], l =
|
|
1410
|
-
|
|
1410
|
+
let a = n - 2, s = e - 2, c = Ji[e * 5 + n], l = L(v.add(f.mul(a)).clamp(I(0), I(g).sub(1)), y.add(f.mul(s)).clamp(I(0), I(_).sub(1))), p = U(t, l), m = p.xyz, h = o(m), b = U(r, l).w, x = U(i, l).xyz.mul(2).sub(1), S = H(b.lessThan(F(Wi)), F(1), F(0)), w = ee.sub(h).abs().div(D).negate().exp(), re = Bn(Nn(te, x).clamp(0, 1), u), T = C.sub(b).abs().div(z(C.mul(d), F(.001))).negate().exp(), ie = ne.mul(S), oe = ne.oneMinus().mul(S.oneMinus()), E = ie.add(oe), le = B(F(1), re.mul(T), ie), ue = F(c).mul(w).mul(le).mul(E), de = ae.select(se(l), p.w.mul(p.w));
|
|
1411
|
+
ce.addAssign(m.mul(ue)), O.addAssign(ue), k.addAssign(ue.mul(ue).mul(z(de, F(0))));
|
|
1411
1412
|
}
|
|
1412
|
-
let
|
|
1413
|
-
|
|
1413
|
+
let le = ce.div(z(O, F(1e-4))), ue = k.div(z(O.mul(O), F(1e-8))), de = p.equal(I(1)), A = U(n, b).xyz, fe = B(A, le.mul(T), c), pe = de.select(fe, le), me = de.select(U(n, b).w, Un(z(ue, F(0))));
|
|
1414
|
+
W(e, Gn(G(v), G(y)), J(pe, me)).toWriteOnly();
|
|
1414
1415
|
});
|
|
1415
1416
|
})().compute([
|
|
1416
1417
|
this._dispatchX,
|
|
@@ -1475,12 +1476,12 @@ var Ri = class extends oe {
|
|
|
1475
1476
|
autoExposureMaxExposure: 20,
|
|
1476
1477
|
autoExposureAdaptSpeedBright: 3,
|
|
1477
1478
|
autoExposureAdaptSpeedDark: .5
|
|
1478
|
-
}, Zi = 256, Qi = -8, $i = 6 - Qi, ea = $i / Zi, ta = 1e4, na = /* @__PURE__ */ Jn("\n fn adaptExposure(\n geoMean: f32,\n prevExposure: f32,\n keyValue: f32,\n minExp: f32,\n maxExp: f32,\n speedBright: f32,\n speedDark: f32,\n dt: f32,\n isFirstFrame: f32\n ) -> vec4f {\n\n let targetExp = clamp( keyValue / max( geoMean, 0.001 ), minExp, maxExp );\n var newExposure = targetExp;\n\n // Temporal smoothing (skip on first frame)\n if ( isFirstFrame < 0.5 ) {\n\n // Asymmetric speed: brighter scenes adapt faster\n let speed = select( speedDark, speedBright, targetExp < prevExposure );\n let alpha = 1.0 - exp( -dt * speed );\n newExposure = mix( prevExposure, targetExp, alpha );\n\n }\n\n return vec4f( newExposure, geoMean, targetExp, 1.0 );\n\n }\n"), ra = class extends
|
|
1479
|
+
}, Zi = 256, Qi = -8, $i = 6 - Qi, ea = $i / Zi, ta = 1e4, na = /* @__PURE__ */ Jn("\n fn adaptExposure(\n geoMean: f32,\n prevExposure: f32,\n keyValue: f32,\n minExp: f32,\n maxExp: f32,\n speedBright: f32,\n speedDark: f32,\n dt: f32,\n isFirstFrame: f32\n ) -> vec4f {\n\n let targetExp = clamp( keyValue / max( geoMean, 0.001 ), minExp, maxExp );\n var newExposure = targetExp;\n\n // Temporal smoothing (skip on first frame)\n if ( isFirstFrame < 0.5 ) {\n\n // Asymmetric speed: brighter scenes adapt faster\n let speed = select( speedDark, speedBright, targetExp < prevExposure );\n let alpha = 1.0 - exp( -dt * speed );\n newExposure = mix( prevExposure, targetExp, alpha );\n\n }\n\n return vec4f( newExposure, geoMean, targetExp, 1.0 );\n\n }\n"), ra = class extends E {
|
|
1479
1480
|
constructor(e, t = {}) {
|
|
1480
1481
|
super("AutoExposure", {
|
|
1481
1482
|
...t,
|
|
1482
|
-
executionMode:
|
|
1483
|
-
}), this.renderer = e, this.REDUCTION_SIZE = 64, this.keyValueU =
|
|
1483
|
+
executionMode: ge.ALWAYS
|
|
1484
|
+
}), this.renderer = e, this.REDUCTION_SIZE = 64, this.keyValueU = K(t.keyValue ?? Xi.autoExposureKeyValue), this.minExposureU = K(t.minExposure ?? Xi.autoExposureMinExposure), this.maxExposureU = K(t.maxExposure ?? Xi.autoExposureMaxExposure), this.adaptSpeedBrightU = K(t.adaptSpeedBright ?? Xi.autoExposureAdaptSpeedBright), this.adaptSpeedDarkU = K(t.adaptSpeedDark ?? Xi.autoExposureAdaptSpeedDark), this.epsilonU = K(t.epsilon ?? 1e-4), this.deltaTimeU = K(1 / 60), this.isFirstFrameU = K(1), this.previousExposureU = K(t.initialExposure ?? 1), this.lowPercentileU = K(t.lowPercentile ?? .1), this.highPercentileU = K(t.highPercentile ?? .9), this.centerWeightU = K(t.centerWeight ?? 8), this.inputResW = K(1), this.inputResH = K(1), this._inputTexNode = new N(), this._reductionReadTexNode = new N(), this.currentExposure = t.initialExposure ?? 1, this.currentLuminance = .18, this.targetExposure = 1, this.lastTime = performance.now(), this.isFirstFrame = !0, this._pendingReadback = !1, this._readbackGeneration = 0, this._initRenderTargets(), this._buildCompute();
|
|
1484
1485
|
}
|
|
1485
1486
|
_initRenderTargets() {
|
|
1486
1487
|
let e = {
|
|
@@ -1491,22 +1492,22 @@ var Ri = class extends oe {
|
|
|
1491
1492
|
depthBuffer: !1,
|
|
1492
1493
|
stencilBuffer: !1
|
|
1493
1494
|
};
|
|
1494
|
-
this._downsampleTarget = new
|
|
1495
|
+
this._downsampleTarget = new Sn(this.REDUCTION_SIZE, this.REDUCTION_SIZE, e), this._downsampleStorageTex = new M(this.REDUCTION_SIZE, this.REDUCTION_SIZE), this._downsampleStorageTex.type = lr, this._downsampleStorageTex.format = Q, this._downsampleStorageTex.minFilter = Z, this._downsampleStorageTex.magFilter = Z, this._reductionStorageTex = new M(1, 1), this._reductionStorageTex.type = lr, this._reductionStorageTex.format = Q, this._reductionStorageTex.minFilter = Z, this._reductionStorageTex.magFilter = Z, this._reductionReadTarget = new Sn(1, 1, e), this._adaptationResult = Mn(1, "vec4"), this._readbackBuffer = new xn(16), this._readbackBuffer.name = "AutoExposureAdaptation", this._histogramBuffer = Mn(Zi, "uint").toAtomic();
|
|
1495
1496
|
}
|
|
1496
1497
|
_buildCompute() {
|
|
1497
1498
|
this._buildDownsampleCompute(), this._buildHistogramCompute(), this._buildHistogramAnalyzeCompute(), this._buildAdaptationCompute();
|
|
1498
1499
|
}
|
|
1499
1500
|
_buildDownsampleCompute() {
|
|
1500
1501
|
let e = this._inputTexNode, t = this._downsampleStorageTex, n = this.epsilonU, r = this.inputResW, i = this.inputResH;
|
|
1501
|
-
this._downsampleComputeNode =
|
|
1502
|
-
let a =
|
|
1502
|
+
this._downsampleComputeNode = wn(() => {
|
|
1503
|
+
let a = I(Y.x).mul(8).add(I(R.x)), s = I(Y.y).mul(8).add(I(R.y)), c = r.div(F(64)), l = i.div(F(64)), u = F(a).mul(c), d = F(s).mul(l), f = F(0).toVar(), p = F(0).toVar();
|
|
1503
1504
|
for (let t = 0; t < 4; t++) for (let r = 0; r < 4; r++) {
|
|
1504
|
-
let i = o(
|
|
1505
|
-
|
|
1505
|
+
let i = o(U(e, L(I(u.add(F((r + .5) / 4).mul(c))), I(d.add(F((t + .5) / 4).mul(l))))).xyz);
|
|
1506
|
+
P(i.greaterThan(n), () => {
|
|
1506
1507
|
f.addAssign(i.add(n).log()), p.addAssign(1);
|
|
1507
1508
|
});
|
|
1508
1509
|
}
|
|
1509
|
-
|
|
1510
|
+
W(t, Gn(G(a), G(s)), J(f, p, 0, 1)).toWriteOnly();
|
|
1510
1511
|
})().compute([
|
|
1511
1512
|
64 / 8,
|
|
1512
1513
|
64 / 8,
|
|
@@ -1519,14 +1520,14 @@ var Ri = class extends oe {
|
|
|
1519
1520
|
}
|
|
1520
1521
|
_buildHistogramCompute() {
|
|
1521
1522
|
let e = this._downsampleTarget.texture, t = this._histogramBuffer, n = this.centerWeightU;
|
|
1522
|
-
this._histogramComputeNode =
|
|
1523
|
-
let r =
|
|
1524
|
-
|
|
1523
|
+
this._histogramComputeNode = wn(() => {
|
|
1524
|
+
let r = R.x;
|
|
1525
|
+
jn(t.element(r), G(0)), Xn();
|
|
1525
1526
|
for (let i = 0; i < 16; i++) {
|
|
1526
|
-
let a = r.mul(16).add(i), o = a.mod(64), s = a.div(64), c =
|
|
1527
|
-
|
|
1528
|
-
let e =
|
|
1529
|
-
|
|
1527
|
+
let a = r.mul(16).add(i), o = a.mod(64), s = a.div(64), c = U(e, L(I(o), I(s))), l = c.x, u = c.y;
|
|
1528
|
+
P(u.greaterThan(0), () => {
|
|
1529
|
+
let e = G(l.div(u).sub(F(Qi)).div(F($i)).mul(F(Zi)).floor().clamp(0, F(Zi - 1))), r = F(o).add(.5).div(F(64)), i = F(s).add(.5).div(F(64)), a = r.sub(.5), c = i.sub(.5), d = G(a.mul(a).add(c.mul(c)).mul(n).negate().exp().mul(F(ta)));
|
|
1530
|
+
kn(t.element(e), d);
|
|
1530
1531
|
});
|
|
1531
1532
|
}
|
|
1532
1533
|
})().compute([
|
|
@@ -1541,21 +1542,21 @@ var Ri = class extends oe {
|
|
|
1541
1542
|
}
|
|
1542
1543
|
_buildHistogramAnalyzeCompute() {
|
|
1543
1544
|
let e = this._histogramBuffer, t = this._reductionStorageTex, n = this.lowPercentileU, r = this.highPercentileU;
|
|
1544
|
-
this._histogramAnalyzeNode =
|
|
1545
|
-
let i =
|
|
1546
|
-
|
|
1547
|
-
i.addAssign(
|
|
1545
|
+
this._histogramAnalyzeNode = wn(() => {
|
|
1546
|
+
let i = F(0).toVar();
|
|
1547
|
+
Tn(Zi, ({ i: t }) => {
|
|
1548
|
+
i.addAssign(F(An(e.element(t))));
|
|
1548
1549
|
});
|
|
1549
|
-
let a = i.mul(n), o = i.mul(r), s =
|
|
1550
|
-
|
|
1551
|
-
let n =
|
|
1552
|
-
u.assign(s), s.addAssign(n),
|
|
1553
|
-
let e =
|
|
1550
|
+
let a = i.mul(n), o = i.mul(r), s = F(0).toVar(), c = F(0).toVar(), l = F(0).toVar(), u = F(0).toVar();
|
|
1551
|
+
Tn(Zi, ({ i: t }) => {
|
|
1552
|
+
let n = F(An(e.element(t)));
|
|
1553
|
+
u.assign(s), s.addAssign(n), P(u.lessThan(o).and(s.greaterThan(a)), () => {
|
|
1554
|
+
let e = F(Qi).add(F(t).add(.5).mul(F(ea)));
|
|
1554
1555
|
c.addAssign(e.mul(n)), l.addAssign(n);
|
|
1555
1556
|
});
|
|
1556
1557
|
});
|
|
1557
|
-
let d =
|
|
1558
|
-
|
|
1558
|
+
let d = z(l, F(1)), f = c.div(d), p = f.exp();
|
|
1559
|
+
W(t, Gn(G(0), G(0)), J(p, i, f, 1)).toWriteOnly();
|
|
1559
1560
|
})().compute(1, [
|
|
1560
1561
|
1,
|
|
1561
1562
|
1,
|
|
@@ -1564,9 +1565,9 @@ var Ri = class extends oe {
|
|
|
1564
1565
|
}
|
|
1565
1566
|
_buildAdaptationCompute() {
|
|
1566
1567
|
let e = this._reductionReadTexNode, t = this._adaptationResult, n = this.keyValueU, r = this.minExposureU, i = this.maxExposureU, a = this.adaptSpeedBrightU, o = this.adaptSpeedDarkU, s = this.deltaTimeU, c = this.isFirstFrameU, l = this.previousExposureU;
|
|
1567
|
-
this._adaptationComputeNode =
|
|
1568
|
-
let u =
|
|
1569
|
-
t.element(
|
|
1568
|
+
this._adaptationComputeNode = wn(() => {
|
|
1569
|
+
let u = U(e, L(I(0), I(0))).x, d = na(u, l, n, r, i, a, o, s, c);
|
|
1570
|
+
t.element(G(0)).assign(d);
|
|
1570
1571
|
})().compute(1, [
|
|
1571
1572
|
1,
|
|
1572
1573
|
1,
|
|
@@ -1635,16 +1636,16 @@ function sa(e, t, n = !1) {
|
|
|
1635
1636
|
return n ? e.distance : oa(e.point, t);
|
|
1636
1637
|
}
|
|
1637
1638
|
var ca = class extends cr {
|
|
1638
|
-
constructor({ scene: e, camera: t, canvas: n, assetLoader: r, pathTracer: i, floorPlane: a }) {
|
|
1639
|
-
super(), this.scene = e, this.camera = t, this.canvas = n, this.assetLoader = r, this.pathTracer = i, this.floorPlane = a, this.raycaster = new Tr(), this.focusMode = !1, this.focusPointIndicator = null, this.afPointPlacementMode = !1, this.handleAFPointClick = this.handleAFPointClick.bind(this), this.selectedObject = null, this.selectMode = !1, this.clickTimeout = null, this.mouseDownPosition = null, this.dragThreshold = 5, this.handleFocusClick = this.handleFocusClick.bind(this), this.handleSelectClick = this.handleSelectClick.bind(this), this.handleSelectDoubleClick = this.handleSelectDoubleClick.bind(this), this.handleMouseDown = this.handleMouseDown.bind(this), this.handleMouseUp = this.handleMouseUp.bind(this), this.handleContextMenu = this.handleContextMenu.bind(this), this.handleContextPointerDown = this.handleContextPointerDown.bind(this), this.handleContextPointerUp = this.handleContextPointerUp.bind(this), this.contextPointerDownPosition = null, this.canvas.addEventListener("pointerdown", this.handleContextPointerDown), this.canvas.addEventListener("pointerup", this.handleContextPointerUp), this.canvas.addEventListener("contextmenu", this.handleContextMenu), this._overlayManager = null, this._transformManager = null, this._appDispatch = null, this._orbitControls = null, this._helperScene = null;
|
|
1639
|
+
constructor({ scene: e, camera: t, canvas: n, assetLoader: r, pathTracer: i, floorPlane: a, isGeometryOnDisk: o = null }) {
|
|
1640
|
+
super(), this.scene = e, this.isGeometryOnDisk = o, this.camera = t, this.canvas = n, this.assetLoader = r, this.pathTracer = i, this.floorPlane = a, this.raycaster = new Tr(), this.focusMode = !1, this.focusPointIndicator = null, this.afPointPlacementMode = !1, this.handleAFPointClick = this.handleAFPointClick.bind(this), this.selectedObject = null, this.selectMode = !1, this.clickTimeout = null, this.mouseDownPosition = null, this.dragThreshold = 5, this.handleFocusClick = this.handleFocusClick.bind(this), this.handleSelectClick = this.handleSelectClick.bind(this), this.handleSelectDoubleClick = this.handleSelectDoubleClick.bind(this), this.handleMouseDown = this.handleMouseDown.bind(this), this.handleMouseUp = this.handleMouseUp.bind(this), this.handleContextMenu = this.handleContextMenu.bind(this), this.handleContextPointerDown = this.handleContextPointerDown.bind(this), this.handleContextPointerUp = this.handleContextPointerUp.bind(this), this.contextPointerDownPosition = null, this.canvas.addEventListener("pointerdown", this.handleContextPointerDown), this.canvas.addEventListener("pointerup", this.handleContextPointerUp), this.canvas.addEventListener("contextmenu", this.handleContextMenu), this._overlayManager = null, this._transformManager = null, this._appDispatch = null, this._orbitControls = null, this._helperScene = null;
|
|
1640
1641
|
}
|
|
1641
1642
|
setDependencies({ overlayManager: e, transformManager: t, appDispatch: n, orbitControls: r, helperScene: i }) {
|
|
1642
1643
|
this._overlayManager = e || null, this._transformManager = t || null, this._appDispatch = n || null, this._orbitControls = r || null, this._helperScene = i || null;
|
|
1643
1644
|
}
|
|
1644
1645
|
select(e) {
|
|
1645
1646
|
let t = this._overlayManager?.getHelper("outline");
|
|
1646
|
-
t && t.setSelectedObjects(e ? [e] : []), this.selectedObject = e || null, e ? this._transformManager?.attach(e) : this._transformManager?.detach(), this._appDispatch?.({
|
|
1647
|
-
type:
|
|
1647
|
+
t && t.setSelectedObjects(e && !this.isGeometryOnDisk?.() ? [e] : []), this.selectedObject = e || null, e ? this._transformManager?.attach(e) : this._transformManager?.detach(), this._appDispatch?.({
|
|
1648
|
+
type: j.OBJECT_SELECTED,
|
|
1648
1649
|
object: e || null
|
|
1649
1650
|
});
|
|
1650
1651
|
}
|
|
@@ -1666,7 +1667,7 @@ var ca = class extends cr {
|
|
|
1666
1667
|
handleFocusClick(e) {
|
|
1667
1668
|
let t = this.getMouseCoordinates(e);
|
|
1668
1669
|
this.raycaster.setFromCamera(t, this.camera);
|
|
1669
|
-
let n = this.
|
|
1670
|
+
let n = this._intersectScene();
|
|
1670
1671
|
if (n.length > 0) {
|
|
1671
1672
|
let e = n[0], t = this.pathTracer?.cameraProjection?.value === Ae.equirectangular, r = sa(e, this.camera, t);
|
|
1672
1673
|
this.showFocusPoint(e.point), this.toggleFocusMode(), this.dispatchEvent({
|
|
@@ -1739,7 +1740,7 @@ var ca = class extends cr {
|
|
|
1739
1740
|
this.clickTimeout = null;
|
|
1740
1741
|
let t = this.getMouseCoordinates(e);
|
|
1741
1742
|
this.raycaster.setFromCamera(t, this.camera);
|
|
1742
|
-
let n = this.
|
|
1743
|
+
let n = this._intersectScene(), r = this.filterValidIntersects(n), i = this._pickLightHelper(), a = null;
|
|
1743
1744
|
if (r.length > 0 && i ? a = r[0].distance <= i.distance ? r[0].object : i.light : r.length > 0 ? a = r[0].object : i && (a = i.light), a) {
|
|
1744
1745
|
let e = this.selectedObject;
|
|
1745
1746
|
e && e.uuid === a.uuid ? this.dispatchEvent({
|
|
@@ -1762,7 +1763,7 @@ var ca = class extends cr {
|
|
|
1762
1763
|
this.mouseDownPosition = null, this.clickTimeout &&= (clearTimeout(this.clickTimeout), null);
|
|
1763
1764
|
let t = this.getMouseCoordinates(e);
|
|
1764
1765
|
this.raycaster.setFromCamera(t, this.camera);
|
|
1765
|
-
let n = this.
|
|
1766
|
+
let n = this._intersectScene(), r = this.filterValidIntersects(n);
|
|
1766
1767
|
if (r.length > 0) {
|
|
1767
1768
|
let e = r[0].object;
|
|
1768
1769
|
this.dispatchEvent({
|
|
@@ -1807,11 +1808,14 @@ var ca = class extends cr {
|
|
|
1807
1808
|
y: -((e.clientY - t.top) / t.height) * 2 + 1
|
|
1808
1809
|
};
|
|
1809
1810
|
}
|
|
1811
|
+
_intersectScene() {
|
|
1812
|
+
return this.isGeometryOnDisk?.() ? [] : this.raycaster.intersectObjects(this.scene.children, !0);
|
|
1813
|
+
}
|
|
1810
1814
|
pickSurface(e, t) {
|
|
1811
1815
|
return this.raycaster.setFromCamera({
|
|
1812
1816
|
x: e,
|
|
1813
1817
|
y: t
|
|
1814
|
-
}, this.camera), this.filterValidIntersects(this.
|
|
1818
|
+
}, this.camera), this.filterValidIntersects(this._intersectScene())[0] ?? null;
|
|
1815
1819
|
}
|
|
1816
1820
|
filterValidIntersects(e) {
|
|
1817
1821
|
return e.filter((e) => {
|
|
@@ -1840,35 +1844,35 @@ var ca = class extends cr {
|
|
|
1840
1844
|
wireAppEvents(e) {
|
|
1841
1845
|
this.addEventListener("objectSelected", (t) => {
|
|
1842
1846
|
this.select(t.object), e.refreshFrame(), e.dispatchEvent({
|
|
1843
|
-
type:
|
|
1847
|
+
type: j.OBJECT_SELECTED,
|
|
1844
1848
|
object: t.object,
|
|
1845
1849
|
uuid: t.uuid
|
|
1846
1850
|
});
|
|
1847
1851
|
}), this.addEventListener("objectDeselected", (t) => {
|
|
1848
1852
|
this.select(null), e.refreshFrame(), e.dispatchEvent({
|
|
1849
|
-
type:
|
|
1853
|
+
type: j.OBJECT_DESELECTED,
|
|
1850
1854
|
object: t.object,
|
|
1851
1855
|
uuid: t.uuid
|
|
1852
1856
|
});
|
|
1853
1857
|
}), this.addEventListener("selectModeChanged", (t) => {
|
|
1854
1858
|
e.dispatchEvent({
|
|
1855
|
-
type:
|
|
1859
|
+
type: j.SELECT_MODE_CHANGED,
|
|
1856
1860
|
enabled: t.enabled
|
|
1857
1861
|
});
|
|
1858
1862
|
}), this.addEventListener("objectDoubleClicked", (t) => {
|
|
1859
1863
|
this.select(t.object), e.refreshFrame(), e.dispatchEvent({
|
|
1860
|
-
type:
|
|
1864
|
+
type: j.OBJECT_DOUBLE_CLICKED,
|
|
1861
1865
|
object: t.object,
|
|
1862
1866
|
uuid: t.uuid
|
|
1863
1867
|
});
|
|
1864
1868
|
}), this.addEventListener("focusChanged", (t) => {
|
|
1865
1869
|
e.settings.set("focusDistance", t.worldDistance), e.dispatchEvent({
|
|
1866
|
-
type:
|
|
1870
|
+
type: j.FOCUS_CHANGED,
|
|
1867
1871
|
distance: t.distance
|
|
1868
1872
|
});
|
|
1869
1873
|
}), this.addEventListener("afPointPlaced", (t) => {
|
|
1870
1874
|
e.dispatchEvent({
|
|
1871
|
-
type:
|
|
1875
|
+
type: j.AF_POINT_PLACED,
|
|
1872
1876
|
point: t.point
|
|
1873
1877
|
});
|
|
1874
1878
|
});
|
|
@@ -2079,7 +2083,7 @@ var ca = class extends cr {
|
|
|
2079
2083
|
this.resetAutoFocus();
|
|
2080
2084
|
let a = this.cameras[e], o = a?.userData?.__rayzeeEffects;
|
|
2081
2085
|
this._showOrthographic(o ? o.orthoHeight : Aa(a)), this._applyEffects(o), n?.(), r?.(), this.dispatchEvent({
|
|
2082
|
-
type:
|
|
2086
|
+
type: j.CAMERA_SWITCHED,
|
|
2083
2087
|
cameraIndex: e,
|
|
2084
2088
|
effects: this._captureEffects(),
|
|
2085
2089
|
fov: this.camera.fov,
|
|
@@ -2142,7 +2146,7 @@ var ca = class extends cr {
|
|
|
2142
2146
|
if (!this.camera.orthographic) return;
|
|
2143
2147
|
let e = this.orthoHeight;
|
|
2144
2148
|
e !== this._reportedOrthoHeight && (this._reportedOrthoHeight = e, this.dispatchEvent({
|
|
2145
|
-
type:
|
|
2149
|
+
type: j.ORTHO_HEIGHT_UPDATED,
|
|
2146
2150
|
height: e
|
|
2147
2151
|
}));
|
|
2148
2152
|
}
|
|
@@ -2213,7 +2217,7 @@ var ca = class extends cr {
|
|
|
2213
2217
|
let n = {
|
|
2214
2218
|
index: t,
|
|
2215
2219
|
name: e.name ?? "",
|
|
2216
|
-
effects:
|
|
2220
|
+
effects: de(e.userData?.__rayzeeEffects) ?? null
|
|
2217
2221
|
};
|
|
2218
2222
|
return t === 0 || !e.userData?.__rayzeeUserCamera ? n : {
|
|
2219
2223
|
...n,
|
|
@@ -2246,7 +2250,7 @@ var ca = class extends cr {
|
|
|
2246
2250
|
for (let r of e.cameras ?? []) {
|
|
2247
2251
|
if (r.user) {
|
|
2248
2252
|
let e = r.orthographic ? new xr(...r.frustum, r.near, r.far) : new Sr(r.fov, r.aspect, r.near, r.far);
|
|
2249
|
-
e.name = r.name, e.zoom = r.zoom ?? 1, e.position.fromArray(r.position), e.quaternion.fromArray(r.quaternion), e.scale.fromArray(r.scale), e.updateProjectionMatrix(), e.updateMatrixWorld(!0), e.userData.__rayzeeUserCamera = !0, e.userData.__rayzeeEffects =
|
|
2253
|
+
e.name = r.name, e.zoom = r.zoom ?? 1, e.position.fromArray(r.position), e.quaternion.fromArray(r.quaternion), e.scale.fromArray(r.scale), e.updateProjectionMatrix(), e.updateMatrixWorld(!0), e.userData.__rayzeeUserCamera = !0, e.userData.__rayzeeEffects = me(r.effects), r.orbitTarget && (e.userData.__rayzeeOrbitTarget = new $().fromArray(r.orbitTarget)), n.set(r.index, this.cameras.length), this.cameras.push(e);
|
|
2250
2254
|
continue;
|
|
2251
2255
|
}
|
|
2252
2256
|
let e = this.cameras[r.index];
|
|
@@ -2254,7 +2258,7 @@ var ca = class extends cr {
|
|
|
2254
2258
|
t.push(r.name);
|
|
2255
2259
|
continue;
|
|
2256
2260
|
}
|
|
2257
|
-
n.set(r.index, r.index), r.effects && (e.userData.__rayzeeEffects =
|
|
2261
|
+
n.set(r.index, r.index), r.effects && (e.userData.__rayzeeEffects = me(r.effects));
|
|
2258
2262
|
}
|
|
2259
2263
|
this._userCameraCounter = this.cameras.filter((e) => e.userData?.__rayzeeUserCamera).length, this.currentCameraIndex = n.get(e.current) ?? 0;
|
|
2260
2264
|
let r = e.defaultView;
|
|
@@ -2273,7 +2277,7 @@ var ca = class extends cr {
|
|
|
2273
2277
|
e.position.fromArray(i.position), e.quaternion.fromArray(i.quaternion), e.scale.fromArray(i.scale), e.fov = i.fov, e.near = i.near, e.far = i.far, this._setView(i.orthographic, i.orthoHalfHeight), e.zoom = i.zoom ?? 1, e.updateProjectionMatrix(), e.updateMatrixWorld(!0), this.controls.target.fromArray(i.target), this.controls.update();
|
|
2274
2278
|
}
|
|
2275
2279
|
return e.autoFocus && (this.setAutoFocusMode(e.autoFocus.mode), this.setAFScreenPoint(e.autoFocus.point.x, e.autoFocus.point.y)), this.resetAutoFocus(), this._reportOrthoHeight(), this.dispatchEvent({
|
|
2276
|
-
type:
|
|
2280
|
+
type: j.CAMERA_SWITCHED,
|
|
2277
2281
|
cameraIndex: this.currentCameraIndex,
|
|
2278
2282
|
effects: this._captureEffects(),
|
|
2279
2283
|
fov: this.camera.fov,
|
|
@@ -2330,7 +2334,7 @@ var ca = class extends cr {
|
|
|
2330
2334
|
a(p);
|
|
2331
2335
|
let e = n?.getSceneScale() || 1;
|
|
2332
2336
|
this.dispatchEvent({
|
|
2333
|
-
type:
|
|
2337
|
+
type: j.AUTO_FOCUS_UPDATED,
|
|
2334
2338
|
distance: p / e,
|
|
2335
2339
|
worldDistance: p
|
|
2336
2340
|
});
|
|
@@ -2534,7 +2538,7 @@ var La = class extends cr {
|
|
|
2534
2538
|
}
|
|
2535
2539
|
_changed(e) {
|
|
2536
2540
|
this.dispatchEvent({
|
|
2537
|
-
type:
|
|
2541
|
+
type: j.TIMELINE_CHANGED,
|
|
2538
2542
|
track: e
|
|
2539
2543
|
});
|
|
2540
2544
|
}
|
|
@@ -2570,7 +2574,7 @@ var La = class extends cr {
|
|
|
2570
2574
|
if (o.userData = o.userData || {}, t == null) delete o.userData.gobo;
|
|
2571
2575
|
else {
|
|
2572
2576
|
let e = this.entries.find((e) => e.name === t);
|
|
2573
|
-
if (!e) return this._issues?.record(
|
|
2577
|
+
if (!e) return this._issues?.record(Ze.ASSET_UNREACHABLE, `no gobo named "${t}" is loaded — the light projects without one`, {
|
|
2574
2578
|
name: t,
|
|
2575
2579
|
asset: "gobo"
|
|
2576
2580
|
}), !1;
|
|
@@ -2765,7 +2769,7 @@ var Xa = class {
|
|
|
2765
2769
|
grid: Ua(a, t, n)
|
|
2766
2770
|
};
|
|
2767
2771
|
} catch (t) {
|
|
2768
|
-
return this._issues?.warn(
|
|
2772
|
+
return this._issues?.warn(Ze.ASSET_UNREACHABLE, `IES profile "${e.name}" could not be loaded: ${t.message}`, {
|
|
2769
2773
|
url: e.url,
|
|
2770
2774
|
asset: "ies",
|
|
2771
2775
|
cause: t.message
|
|
@@ -2816,7 +2820,7 @@ var Xa = class {
|
|
|
2816
2820
|
if (t == null) delete i.userData.ies;
|
|
2817
2821
|
else {
|
|
2818
2822
|
let e = this.entries.find((e) => e.name === t);
|
|
2819
|
-
if (!e) return this._issues?.record(
|
|
2823
|
+
if (!e) return this._issues?.record(Ze.ASSET_UNREACHABLE, `no IES profile named "${t}" is loaded — the light keeps its plain distribution`, {
|
|
2820
2824
|
name: t,
|
|
2821
2825
|
asset: "ies"
|
|
2822
2826
|
}), a;
|
|
@@ -2851,7 +2855,7 @@ function Za(e) {
|
|
|
2851
2855
|
}
|
|
2852
2856
|
//#endregion
|
|
2853
2857
|
//#region src/Passes/OIDNDenoiser.js
|
|
2854
|
-
var Qa =
|
|
2858
|
+
var Qa = Ke("oidn"), $a = 16, eo = null;
|
|
2855
2859
|
async function to() {
|
|
2856
2860
|
return eo ||= (await import("oidn-web/dist/oidn.js")).initUNetFromBuffer, eo;
|
|
2857
2861
|
}
|
|
@@ -3084,7 +3088,7 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
|
|
|
3084
3088
|
return t || (t = m().fetch(e, { policy: C.IMMUTABLE }).then(({ file: e, release: t }) => e.arrayBuffer().finally(t)), t.catch(() => this._weights.delete(e)), this._weights.set(e, t)), t;
|
|
3085
3089
|
}
|
|
3086
3090
|
_generateTzaUrl() {
|
|
3087
|
-
let { oidnWeightsBaseUrl: e } =
|
|
3091
|
+
let { oidnWeightsBaseUrl: e } = at(), { QUALITY_MODELS: t } = no;
|
|
3088
3092
|
return `${e}${(t[this.quality] || t.balance).model}.tza`;
|
|
3089
3093
|
}
|
|
3090
3094
|
async updateConfiguration(e) {
|
|
@@ -3102,7 +3106,7 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
|
|
|
3102
3106
|
continuous: e
|
|
3103
3107
|
});
|
|
3104
3108
|
let t = performance.now(), n = await this.execute(e);
|
|
3105
|
-
return n && (this.renderer?.resetState?.(), this.lastDenoiseMs = performance.now() - t, Qa.debug(`denoise complete in ${
|
|
3109
|
+
return n && (this.renderer?.resetState?.(), this.lastDenoiseMs = performance.now() - t, Qa.debug(`denoise complete in ${We.ms(this.lastDenoiseMs)} · quality ${this.quality}`)), n;
|
|
3106
3110
|
}
|
|
3107
3111
|
async execute(e = !1) {
|
|
3108
3112
|
if (!this.enabled || !this.unet) return !1;
|
|
@@ -3410,7 +3414,7 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
|
|
|
3410
3414
|
format: "rgba16float",
|
|
3411
3415
|
usage: GPUTextureUsage.STORAGE_BINDING | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC
|
|
3412
3416
|
});
|
|
3413
|
-
let r = new
|
|
3417
|
+
let r = new vn(this._outGPUTexture);
|
|
3414
3418
|
r.name = "oidn:output", r.image = {
|
|
3415
3419
|
width: t,
|
|
3416
3420
|
height: n,
|
|
@@ -4028,7 +4032,7 @@ var Io = {
|
|
|
4028
4032
|
}
|
|
4029
4033
|
};
|
|
4030
4034
|
function Lo() {
|
|
4031
|
-
let { upscalerModelBaseUrl: e } =
|
|
4035
|
+
let { upscalerModelBaseUrl: e } = at(), t = {};
|
|
4032
4036
|
for (let n in Io) {
|
|
4033
4037
|
t[n] = {};
|
|
4034
4038
|
for (let r in Io[n]) t[n][r] = e + Io[n][r];
|
|
@@ -4071,7 +4075,7 @@ var Ro = {
|
|
|
4071
4075
|
this._worker ||= new Fo(), await new Promise((e, n) => {
|
|
4072
4076
|
let r = (t) => {
|
|
4073
4077
|
t.data.type === "loaded" ? (this._worker.removeEventListener("message", r), t.data.tileSize && !this._tileSizeOverride && (this.tileSize = t.data.tileSize), console.log(`AI Upscaler: ${this.scaleFactor}x model loaded, backend: ${t.data.backend}, tileSize: ${this.tileSize}`), e()) : t.data.type === "error" && (this._worker.removeEventListener("message", r), n(Error(t.data.message)));
|
|
4074
|
-
}, { ortRuntimeUrl: i, ortWasmPaths: a, cacheNamespace: o, storage: s } =
|
|
4078
|
+
}, { ortRuntimeUrl: i, ortWasmPaths: a, cacheNamespace: o, storage: s } = at();
|
|
4075
4079
|
this._worker.addEventListener("message", r), this._worker.postMessage({
|
|
4076
4080
|
type: "load",
|
|
4077
4081
|
url: t,
|
|
@@ -4191,7 +4195,7 @@ var Ro = {
|
|
|
4191
4195
|
let e = this.getGPUTextures();
|
|
4192
4196
|
if (!e?.color) throw Error("No GPU color texture available for HDR capture");
|
|
4193
4197
|
let t = e.color, { width: n, height: r } = t;
|
|
4194
|
-
this._toneMapper ??= new
|
|
4198
|
+
this._toneMapper ??= new Et(this.renderer.backend.device, "aiupscaler-tonemap", {
|
|
4195
4199
|
input: "texture",
|
|
4196
4200
|
output: "planar"
|
|
4197
4201
|
}), this._toneMapper.ensureSize(n, r);
|
|
@@ -4315,7 +4319,7 @@ var Ro = {
|
|
|
4315
4319
|
async dispose() {
|
|
4316
4320
|
this.abort(), this._cleanupPendingWorkerHandlers(), this._worker &&= (this._worker.postMessage({ type: "dispose" }), this._worker.terminate(), null), this._currentModelUrl = null, this._backupCanvas = null, this._upscaledAlpha = null, this.state.abortController = null, this._toneMapper?.dispose(), this._toneMapper = null, console.log("AIUpscaler disposed");
|
|
4317
4321
|
}
|
|
4318
|
-
}, Bo =
|
|
4322
|
+
}, Bo = Ke("neural"), Vo = 120, Ho = 2, Uo = 1, Wo = 0, Go = 300, Ko = 5, qo = 3, Jo = 3, Yo = 16, Xo = (e) => Math.max(0, 1 - e / Yo), Zo = class extends cr {
|
|
4319
4323
|
constructor({ renderer: e, mainCanvas: t, stages: n, pipeline: r, getExposure: i, getSaturation: a, issues: o = null }) {
|
|
4320
4324
|
super(), this.renderer = e, this._issues = o, this.mainCanvas = t, this.upscalerCanvas = this._createUpscalerCanvas(t), this.pipeline = r, this._stages = n, this._getExposure = i, this._getSaturation = a, this.denoiser = null, this.upscaler = null, this.upscalerBackend = "esrgan", this._neuralUpscaler = null, this.neuralRendering = !1, this.neuralRenderingSettings = {}, this._retouch = null, this._superResModule = null, this._neuralPostBusy = !1, this._finalQuality = Yr.oidnQuality, this.finalDenoise = Yr.enableOIDN, this.continuousDenoise = Yr.continuousDenoise, this.continuousDenoiseInterval = Yr.continuousDenoiseInterval, this._lastCadenceAt = -Infinity, this._lastCadenceSamples = 0, this._failedRefreshes = 0, this._cadenceSuspended = !1, this._movingDenoiseMs = [], this._movingHopeless = !1, this._holdWhileMoving = null, this._onReset = null, this._onPostProcessRefresh = null, this._onDisplayRefresh = null, this.temporalHistory = Yr.oidnTemporalHistory, this._history = null, this._historyDirty = !0, this._knownResetCount = 0, this._seenTracedFrames = 0, this._viewProj = new hr(), this._historyCamera = {
|
|
4321
4325
|
world: null,
|
|
@@ -4338,7 +4342,7 @@ var Ro = {
|
|
|
4338
4342
|
return (this.denoiser?.gpuBytes?.() ?? 0) + (this._history?.gpuBytes?.() ?? 0);
|
|
4339
4343
|
}
|
|
4340
4344
|
_recordNoOverlayCanvas(e) {
|
|
4341
|
-
this._issues?.record(
|
|
4345
|
+
this._issues?.record(Ze.DENOISER_UNAVAILABLE, `the ${e} pass needs the render canvas to be in a document, and it is not — skipped`, { pass: e });
|
|
4342
4346
|
}
|
|
4343
4347
|
setRenderSize(e, t) {
|
|
4344
4348
|
this._lastRenderWidth = e, this._lastRenderHeight = t, this._cadenceDowngraded = !1, this._holdWhileMoving = null, this._movingDenoiseMs.length = 0, this._movingHopeless = !1, this._historyDirty = !0, this.denoiser?.abort(), this._unpublishOutput(), this.denoiser?.setSize(e, t), this.upscalerCanvas && (this.upscalerCanvas.width !== e || this.upscalerCanvas.height !== t) && (this.upscalerCanvas.width = e, this.upscalerCanvas.height = t), this.upscaler?.setBaseSize(e, t), this._syncGBufferStages();
|
|
@@ -4367,11 +4371,11 @@ var Ro = {
|
|
|
4367
4371
|
};
|
|
4368
4372
|
}
|
|
4369
4373
|
}), this._syncOIDNInUse(), this._denoiserStartHandler = (e) => this.dispatchEvent({
|
|
4370
|
-
type:
|
|
4374
|
+
type: j.DENOISING_START,
|
|
4371
4375
|
continuous: !!e.continuous
|
|
4372
4376
|
}), this._denoiserEndHandler = (e) => {
|
|
4373
4377
|
this.denoiser?.hasOutput && this._publishOutput(), this.dispatchEvent({
|
|
4374
|
-
type:
|
|
4378
|
+
type: j.DENOISING_END,
|
|
4375
4379
|
continuous: !!e.continuous
|
|
4376
4380
|
});
|
|
4377
4381
|
}, this._denoiserTileHandler = (e) => {
|
|
@@ -4379,7 +4383,7 @@ var Ro = {
|
|
|
4379
4383
|
this._publishOutput();
|
|
4380
4384
|
let t = this.pipeline?.context;
|
|
4381
4385
|
this._stages.compositor && t && this._stages.compositor.render(t);
|
|
4382
|
-
}, this._denoiserErrorHandler = (e) => e.url && this._issues?.record(
|
|
4386
|
+
}, this._denoiserErrorHandler = (e) => e.url && this._issues?.record(Ze.ASSET_UNREACHABLE, `denoiser weights "${e.url}" could not be loaded — the render is not denoised`, {
|
|
4383
4387
|
url: e.url,
|
|
4384
4388
|
asset: "oidn-weights",
|
|
4385
4389
|
cause: String(e.error?.message ?? e.error)
|
|
@@ -4405,13 +4409,13 @@ var Ro = {
|
|
|
4405
4409
|
getToneMapping: () => this._getToneMapping(),
|
|
4406
4410
|
getSaturation: () => this._getSaturation()
|
|
4407
4411
|
}), this.upscaler.enabled = Yr.enableUpscaler || !1, this._upscalerResChangedHandler = (e) => this.dispatchEvent({
|
|
4408
|
-
type:
|
|
4412
|
+
type: j.RESOLUTION_CHANGED,
|
|
4409
4413
|
width: e.width,
|
|
4410
4414
|
height: e.height
|
|
4411
|
-
}), this._upscalerStartHandler = () => this.dispatchEvent({ type:
|
|
4412
|
-
type:
|
|
4415
|
+
}), this._upscalerStartHandler = () => this.dispatchEvent({ type: j.UPSCALING_START }), this._upscalerProgressHandler = (e) => this.dispatchEvent({
|
|
4416
|
+
type: j.UPSCALING_PROGRESS,
|
|
4413
4417
|
progress: e.progress
|
|
4414
|
-
}), this._upscalerEndHandler = () => this.dispatchEvent({ type:
|
|
4418
|
+
}), this._upscalerEndHandler = () => this.dispatchEvent({ type: j.UPSCALING_END }), this.upscaler.addEventListener("resolution_changed", this._upscalerResChangedHandler), this.upscaler.addEventListener("start", this._upscalerStartHandler), this.upscaler.addEventListener("progress", this._upscalerProgressHandler), this.upscaler.addEventListener("end", this._upscalerEndHandler);
|
|
4415
4419
|
}
|
|
4416
4420
|
get denoiserStrategy() {
|
|
4417
4421
|
return this.continuousDenoise ? "oidn" : this._stages.asvgf?.enabled ? "asvgf" : this._stages.nrd?.enabled ? "nrd" : this._stages.edgeFilter?.enabled ? "edgeaware" : "none";
|
|
@@ -4560,11 +4564,10 @@ var Ro = {
|
|
|
4560
4564
|
let n = this._ensureHistory();
|
|
4561
4565
|
this._historyDirty && n.invalidate(), n.accumulate(t, this._historyCameraNow(), this._takeMovedPlacements()), this._historyDirty = !1;
|
|
4562
4566
|
}
|
|
4563
|
-
notePlacementMoving(e, t
|
|
4567
|
+
notePlacementMoving(e, t) {
|
|
4564
4568
|
e < 0 || !this.historyActive || this._movedPlacements.has(e) || this._movedPlacements.set(e, {
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
prev: t.slice(n, n + 16)
|
|
4569
|
+
matrixOf: t,
|
|
4570
|
+
prev: t().slice()
|
|
4568
4571
|
});
|
|
4569
4572
|
}
|
|
4570
4573
|
_takeMovedPlacements() {
|
|
@@ -4573,8 +4576,8 @@ var Ro = {
|
|
|
4573
4576
|
t.leaves.length < e.size && (t.leaves = new Uint32Array(e.size * 2), t.toPrev = new Float32Array(e.size * 32));
|
|
4574
4577
|
let n = [...e.keys()].sort((e, t) => e - t);
|
|
4575
4578
|
for (let r = 0; r < n.length; r++) {
|
|
4576
|
-
let {
|
|
4577
|
-
this._matB.fromArray(i
|
|
4579
|
+
let { matrixOf: i, prev: a } = e.get(n[r]);
|
|
4580
|
+
this._matB.fromArray(i()).invert(), this._matA.fromArray(a).multiply(this._matB).toArray(t.toPrev, r * 16), t.leaves[r] = n[r];
|
|
4578
4581
|
}
|
|
4579
4582
|
return e.clear(), t;
|
|
4580
4583
|
}
|
|
@@ -4621,7 +4624,7 @@ var Ro = {
|
|
|
4621
4624
|
_restoreRenderDisplay() {
|
|
4622
4625
|
let e = this.upscalerCanvas && this.upscalerCanvas.style.display !== "none";
|
|
4623
4626
|
return this.upscalerCanvas && (this.upscalerCanvas.style.display = "none"), this.mainCanvas && (this.mainCanvas.style.opacity = "1"), e && this._lastRenderWidth && this._lastRenderHeight && this.dispatchEvent({
|
|
4624
|
-
type:
|
|
4627
|
+
type: j.RESOLUTION_CHANGED,
|
|
4625
4628
|
width: this._lastRenderWidth,
|
|
4626
4629
|
height: this._lastRenderHeight
|
|
4627
4630
|
}), !!e;
|
|
@@ -4649,11 +4652,11 @@ var Ro = {
|
|
|
4649
4652
|
Bo.warn("neural pass skipped: no denoised picture — it needs OIDN");
|
|
4650
4653
|
return;
|
|
4651
4654
|
}
|
|
4652
|
-
this._neuralPostBusy = !0, this.dispatchEvent({ type:
|
|
4655
|
+
this._neuralPostBusy = !0, this.dispatchEvent({ type: j.UPSCALING_START });
|
|
4653
4656
|
try {
|
|
4654
|
-
let r = await import("./NeuralSuperRes-
|
|
4657
|
+
let r = await import("./NeuralSuperRes-CZNQP13W.js").then((e) => e.t);
|
|
4655
4658
|
this._superResModule = r;
|
|
4656
|
-
let i = n ? await import("./NeuralRetouch-
|
|
4659
|
+
let i = n ? await import("./NeuralRetouch-DiBH63kz.js").then((e) => e.t) : null, a = this.denoiser?._outTexSize, o = (a?.width ?? 0) * (a?.height ?? 0), s = n && o <= i.RETOUCH_MAX_PIXELS;
|
|
4657
4660
|
if (n && !s && (Bo.warn(`Neural rendering skipped: the render is ${(o / 1e6).toFixed(1)} MP, above the ${(i.RETOUCH_MAX_PIXELS / 1e6).toFixed(1)} MP the pass survives.` + (t ? " The upscale still ran." : "")), this._releaseNeuralRetouch()), !t && !s) return;
|
|
4658
4661
|
let c = {
|
|
4659
4662
|
exposure: this._getEffectiveExposure(),
|
|
@@ -4684,14 +4687,14 @@ var Ro = {
|
|
|
4684
4687
|
return;
|
|
4685
4688
|
}
|
|
4686
4689
|
this.mainCanvas && (this.mainCanvas.style.opacity = "0"), this.dispatchEvent({
|
|
4687
|
-
type:
|
|
4690
|
+
type: j.RESOLUTION_CHANGED,
|
|
4688
4691
|
width: u.width,
|
|
4689
4692
|
height: u.height
|
|
4690
4693
|
});
|
|
4691
4694
|
} catch (e) {
|
|
4692
4695
|
Bo.warn("neural pass failed", e);
|
|
4693
4696
|
} finally {
|
|
4694
|
-
this._neuralPostBusy = !1, this.dispatchEvent({ type:
|
|
4697
|
+
this._neuralPostBusy = !1, this.dispatchEvent({ type: j.UPSCALING_END });
|
|
4695
4698
|
}
|
|
4696
4699
|
}
|
|
4697
4700
|
}
|
|
@@ -4886,11 +4889,11 @@ var Ro = {
|
|
|
4886
4889
|
_build(e) {
|
|
4887
4890
|
this._orthographic = this._camera.isOrthographicCamera === !0, this._outlineNode = Lr(this._scene, this._camera, {
|
|
4888
4891
|
selectedObjects: e,
|
|
4889
|
-
edgeThickness:
|
|
4890
|
-
edgeGlow:
|
|
4892
|
+
edgeThickness: K(1),
|
|
4893
|
+
edgeGlow: K(0)
|
|
4891
4894
|
});
|
|
4892
|
-
let t =
|
|
4893
|
-
this._material = new
|
|
4895
|
+
let t = K(3), n = K(new rr(16777215)), r = K(new rr(1640965)), { visibleEdge: i, hiddenEdge: a } = this._outlineNode, o = i.mul(n).add(a.mul(r)).mul(t), s = o.r.max(o.g).max(o.b).clamp(0, 1);
|
|
4896
|
+
this._material = new yn(), this._material.colorNode = J(o, s), this._material.transparent = !0, this._material.blending = ar, this._material.blendEquation = Qn, this._material.blendSrc = br, this._material.blendDst = br, this._material.blendEquationAlpha = Qn, this._material.blendSrcAlpha = br, this._material.blendDstAlpha = br, this._material.toneMapped = !1, this._material.depthTest = !1, this._material.depthWrite = !1, this._quad = new bn(this._material);
|
|
4894
4897
|
}
|
|
4895
4898
|
setSelectedObjects(e) {
|
|
4896
4899
|
this._outlineNode.selectedObjects = e;
|
|
@@ -4938,7 +4941,7 @@ var ns = 4096, rs = class {
|
|
|
4938
4941
|
}
|
|
4939
4942
|
async init({ device: e, sizeSource: t }) {
|
|
4940
4943
|
this._sizeSource = t;
|
|
4941
|
-
let n = e.onuncapturederror, r = new
|
|
4944
|
+
let n = e.onuncapturederror, r = new Cn({
|
|
4942
4945
|
canvas: this.canvas,
|
|
4943
4946
|
device: e,
|
|
4944
4947
|
alpha: !0,
|
|
@@ -4963,7 +4966,7 @@ var ns = 4096, rs = class {
|
|
|
4963
4966
|
dispose() {
|
|
4964
4967
|
Pe(this.renderer), this.renderer = null, this.canvas.parentElement?.removeChild(this.canvas);
|
|
4965
4968
|
}
|
|
4966
|
-
}, is =
|
|
4969
|
+
}, is = Ke("overlay"), as = (e, t) => e.visible && e.layer === t && e.render, os = class {
|
|
4967
4970
|
constructor(e) {
|
|
4968
4971
|
this.camera = e, this._helpers = /* @__PURE__ */ new Map(), this._hudCanvas = es(), this._hudCtx = this._hudCanvas.getContext("2d"), this._helperScene = null, this._viewOverlay = null;
|
|
4969
4972
|
}
|
|
@@ -4995,7 +4998,7 @@ var ns = 4096, rs = class {
|
|
|
4995
4998
|
setupDefaultHelpers({ helperScene: e, meshScene: t, pipeline: n, denoisingManager: r, app: i, renderWidth: a, renderHeight: o }) {
|
|
4996
4999
|
this.setHelperScene(e);
|
|
4997
5000
|
let s = new Qo();
|
|
4998
|
-
this.register("tiles", s), s.setRenderSize(a || 1, o || 1), i.addEventListener(
|
|
5001
|
+
this.register("tiles", s), s.setRenderSize(a || 1, o || 1), i.addEventListener(j.RESOLUTION_CHANGED, (e) => {
|
|
4999
5002
|
s.setRenderSize(e.width, e.height);
|
|
5000
5003
|
}), n.eventBus.on("pipeline:reset", () => s.hide()), this._wireDenoiserTileEvents(s, r);
|
|
5001
5004
|
let c = new $o(t, this.camera);
|
|
@@ -5197,17 +5200,17 @@ var cs = class extends cr {
|
|
|
5197
5200
|
if (!(!this.mixer || this.actions.length === 0)) {
|
|
5198
5201
|
if (this.mixer.stopAllAction(), e === -1) for (let e of this.actions) e.play();
|
|
5199
5202
|
else e >= 0 && e < this.actions.length && this.actions[e].play();
|
|
5200
|
-
this._activeClip = e, this.timer.reset(), this.isPlaying = !0, this.wakeCallback?.(), this.dispatchEvent({ type:
|
|
5203
|
+
this._activeClip = e, this.timer.reset(), this.isPlaying = !0, this.wakeCallback?.(), this.dispatchEvent({ type: j.ANIMATION_STARTED });
|
|
5201
5204
|
}
|
|
5202
5205
|
}
|
|
5203
5206
|
pause() {
|
|
5204
|
-
this.mixer && (this.mixer.timeScale = 0, this.timer.reset(), this.isPlaying = !1, this.dispatchEvent({ type:
|
|
5207
|
+
this.mixer && (this.mixer.timeScale = 0, this.timer.reset(), this.isPlaying = !1, this.dispatchEvent({ type: j.ANIMATION_PAUSED }));
|
|
5205
5208
|
}
|
|
5206
5209
|
resume() {
|
|
5207
|
-
this.mixer && (this.mixer.timeScale = this._savedTimeScale || 1, this.timer.reset(), this.isPlaying = !0, this.wakeCallback?.(), this.dispatchEvent({ type:
|
|
5210
|
+
this.mixer && (this.mixer.timeScale = this._savedTimeScale || 1, this.timer.reset(), this.isPlaying = !0, this.wakeCallback?.(), this.dispatchEvent({ type: j.ANIMATION_STARTED }));
|
|
5208
5211
|
}
|
|
5209
5212
|
stop() {
|
|
5210
|
-
this.mixer && (this.mixer.stopAllAction(), this.mixer.timeScale = this._savedTimeScale || 1, this.timer.reset(), this.isPlaying = !1, this._rigid && (this._mixerRoot.updateMatrixWorld(!0), this._applyRigidPose(-1)), this.dispatchEvent({ type:
|
|
5213
|
+
this.mixer && (this.mixer.stopAllAction(), this.mixer.timeScale = this._savedTimeScale || 1, this.timer.reset(), this.isPlaying = !1, this._rigid && (this._mixerRoot.updateMatrixWorld(!0), this._applyRigidPose(-1)), this.dispatchEvent({ type: j.ANIMATION_STOPPED }));
|
|
5211
5214
|
}
|
|
5212
5215
|
setSpeed(e) {
|
|
5213
5216
|
this._savedTimeScale = e, this.mixer && this.isPlaying && (this.mixer.timeScale = e);
|
|
@@ -5319,7 +5322,7 @@ var cs = class extends cr {
|
|
|
5319
5322
|
}
|
|
5320
5323
|
setMode(e) {
|
|
5321
5324
|
this._controls.setMode(e), this._app?.dispatchEvent({
|
|
5322
|
-
type:
|
|
5325
|
+
type: j.TRANSFORM_MODE_CHANGED,
|
|
5323
5326
|
mode: e
|
|
5324
5327
|
}), this._app?.refreshFrame();
|
|
5325
5328
|
}
|
|
@@ -5341,7 +5344,7 @@ var cs = class extends cr {
|
|
|
5341
5344
|
e.autoClear = !1, e.clearDepth(), e.setRenderTarget(null), e.render(this._gizmoScene, this._camera), e.autoClear = t;
|
|
5342
5345
|
}
|
|
5343
5346
|
_onDraggingChanged(e) {
|
|
5344
|
-
this._isDragging = e.value, this._orbitControls && (this._orbitControls.enabled = !e.value), e.value ? this._app.dispatchEvent({ type:
|
|
5347
|
+
this._isDragging = e.value, this._orbitControls && (this._orbitControls.enabled = !e.value), e.value ? this._app.dispatchEvent({ type: j.OBJECT_TRANSFORM_START }) : (this._attached?.isLight ? this._finalizeLightTransform() : this._recomputeAndRefit(), this._app.dispatchEvent({ type: j.OBJECT_TRANSFORM_END }));
|
|
5345
5348
|
}
|
|
5346
5349
|
_onObjectChange() {
|
|
5347
5350
|
this._app.needsReset = !0, this._app.wake(), this._attached?.isLight && this._syncLightDuringDrag();
|
|
@@ -5474,7 +5477,7 @@ function bs(e) {
|
|
|
5474
5477
|
e !== t && e.visible === !1 && r.push(hs(e, t));
|
|
5475
5478
|
}), {
|
|
5476
5479
|
v: 1,
|
|
5477
|
-
engine:
|
|
5480
|
+
engine: Be,
|
|
5478
5481
|
savedAt: Date.now(),
|
|
5479
5482
|
scene: _s(e),
|
|
5480
5483
|
appended: t.children.filter((t) => t !== e.sceneModel && t.userData?.__rayzeeSceneObject).map((e) => ({
|
|
@@ -5592,7 +5595,7 @@ async function ws(e, t, { resolve: n = async () => null } = {}) {
|
|
|
5592
5595
|
continue;
|
|
5593
5596
|
}
|
|
5594
5597
|
for (let [n, i] of Object.entries(r.props)) {
|
|
5595
|
-
let a =
|
|
5598
|
+
let a = me(i);
|
|
5596
5599
|
xs(t, n, a), e.setMaterialProperty(r.index, n, a);
|
|
5597
5600
|
}
|
|
5598
5601
|
}
|
|
@@ -5624,9 +5627,9 @@ async function ws(e, t, { resolve: n = async () => null } = {}) {
|
|
|
5624
5627
|
}
|
|
5625
5628
|
//#endregion
|
|
5626
5629
|
//#region src/PathTracerApp.js
|
|
5627
|
-
var Ts =
|
|
5630
|
+
var Ts = Ke("engine"), Es = class extends te {
|
|
5628
5631
|
constructor(e, t = {}) {
|
|
5629
|
-
super(e, t), this.setColorManagement(
|
|
5632
|
+
super(e, t), this.setColorManagement(Qt), this.setStorageOpener(ln), this.settings.define("interactionRenderScale", {
|
|
5630
5633
|
default: .5,
|
|
5631
5634
|
apply: () => {
|
|
5632
5635
|
this.stages?.pathTracer?.interactionMode && this._requestRenderScale(this._interactionRenderScale());
|
|
@@ -5641,7 +5644,7 @@ var Ts = qe("engine"), Es = class extends te {
|
|
|
5641
5644
|
}), this.cameraManager.camera;
|
|
5642
5645
|
}
|
|
5643
5646
|
_initAssetPipeline() {
|
|
5644
|
-
super._initAssetPipeline(), this.assetLoader.controls = this.cameraManager.controls, this.assetLoader.registerFormat(...
|
|
5647
|
+
super._initAssetPipeline(), this.assetLoader.controls = this.cameraManager.controls, this.assetLoader.registerFormat(...Dt), this.assetLoader.setArchiveImporterLoader(() => import("./ArchiveImporter-D735xX-4.js").then((e) => e.r).then((e) => new e.ArchiveImporter(this.assetLoader)), wt);
|
|
5645
5648
|
let e = () => {
|
|
5646
5649
|
this.needsReset = !0, this.stages.pathTracer?.enterInteractionMode(), this.wake();
|
|
5647
5650
|
};
|
|
@@ -5667,13 +5670,14 @@ var Ts = qe("engine"), Es = class extends te {
|
|
|
5667
5670
|
super._initPipeline(), this.pipeline.eventBus.on("pathtracer:interactionStart", () => this._requestRenderScale(this._interactionRenderScale())), this.pipeline.eventBus.on("pathtracer:interactionEnd", () => this._applyRenderScale(1));
|
|
5668
5671
|
}
|
|
5669
5672
|
async _initManagers() {
|
|
5670
|
-
await super._initManagers(), this.environmentManager.setProceduralSkyLoader(() => import("./PhysicalSky-
|
|
5673
|
+
await super._initManagers(), this.environmentManager.setProceduralSkyLoader(() => import("./PhysicalSky-DqmaS0lb.js").then((e) => e.n).then((e) => e.PhysicalSky)), this.stages.pathTracer.registerIntegrator(["bidirectional", "vcm"], (t) => new e(t)), this.stages.pathTracer.requestOutput("gBuffer"), this.interactionManager = new ca({
|
|
5671
5674
|
scene: this.meshScene,
|
|
5672
5675
|
camera: this.camera,
|
|
5673
5676
|
canvas: this.canvas,
|
|
5674
5677
|
assetLoader: this.assetLoader,
|
|
5675
5678
|
pathTracer: null,
|
|
5676
|
-
floorPlane: this.assetLoader.floorPlane
|
|
5679
|
+
floorPlane: this.assetLoader.floorPlane,
|
|
5680
|
+
isGeometryOnDisk: () => this.geometryOnDisk
|
|
5677
5681
|
}), this.interactionManager.wireAppEvents(this), this.cameraManager.setInteractionManager(this.interactionManager), this.goboManager = new Ra(this.stages.pathTracer, {
|
|
5678
5682
|
onReset: () => this.reset(),
|
|
5679
5683
|
issues: this._issues
|
|
@@ -5694,20 +5698,20 @@ var Ts = qe("engine"), Es = class extends te {
|
|
|
5694
5698
|
}), this.denoisingManager.setOverlayManager(this.overlayManager), this.denoisingManager.setResetCallback(() => this.reset()), this.denoisingManager.setPostProcessRefreshCallback(() => this.requestPostProcessRefresh()), this.denoisingManager.setDisplayRefreshCallback(() => this._presentDisplay()), this.denoisingManager.setSettings(this.settings);
|
|
5695
5699
|
}
|
|
5696
5700
|
_wireEvents() {
|
|
5697
|
-
this._addTrackedListener(this.cameraManager,
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5701
|
+
this._addTrackedListener(this.cameraManager, j.CAMERA_SWITCHED, (e) => this.dispatchEvent(e)), this._addTrackedListener(this.cameraManager, j.AUTO_FOCUS_UPDATED, (e) => this.dispatchEvent(e)), this._addTrackedListener(this.cameraManager, j.ORTHO_HEIGHT_UPDATED, (e) => this.dispatchEvent(e)), this._addTrackedListener(this.timeline, j.TIMELINE_CHANGED, (e) => this.dispatchEvent(e)), this._forwardEvents(this.denoisingManager, [
|
|
5702
|
+
j.DENOISING_START,
|
|
5703
|
+
j.DENOISING_END,
|
|
5704
|
+
j.UPSCALING_START,
|
|
5705
|
+
j.UPSCALING_PROGRESS,
|
|
5706
|
+
j.UPSCALING_END,
|
|
5707
|
+
j.RESOLUTION_CHANGED
|
|
5704
5708
|
]), this._setupAutoExposureListener(), this.animationManager.wakeCallback = () => this.wake(), this.animationManager.applyPoseCallback = (e) => this._applyAnimationPose(e), this._forwardEvents(this.animationManager, [
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
]), this._addTrackedListener(this.animationManager,
|
|
5709
|
+
j.ANIMATION_STARTED,
|
|
5710
|
+
j.ANIMATION_PAUSED,
|
|
5711
|
+
j.ANIMATION_STOPPED
|
|
5712
|
+
]), this._addTrackedListener(this.animationManager, j.ANIMATION_PAUSED, () => {
|
|
5709
5713
|
this._animRefitInFlight = !1, this._refreshMovedEmitters();
|
|
5710
|
-
}), this._addTrackedListener(this.animationManager,
|
|
5714
|
+
}), this._addTrackedListener(this.animationManager, j.ANIMATION_STOPPED, () => {
|
|
5711
5715
|
this._animRefitInFlight = !1;
|
|
5712
5716
|
}), this.cameraManager.initCallbacks({
|
|
5713
5717
|
onResize: () => this.onResize(),
|
|
@@ -5857,7 +5861,7 @@ var Ts = qe("engine"), Es = class extends te {
|
|
|
5857
5861
|
}
|
|
5858
5862
|
_dispatchCamerasUpdated() {
|
|
5859
5863
|
this.dispatchEvent({
|
|
5860
|
-
type:
|
|
5864
|
+
type: j.CAMERAS_UPDATED,
|
|
5861
5865
|
cameras: this.cameraManager.cameras,
|
|
5862
5866
|
cameraNames: this.cameraManager.getCameraNames()
|
|
5863
5867
|
});
|
|
@@ -5865,13 +5869,13 @@ var Ts = qe("engine"), Es = class extends te {
|
|
|
5865
5869
|
_applyAnimationPose({ meshIndices: e, visibilityChanged: t, cameras: n }) {
|
|
5866
5870
|
if (!this._sdf?.instanceTable) return;
|
|
5867
5871
|
let r = !1;
|
|
5868
|
-
e.length > 0 && (this._notePlacementsMoving(e), this._sdf.updateMeshTransforms(e), this.stages.pathTracer?.updateBufferRanges([],
|
|
5872
|
+
e.length > 0 && (this._notePlacementsMoving(e), this._sdf.updateMeshTransforms(e), this.stages.pathTracer?.updateBufferRanges([], this._sdf.takeMoveRanges()), this._sdf.movesEmitters(e) && (this._emittersMoved = !0, this.animationManager.isPlaying || this._refreshMovedEmitters()), r = !0), t && (this.stages.pathTracer?.updateAllMeshVisibility(), this._refreshEmissiveForVisibility(), r = !0), n.length > 0 && this._followAnimatedCamera(n) && (r = !0), r && this.reset(!1, { motion: !0 });
|
|
5869
5873
|
}
|
|
5870
5874
|
_notePlacementsMoving(e) {
|
|
5871
5875
|
let t = this.denoisingManager, n = this._sdf?.instanceTable;
|
|
5872
5876
|
if (!(!t?.historyActive || !n)) for (let r of e) {
|
|
5873
5877
|
let e = n.placementRunOf(r);
|
|
5874
|
-
if (e) for (let r = e.start; r < e.start + e.count; r++) t.notePlacementMoving(n.tlasLeafIndex[r], n.
|
|
5878
|
+
if (e) for (let r = e.start; r < e.start + e.count; r++) t.notePlacementMoving(n.tlasLeafIndex[r], () => n.matrixWorldOf(r));
|
|
5875
5879
|
}
|
|
5876
5880
|
}
|
|
5877
5881
|
_refreshMovedEmitters() {
|
|
@@ -5911,8 +5915,8 @@ var Ts = qe("engine"), Es = class extends te {
|
|
|
5911
5915
|
this._pendingRenderScale = null, !(this._disposed || e === this._renderScale) && (this._renderScale = e, !(!this._displayWidth || !this._displayHeight) && (this._setDisplaySize(this._displayWidth, this._displayHeight), this.pipeline?.setSize(this._scaled(this._displayWidth), this._scaled(this._displayHeight)), this.pipeline?.eventBus.emit("pipeline:historyReset"), this.needsReset = !0));
|
|
5912
5916
|
}
|
|
5913
5917
|
configureForMode(e, t = {}) {
|
|
5914
|
-
let n = e === "production", r = n ?
|
|
5915
|
-
this.denoisingManager?.setCadenceSuspended(n), this.timeline.stop(), this.cameraManager.controls.enabled = !n, this.settings.setMany(
|
|
5918
|
+
let n = e === "production", r = n ? De : Oe;
|
|
5919
|
+
this.denoisingManager?.setCadenceSuspended(n), this.timeline.stop(), this.cameraManager.controls.enabled = !n, this.settings.setMany(je(r), {
|
|
5916
5920
|
silent: !0,
|
|
5917
5921
|
source: x.MODE_PRESET
|
|
5918
5922
|
}), this.stages.pathTracer?.setUniform("renderMode", parseInt(r.renderMode)), n && this._applyRenderScale(1), this.stages.pathTracer?.updateCompletionThreshold?.();
|
|
@@ -5935,13 +5939,13 @@ var Ts = qe("engine"), Es = class extends te {
|
|
|
5935
5939
|
let e = this.denoisingManager;
|
|
5936
5940
|
if (await e?.denoiseOnce()) return !0;
|
|
5937
5941
|
let t = e?.denoiser ? e.denoiser.enabled ? "the denoise did not complete" : "OIDN was off while accumulating — call denoisingManager.setOIDNEnabled( true ) first" : "the denoiser was not built";
|
|
5938
|
-
return this._issues.record(
|
|
5942
|
+
return this._issues.record(Ze.DENOISER_UNAVAILABLE, `final denoise produced no picture: ${t}`, { reason: t }), !1;
|
|
5939
5943
|
}
|
|
5940
5944
|
_abortPostProcess({ keepDisplay: e = !1 } = {}) {
|
|
5941
5945
|
if (this.denoisingManager?.abort(this.canvas, { keepDisplay: e }), this.denoisingManager?.restoreBaseResolution()) {
|
|
5942
5946
|
let e = this.denoisingManager._lastRenderWidth, t = this.denoisingManager._lastRenderHeight;
|
|
5943
5947
|
this.dispatchEvent({
|
|
5944
|
-
type:
|
|
5948
|
+
type: j.RESOLUTION_CHANGED,
|
|
5945
5949
|
width: e,
|
|
5946
5950
|
height: t
|
|
5947
5951
|
});
|
|
@@ -5969,7 +5973,7 @@ var Ts = qe("engine"), Es = class extends te {
|
|
|
5969
5973
|
if (e.length > 0) {
|
|
5970
5974
|
let t = this.sceneModel || this.meshScene;
|
|
5971
5975
|
this.animationManager.init(this.meshScene, t, this._sdf.meshes, e), this.animationManager.onFinished = () => {
|
|
5972
|
-
this._animRefitInFlight = !1, this._refreshMovedEmitters(), this.dispatchEvent({ type:
|
|
5976
|
+
this._animRefitInFlight = !1, this._refreshMovedEmitters(), this.dispatchEvent({ type: j.ANIMATION_FINISHED });
|
|
5973
5977
|
};
|
|
5974
5978
|
}
|
|
5975
5979
|
this.transformManager?.setMeshData(this._sdf.meshes);
|
|
@@ -6001,7 +6005,7 @@ var Ts = qe("engine"), Es = class extends te {
|
|
|
6001
6005
|
_setupAutoExposureListener() {
|
|
6002
6006
|
this.stages.autoExposure && this.stages.autoExposure.on("autoexposure:updated", (e) => {
|
|
6003
6007
|
this.dispatchEvent({
|
|
6004
|
-
type:
|
|
6008
|
+
type: j.AUTO_EXPOSURE_UPDATED,
|
|
6005
6009
|
exposure: e.exposure,
|
|
6006
6010
|
luminance: e.luminance
|
|
6007
6011
|
});
|
|
@@ -6086,7 +6090,7 @@ var As = class {
|
|
|
6086
6090
|
this._app = e, this._cancelled = !1, this._rendering = !1;
|
|
6087
6091
|
}
|
|
6088
6092
|
async renderAnimation(e = {}) {
|
|
6089
|
-
let { clipIndex: t = 0, fps: n = 30, speed: r = 1, samplesPerFrame: i =
|
|
6093
|
+
let { clipIndex: t = 0, fps: n = 30, speed: r = 1, samplesPerFrame: i = De.maxSamples, enableOIDN: a = !0, timeline: o = null, startFrame: s = 0, onFrame: c, onProgress: l, onComplete: u } = e, d = this._app, f = d.animationManager?.hasAnimations ? d.animationManager.clips[t] : null;
|
|
6090
6094
|
if (!f && !o?.animates) {
|
|
6091
6095
|
console.warn(d.animationManager?.hasAnimations ? `VideoRenderManager: Invalid clip index ${t}` : "VideoRenderManager: No animation clips or keyframes"), u?.(!1);
|
|
6092
6096
|
return;
|
|
@@ -6114,7 +6118,7 @@ var As = class {
|
|
|
6114
6118
|
percent: (e + 1) / m * 100
|
|
6115
6119
|
};
|
|
6116
6120
|
l?.(u), d.dispatchEvent({
|
|
6117
|
-
type:
|
|
6121
|
+
type: j.VIDEO_RENDER_PROGRESS,
|
|
6118
6122
|
...u
|
|
6119
6123
|
});
|
|
6120
6124
|
}
|
|
@@ -6124,7 +6128,7 @@ var As = class {
|
|
|
6124
6128
|
this._restoreState(g), this._rendering = !1;
|
|
6125
6129
|
let e = !this._cancelled;
|
|
6126
6130
|
u?.(e), d.dispatchEvent({
|
|
6127
|
-
type:
|
|
6131
|
+
type: j.VIDEO_RENDER_COMPLETE,
|
|
6128
6132
|
success: e
|
|
6129
6133
|
});
|
|
6130
6134
|
}
|
|
@@ -6143,26 +6147,26 @@ var As = class {
|
|
|
6143
6147
|
await n;
|
|
6144
6148
|
continue;
|
|
6145
6149
|
}
|
|
6146
|
-
e.cameraManager.camera.updateMatrixWorld(), e.pipeline.render(), t.frameCount % 4 == 0 && (
|
|
6150
|
+
e.cameraManager.camera.updateMatrixWorld(), e.pipeline.render(), t.frameCount % 4 == 0 && (Le({ samples: Ve(t) }), await new Promise((e) => setTimeout(e, 0)));
|
|
6147
6151
|
}
|
|
6148
6152
|
}
|
|
6149
6153
|
_waitForDenoise(e) {
|
|
6150
6154
|
return new Promise((t) => {
|
|
6151
6155
|
let n, r = () => {
|
|
6152
|
-
e.removeEventListener(
|
|
6156
|
+
e.removeEventListener(j.DENOISING_END, i), clearTimeout(n);
|
|
6153
6157
|
}, i = () => {
|
|
6154
6158
|
r(), t();
|
|
6155
6159
|
};
|
|
6156
6160
|
n = setTimeout(() => {
|
|
6157
6161
|
console.warn("VideoRenderManager: Denoise timed out, skipping"), r(), t();
|
|
6158
|
-
}, 3e4), e.addEventListener(
|
|
6162
|
+
}, 3e4), e.addEventListener(j.DENOISING_END, i), e.denoisingManager.onRenderComplete({
|
|
6159
6163
|
isStillComplete: () => !this._cancelled,
|
|
6160
6164
|
context: e.pipeline?.context
|
|
6161
6165
|
});
|
|
6162
6166
|
});
|
|
6163
6167
|
}
|
|
6164
6168
|
_saveState({ view: e }) {
|
|
6165
|
-
let t = this._app, n = t.settings.getEffective(), r = Object.keys(
|
|
6169
|
+
let t = this._app, n = t.settings.getEffective(), r = Object.keys(je(De));
|
|
6166
6170
|
return e && r.push("focusDistance"), {
|
|
6167
6171
|
view: e ? t.cameraManager.captureView() : null,
|
|
6168
6172
|
settings: r.map((e) => [e, n[e]]),
|
|
@@ -6185,4 +6189,4 @@ var As = class {
|
|
|
6185
6189
|
}
|
|
6186
6190
|
};
|
|
6187
6191
|
//#endregion
|
|
6188
|
-
export {
|
|
6192
|
+
export { wt as ARCHIVE_FORMATS, Hr as ASVGF_QUALITY_PRESETS, Xi as AUTO_EXPOSURE_DEFAULTS, Ta as AUTO_FOCUS_DEFAULTS, cs as AnimationManager, Ye as BVH_LEAF_MARKERS, ja as CameraManager, Fa as CameraTrack, Qt as ColorManagement, Bt as DEFAULT_LUT_SIZE, Yt as DEFAULT_MAX_EV, Kt as DEFAULT_MIN_EV, _e as DEFAULT_SUN_PATH, gt as DEFAULT_VIEW, it as DEFAULT_WORKING_SPACE, Yr as DENOISER_DEFAULTS, C as DOWNLOAD_POLICY, Zo as DenoisingManager, f as DownloadCache, tt as ENGINE_AREAS, Ee as ENGINE_DEFAULTS, j as EngineEvents, $e as EngineIssueError, Ra as GoboManager, Xa as IESManager, Oe as INTERACTIVE_RENDER_CONFIG, Ze as ISSUE_CODES, Qe as ISSUE_SEVERITY, ca as InteractionManager, Xe as IssueLog, we as LEGACY_EVENT_NAMES, qe as LOG_LEVELS, ee as LightManager, Ge as Logger, ze as MATERIAL_DEFAULTS, Te as MATERIAL_VALUE_SOURCE, Se as MAX_RESERVABLE_RENDER_SIZE, Fe as MAX_SCENE_BYTES, mt as MAX_TABLE_TRANSFORMS, Me as MemoryLedger, Gr as NRD_DEFAULTS, Ur as NRD_HIT_DIST_A, Wr as NRD_HIT_DIST_B, Kr as NRD_PRESET_KEYS, qr as NRD_QUALITY_PRESETS, ut as OCIO_VIEW_BASE, os as OverlayManager, De as PRODUCTION_RENDER_CONFIG, Es as PathTracerApp, u as PipelineContext, gn as RETOUCH_DEFAULTS, _n as RETOUCH_MAX_PIXELS, hn as RETOUCH_RANGES, te as RayzeeRenderer, S as RenderPipeline, d as RenderSettings, E as RenderStage, Ne as SAFE_SCENE_BYTES, ps as SCENE_STATE_VERSION, x as SETTING_SOURCE, xe as SKY_DEFAULTS, pn as SR_MAX_INPUT, mn as SR_SCALE, et as STORAGE_KIND, ge as StageExecutionMode, cn as StorageManager, Je as TRIANGLE_DATA_LAYOUT, La as TimelineManager, ds as TransformManager, Be as VERSION, st as VIEW_TRANSFORMS, fe as VRAMTracker, As as VideoRenderManager, an as acquireLock, Ht as addAllOcioViews, Vt as addOcioView, ft as addViewTransform, nn as applyMatrixRGBA8, en as bakeLut, be as bufferBytes, Ft as buildOcioView, ht as buildToneMapWGSL, v as cachedObjectURL, qt as canvasColorSpaceFor, Os as captureHeadless, y as clearBindingAuditFindings, It as clearInputOverrides, ot as configureAssets, Ue as configurePlatform, Nt as convertColor, kt as convertEncodedRGBA8, tn as convertPixelsF32, Ke as createLogger, A as dayOfYearForMonth, ke as deriveAlphaMode, b as describeAdapter, Ot as displayCanvasFit, Re as estimateSceneBytes, Pt as extractMatrix, Tt as extractSceneMetadata, w as fetchFile, bt as fileIdentity, Xt as findNativeLinearSpace, We as fmt, xt as folderIdentity, me as fromPortable, rt as getActiveColorManagement, at as getAssetConfig, g as getBindingAuditFindings, He as getPlatform, dt as getRegistryVersion, _t as getViewTransform, jt as hasColorSpace, on as heldLockNames, yt as identityKey, Ut as isColorManaged, At as isDataSpace, Jt as isDataTexture, Mt as linearToSrgb, Zt as listFileRules, Rt as listInputOverrides, ct as listViewTransforms, St as localFolder, rn as makeCpuSampler, Lt as measureBakeError, p as nameFromUrl, pt as onRegistryChange, ks as openHeadless, sn as openStorage, dn as openZip, Ct as parseSceneMetadata, Ie as probeAddressSpace, un as readZipDirectory, lt as removeViewTransform, Ds as renderHeadless, fn as renderUpscaled, Gt as resolveInputSpace, vt as sameIdentity, nt as setActiveColorManagement, h as setBindingAudit, $t as setInputOverride, Wt as srgbToLinear, pe as sunPosition, ve as textureBytes, zt as textureInputSpace, ye as timeForSunElevation, de as toPortable };
|