rayzee 9.5.0 → 11.0.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 +22 -20
- package/dist/{ArchiveImporter-xuUJiklP.js → ArchiveImporter-BRQvLggb.js} +12 -13
- package/dist/{BidirectionalIntegrator-C5PKjJoT.js → BidirectionalIntegrator-9lZQxFVH.js} +87 -87
- package/dist/BufferLayout-D_IBo2ci.js +150 -0
- package/dist/{ColorManagement-CheBCPaW.js → ColorManagement-oeEk7oSu.js} +171 -171
- package/dist/{NeuralRetouch-CW11yLZ_.js → NeuralRetouch-BCXylThH.js} +3 -3
- package/dist/{NeuralSuperRes-BekaecYg.js → NeuralSuperRes-sZAeS142.js} +3 -3
- package/dist/{PathTracer-Ccl9KOuF.js → PathTracer-CQPW06Mm.js} +2911 -2669
- package/dist/{PhysicalSky-Dv2PMFGW.js → PhysicalSky-BvqCw_dy.js} +2 -2
- package/dist/{RayzeeRenderer-BQxnzCTD.js → RayzeeRenderer-COpwotpU.js} +338 -329
- package/dist/{SolarLimb-ken-JbDK.js → SolarLimb-CPaeZVwz.js} +10 -10
- package/dist/{ToneMapGPU-BHi5JzIq.js → ToneMapGPU-CjU3osDd.js} +1 -1
- package/dist/{ViewTransforms-D0rTLBsX.js → ViewTransforms-CYN7bq2w.js} +2 -2
- package/dist/addons/archives.es.js +1 -1
- package/dist/addons/bidirectional.es.js +1 -1
- package/dist/addons/color.es.js +1 -1
- package/dist/addons/physical-sky.es.js +1 -1
- package/dist/rayzee-core.es.js +11 -11
- package/dist/rayzee.es.js +734 -599
- package/dist/rayzee.umd.js +102 -102
- package/dist/sceneCachePolicy-BSSsKY98.js +443 -0
- package/package.json +1 -1
- package/src/Color/ViewTransforms.js +5 -1
- package/src/EngineDefaults.js +59 -1032
- package/src/Headless.js +6 -5
- package/src/Passes/OIDNTemporalHistory.js +1 -1
- package/src/PathTracerApp.js +5 -3
- package/src/Processor/AssetLoader.js +6 -5
- package/src/Processor/BVHBuilder.js +10 -31
- package/src/Processor/BVHLeafFold.js +4 -6
- package/src/Processor/BVHRefitter.js +3 -46
- package/src/Processor/BufferLayout.js +291 -0
- package/src/Processor/EmissiveTriangleBuilder.js +1 -1
- package/src/Processor/GeometryExtractor.js +3 -3
- package/src/Processor/HostMemory.js +7 -1
- package/src/Processor/InstanceTable.js +1 -1
- package/src/Processor/MaterialPacking.js +2 -1
- package/src/Processor/PBRT/PBRTSceneBuilder.js +1 -1
- package/src/Processor/QueueManager.js +28 -3
- package/src/Processor/SceneProcessor.js +4 -2
- package/src/Processor/SplitBLAS.js +1 -1
- package/src/Processor/StorageTexturePool.js +22 -1
- package/src/Processor/TLASBuilder.js +1 -3
- package/src/Processor/TextureBuckets.js +237 -0
- package/src/Processor/TextureCreator.js +10 -1
- package/src/Processor/Workers/TexturesWorker.js +5 -6
- package/src/RayzeeRenderer.js +29 -32
- package/src/RenderSettings.js +26 -28
- package/src/Stages/ASVGF.js +8 -7
- package/src/Stages/AutoExposure.js +14 -5
- package/src/Stages/BilateralFilter.js +2 -1
- package/src/Stages/DenoiserSettings.js +182 -0
- package/src/Stages/EdgeFilter.js +2 -1
- package/src/Stages/MotionVector.js +1 -1
- package/src/Stages/NRD.js +2 -3
- package/src/Stages/NormalDepth.js +3 -2
- package/src/Stages/PathTracer.js +72 -4
- package/src/Stages/PathTracerStage.js +2 -1
- package/src/Stages/Variance.js +1 -1
- package/src/TSL/BVHTraversal.js +4 -1
- package/src/TSL/Common.js +1 -1
- package/src/TSL/EmissiveSampling.js +1 -1
- package/src/TSL/LightVisibility.js +111 -0
- package/src/TSL/LightsSampling.js +151 -15
- package/src/TSL/Random.js +1 -1
- package/src/TSL/ShadeKernel.js +88 -3
- package/src/TSL/TextureSampling.js +1 -1
- package/src/core.js +5 -9
- package/src/index.js +10 -21
- package/src/integrators/BidirectionalIntegrator.js +2 -1
- package/src/managers/CameraManager.js +17 -7
- package/src/managers/DenoisingManager.js +14 -10
- package/src/managers/EnvironmentManager.js +32 -13
- package/src/managers/MaterialDataManager.js +3 -3
- package/src/managers/UniformManager.js +2 -2
- package/dist/EngineDefaults-DH3bI5t-.js +0 -844
- package/dist/sceneCachePolicy-BmwYOYDu.js +0 -183
- /package/dist/{Logger-BnHghprG.js → Logger-dDDGj9Av.js} +0 -0
package/dist/rayzee.es.js
CHANGED
|
@@ -1,56 +1,179 @@
|
|
|
1
|
-
import { t as e } from "./BidirectionalIntegrator-
|
|
2
|
-
import { $t as t, Ft as n, Jt as r, Pt as i, Qt as a, jt as o, rt as s, tn as c, wt as l } from "./SolarLimb-
|
|
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,
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { i as
|
|
10
|
-
import { i as
|
|
11
|
-
import { i as
|
|
12
|
-
import { n as
|
|
13
|
-
import { a as
|
|
14
|
-
import { i as
|
|
15
|
-
import { t as
|
|
16
|
-
import { n 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
|
|
25
|
-
import { ACESFilmicToneMapping as
|
|
26
|
-
import { OrbitControls as
|
|
27
|
-
import { outline as
|
|
28
|
-
import { TransformControls as
|
|
29
|
-
//#region src/Stages/
|
|
30
|
-
var
|
|
1
|
+
import { t as e } from "./BidirectionalIntegrator-9lZQxFVH.js";
|
|
2
|
+
import { $t as t, Ft as n, Jt as r, Pt as i, Qt as a, jt as o, rt as s, tn as c, wt as l } from "./SolarLimb-CPaeZVwz.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-COpwotpU.js";
|
|
4
|
+
import { $ as ne, At as re, B as T, Bt as E, Ct as ie, Dt as ae, Et as oe, H as se, It as D, K as ce, L as O, Lt as k, N as le, Ot as ue, P as de, Q as A, R as fe, Rt as pe, St as me, Tt as he, Vt as ge, X as _e, Z as ve, bt as ye, dt as be, et as xe, ft as Se, ht as Ce, kt as we, lt as Te, mt as Ee, nt as De, pt as Oe, tt as ke, ut as Ae, xt as je, yt as Me, z as Ne } from "./PathTracer-CQPW06Mm.js";
|
|
5
|
+
import { n as Pe, t as j } from "./EngineEvents-Ci8dVWCP.js";
|
|
6
|
+
import { E as Fe, T as Ie, a as Le, c as Re, f as ze, i as Be, j as Ve, p as He, r as Ue } from "./sceneCachePolicy-BSSsKY98.js";
|
|
7
|
+
import { i as We, n as Ge, r as Ke, t as qe } from "./Logger-dDDGj9Av.js";
|
|
8
|
+
import { n as Je, s as Ye } from "./BufferLayout-D_IBo2ci.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 { i as vt, n as yt, r as bt } from "./identity-DrQsGT2o.js";
|
|
15
|
+
import { t as xt } from "./ToneMapGPU-CjU3osDd.js";
|
|
16
|
+
import { n as St, r as Ct, t as wt } from "./archiveFormats-BZw7TiDp.js";
|
|
17
|
+
import { t as Tt } from "./FileFormats-sPGJeCRc.js";
|
|
18
|
+
import { A as Et, C as Dt, D as Ot, E as kt, O as At, S as jt, T as Mt, _ as Nt, a as Pt, b as Ft, c as It, d as Lt, f as Rt, g as zt, h as Bt, i as Vt, k as Ht, l as Ut, m as Wt, n as Gt, o as Kt, p as qt, r as Jt, s as Yt, t as Xt, u as Zt, v as Qt, w as $t, x as en, y as tn } from "./ColorManagement-oeEk7oSu.js";
|
|
19
|
+
import { c as nn, l as rn, n as an, o as on, t as sn } from "./openStorage-DwcBRUj7.js";
|
|
20
|
+
import { n as cn, t as ln } from "./ZipReader-gDSWr0I5.js";
|
|
21
|
+
import { i as un, n as dn, r as fn } from "./NeuralSuperRes-sZAeS142.js";
|
|
22
|
+
import { i as pn, n as mn, r as hn } from "./NeuralRetouch-BCXylThH.js";
|
|
23
|
+
import { ExternalTexture as gn, MeshBasicNodeMaterial as _n, QuadMesh as vn, ReadbackBuffer as yn, RenderTarget as bn, StorageTexture as M, TextureNode as N, WebGPURenderer as xn } from "three/webgpu";
|
|
24
|
+
import { Fn as Sn, If as P, Loop as Cn, Return as wn, abs as Tn, atan as En, atomicAdd as Dn, atomicLoad as On, atomicStore as kn, attributeArray as An, dot as jn, exp as Mn, exp2 as Nn, float as F, floor as Pn, fract as Fn, int as I, ivec2 as L, localId as R, max as z, min as In, mix as B, normalize as Ln, pow as Rn, round as zn, saturate as V, select as H, smoothstep as Bn, sqrt as Vn, storage as Hn, textureLoad as U, textureStore as W, uint as G, uniform as K, uvec2 as Un, uvec4 as Wn, vec2 as Gn, vec3 as q, vec4 as J, wgslFn as Kn, workgroupArray as qn, workgroupBarrier as Jn, workgroupId as Y } from "three/tsl";
|
|
25
|
+
import { ACESFilmicToneMapping as Yn, AddEquation as Xn, AnimationMixer as Zn, Box2 as Qn, Box3 as $n, ClampToEdgeWrapping as er, Color as tr, Controls as nr, CustomBlending as rr, DataArrayTexture as ir, DataTexture as ar, EventDispatcher as or, FloatType as sr, HalfFloatType as cr, InterpolateSmooth as lr, LinearFilter as X, LoopOnce as ur, LoopRepeat as dr, MathUtils as fr, Matrix4 as pr, Mesh as mr, MeshBasicMaterial as hr, NearestFilter as Z, NoColorSpace as gr, NumberKeyframeTrack as _r, OneFactor as vr, OrthographicCamera as yr, PerspectiveCamera as br, PropertyBinding as xr, Quaternion as Sr, RGBAFormat as Q, Raycaster as Cr, RedIntegerFormat as wr, SRGBColorSpace as Tr, Scene as Er, SphereGeometry as Dr, Timer as Or, UnsignedByteType as kr, UnsignedIntType as Ar, Vector2 as jr, Vector3 as $, Vector4 as Mr, VectorKeyframeTrack as Nr } from "three";
|
|
26
|
+
import { OrbitControls as Pr } from "three/addons/controls/OrbitControls.js";
|
|
27
|
+
import { outline as Fr } from "three/addons/tsl/display/OutlineNode.js";
|
|
28
|
+
import { TransformControls as Ir } from "three/addons/controls/TransformControls.js";
|
|
29
|
+
//#region src/Stages/DenoiserSettings.js
|
|
30
|
+
var Lr = 65504, Rr = 6e4, zr = .01, Br = {
|
|
31
|
+
low: {
|
|
32
|
+
temporalAlpha: .1,
|
|
33
|
+
gradientStrength: .8,
|
|
34
|
+
gradientSigmaScale: 2.5,
|
|
35
|
+
gradientNoiseFloor: .05,
|
|
36
|
+
atrousIterations: 3,
|
|
37
|
+
phiColor: 1,
|
|
38
|
+
phiNormal: 64,
|
|
39
|
+
phiDepth: .1,
|
|
40
|
+
phiLuminance: 6,
|
|
41
|
+
maxAccumFrames: 16,
|
|
42
|
+
varianceBoost: .5
|
|
43
|
+
},
|
|
44
|
+
medium: {
|
|
45
|
+
temporalAlpha: .03,
|
|
46
|
+
gradientStrength: 1,
|
|
47
|
+
gradientSigmaScale: 2.5,
|
|
48
|
+
gradientNoiseFloor: .05,
|
|
49
|
+
atrousIterations: 4,
|
|
50
|
+
phiColor: .5,
|
|
51
|
+
phiNormal: 128,
|
|
52
|
+
phiDepth: .05,
|
|
53
|
+
phiLuminance: 4,
|
|
54
|
+
maxAccumFrames: 64,
|
|
55
|
+
varianceBoost: 1
|
|
56
|
+
},
|
|
57
|
+
high: {
|
|
58
|
+
temporalAlpha: 0,
|
|
59
|
+
gradientStrength: 1,
|
|
60
|
+
gradientSigmaScale: 2.5,
|
|
61
|
+
gradientNoiseFloor: .05,
|
|
62
|
+
atrousIterations: 6,
|
|
63
|
+
phiColor: .3,
|
|
64
|
+
phiNormal: 256,
|
|
65
|
+
phiDepth: .02,
|
|
66
|
+
phiLuminance: 2,
|
|
67
|
+
maxAccumFrames: 128,
|
|
68
|
+
varianceBoost: 1.5
|
|
69
|
+
}
|
|
70
|
+
}, Vr = 3, Hr = .1, Ur = {
|
|
71
|
+
maxAccumulatedFrameNum: 30,
|
|
72
|
+
maxFastAccumulatedFrameNum: 6,
|
|
73
|
+
maxStabilizedFrameNum: 63,
|
|
74
|
+
historyFixFrameNum: 3,
|
|
75
|
+
historyFixBasePixelStride: 14,
|
|
76
|
+
prepassBlurRadius: 30,
|
|
77
|
+
minBlurRadius: 1,
|
|
78
|
+
maxBlurRadius: 30,
|
|
79
|
+
lobeAngleFraction: .15,
|
|
80
|
+
roughnessFraction: .15,
|
|
81
|
+
planeDistanceSensitivity: .02,
|
|
82
|
+
minHitDistanceWeight: .1,
|
|
83
|
+
fastHistoryClampingSigmaScale: 2,
|
|
84
|
+
fireflySuppressorMinRelativeScale: 2,
|
|
85
|
+
enableAntiFirefly: !0,
|
|
86
|
+
antilagLuminanceSigmaScale: 2,
|
|
87
|
+
antilagLuminanceSensitivity: 3,
|
|
88
|
+
disocclusionThreshold: .01,
|
|
89
|
+
convergenceS: 1,
|
|
90
|
+
convergenceB: .2,
|
|
91
|
+
convergenceP: .8,
|
|
92
|
+
lobeVolumePercent: .1,
|
|
93
|
+
handoverFrames: 0
|
|
94
|
+
}, Wr = [
|
|
95
|
+
"maxAccumulatedFrameNum",
|
|
96
|
+
"maxFastAccumulatedFrameNum",
|
|
97
|
+
"maxStabilizedFrameNum",
|
|
98
|
+
"historyFixFrameNum",
|
|
99
|
+
"prepassBlurRadius",
|
|
100
|
+
"maxBlurRadius",
|
|
101
|
+
"enableAntiFirefly"
|
|
102
|
+
], Gr = {
|
|
103
|
+
low: {
|
|
104
|
+
maxAccumulatedFrameNum: 16,
|
|
105
|
+
maxFastAccumulatedFrameNum: 4,
|
|
106
|
+
maxStabilizedFrameNum: 16,
|
|
107
|
+
historyFixFrameNum: 2,
|
|
108
|
+
prepassBlurRadius: 0,
|
|
109
|
+
maxBlurRadius: 20,
|
|
110
|
+
enableAntiFirefly: !1
|
|
111
|
+
},
|
|
112
|
+
medium: {},
|
|
113
|
+
high: {
|
|
114
|
+
maxAccumulatedFrameNum: 45,
|
|
115
|
+
maxFastAccumulatedFrameNum: 8,
|
|
116
|
+
historyFixFrameNum: 4,
|
|
117
|
+
prepassBlurRadius: 40,
|
|
118
|
+
maxBlurRadius: 40
|
|
119
|
+
}
|
|
120
|
+
}, Kr = Br.medium, qr = {
|
|
121
|
+
denoiserStrategy: "none",
|
|
122
|
+
filterStrength: 1,
|
|
123
|
+
edgeAtrousIterations: 5,
|
|
124
|
+
edgePhiLuminance: 4,
|
|
125
|
+
edgePhiNormal: 64,
|
|
126
|
+
edgePhiDepth: .1,
|
|
127
|
+
enableOIDN: !1,
|
|
128
|
+
oidnQuality: "fast",
|
|
129
|
+
continuousDenoise: !1,
|
|
130
|
+
continuousDenoiseInterval: 8,
|
|
131
|
+
oidnTemporalHistory: !0,
|
|
132
|
+
enableUpscaler: !1,
|
|
133
|
+
upscalerScale: 2,
|
|
134
|
+
upscalerQuality: "fast",
|
|
135
|
+
upscalerHdr: !0,
|
|
136
|
+
enableASVGF: !1,
|
|
137
|
+
asvgfQualityPreset: "medium",
|
|
138
|
+
asvgfTemporalAlpha: Kr.temporalAlpha,
|
|
139
|
+
asvgfAtrousIterations: Kr.atrousIterations,
|
|
140
|
+
asvgfPhiColor: Kr.phiColor,
|
|
141
|
+
asvgfPhiNormal: Kr.phiNormal,
|
|
142
|
+
asvgfPhiDepth: Kr.phiDepth,
|
|
143
|
+
asvgfPhiLuminance: Kr.phiLuminance,
|
|
144
|
+
asvgfVarianceBoost: Kr.varianceBoost,
|
|
145
|
+
asvgfMaxAccumFrames: Kr.maxAccumFrames,
|
|
146
|
+
asvgfGradientStrength: Kr.gradientStrength,
|
|
147
|
+
asvgfGradientSigmaScale: Kr.gradientSigmaScale,
|
|
148
|
+
asvgfGradientNoiseFloor: Kr.gradientNoiseFloor,
|
|
149
|
+
asvgfDebugMode: 0,
|
|
150
|
+
showAsvgfHeatmap: !1,
|
|
151
|
+
nrdQualityPreset: "medium",
|
|
152
|
+
nrdDebugMode: 0
|
|
153
|
+
}, Jr = class extends E {
|
|
31
154
|
constructor(e, t = {}) {
|
|
32
155
|
super("NormalDepth", {
|
|
33
156
|
...t,
|
|
34
|
-
executionMode:
|
|
35
|
-
}), 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 pr(), "mat4"), this.cameraProjectionMatrixInverse = K(new pr(), "mat4"), this.cameraRay = A(), this.resolutionWidth = K(t.width || 1), this.resolutionHeight = K(t.height || 1);
|
|
36
159
|
let n = t.width || 1, r = t.height || 1;
|
|
37
|
-
this._outputStorageTex = new
|
|
38
|
-
type:
|
|
160
|
+
this._outputStorageTex = new M(k, k), this._outputStorageTex.type = cr, this._outputStorageTex.format = Q, this._outputStorageTex.minFilter = Z, this._outputStorageTex.magFilter = Z, this._shadingStorageTex = new M(k, k), this._shadingStorageTex.type = cr, this._shadingStorageTex.format = Q, this._shadingStorageTex.minFilter = Z, this._shadingStorageTex.magFilter = Z, this._shadingRT = new bn(n, r, {
|
|
161
|
+
type: cr,
|
|
39
162
|
format: Q,
|
|
40
163
|
minFilter: Z,
|
|
41
164
|
magFilter: Z,
|
|
42
165
|
depthBuffer: !1,
|
|
43
166
|
stencilBuffer: !1
|
|
44
|
-
}), this._leafStorageTex = null, this._leafRT = null, this._srcRegion = new
|
|
167
|
+
}), this._leafStorageTex = null, this._leafRT = null, this._srcRegion = new Qn(new jr(0, 0), new jr(0, 0));
|
|
45
168
|
let i = {
|
|
46
|
-
type:
|
|
169
|
+
type: cr,
|
|
47
170
|
format: Q,
|
|
48
171
|
minFilter: Z,
|
|
49
172
|
magFilter: Z,
|
|
50
173
|
depthBuffer: !1,
|
|
51
174
|
stencilBuffer: !1
|
|
52
175
|
};
|
|
53
|
-
this._rtA = new
|
|
176
|
+
this._rtA = new bn(n, r, i), this._rtB = new bn(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;
|
|
54
177
|
}
|
|
55
178
|
setupEventListeners() {
|
|
56
179
|
this.on("camera:moved", () => {
|
|
@@ -64,37 +187,37 @@ var $r = class extends E {
|
|
|
64
187
|
if (!e) return !1;
|
|
65
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;
|
|
66
189
|
return (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), e.triangleGeoAttr && !this._triStorageNode && (this._triStorageNode = {
|
|
67
|
-
geo:
|
|
68
|
-
shade:
|
|
69
|
-
}), e.bvhStorageAttr && !this._bvhStorageNode && (this._bvhStorageNode =
|
|
190
|
+
geo: Hn(e.triangleGeoAttr, "uvec4", e.triangleGeoAttr.count).toReadOnly(),
|
|
191
|
+
shade: Hn(e.triangleShadeAttr, "uvec4", e.triangleShadeAttr.count).toReadOnly()
|
|
192
|
+
}), e.bvhStorageAttr && !this._bvhStorageNode && (this._bvhStorageNode = Hn(e.bvhStorageAttr, "vec4", e.bvhStorageAttr.count).toReadOnly()), t && !this._matStorageNode && (this._matStorageNode = Hn(t, "vec4", t.count).toReadOnly()), this._linearBuckets && T(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);
|
|
70
193
|
}
|
|
71
194
|
_buildCompute() {
|
|
72
195
|
let e = this._triStorageNode, n = this._bvhStorageNode, i = this._matStorageNode;
|
|
73
|
-
this._linearBuckets =
|
|
196
|
+
this._linearBuckets = le(this.pathTracer?.materialData?.linearBuckets);
|
|
74
197
|
let o = {
|
|
75
|
-
srgbBuckets:
|
|
198
|
+
srgbBuckets: le(null),
|
|
76
199
|
linearBuckets: this._linearBuckets,
|
|
77
200
|
shadowAlbedoMaps: null,
|
|
78
201
|
goboMaps: null,
|
|
79
202
|
iesProfiles: null,
|
|
80
203
|
alphaShadows: null
|
|
81
204
|
}, s = this.cameraWorldMatrix, u = this.cameraProjectionMatrixInverse, d = this.resolutionWidth, f = this.resolutionHeight, p = this._outputStorageTex, m = this._shadingStorageTex, h = this._leafStorageTex;
|
|
82
|
-
this._computeNode =
|
|
83
|
-
let u =
|
|
84
|
-
|
|
85
|
-
let _ = a(
|
|
86
|
-
|
|
87
|
-
let S = v.normal.toVar(), ee =
|
|
88
|
-
|
|
89
|
-
let r = t.wrap(l(v.materialIndex, i)).toVar(), a = c.wrap(
|
|
90
|
-
|
|
91
|
-
o.assign(
|
|
205
|
+
this._computeNode = Me(Sn(([o, s]) => {
|
|
206
|
+
let u = I(Y.x).mul(8).add(I(R.x)), g = I(Y.y).mul(8).add(I(R.y));
|
|
207
|
+
P(u.lessThan(I(d)).and(g.lessThan(I(f))), () => {
|
|
208
|
+
let _ = a(_e(Gn(F(u).add(.5).div(d), F(g).add(.5).div(f)), o, s, this.cameraRay)), v = r.wrap(ce(_, n, e)), y = v.normal.mul(.5).add(.5), b = In(v.dst, F(65504)), x = v.didHit.select(J(y, b), J(0, 0, 0, F(Lr)));
|
|
209
|
+
W(p, Un(G(u), G(g)), x).toWriteOnly(), h && W(h, Un(G(u), G(g)), Wn(G(v.instanceLeaf.add(1)), 0, 0, 0)).toWriteOnly();
|
|
210
|
+
let S = v.normal.toVar(), ee = F(1).toVar();
|
|
211
|
+
P(v.didHit, () => {
|
|
212
|
+
let r = t.wrap(l(v.materialIndex, i)).toVar(), a = c.wrap(de(v.uv, r)).toVar(), o = J(0).toVar();
|
|
213
|
+
P(r.normalMapIndex.greaterThanEqual(I(0)), () => {
|
|
214
|
+
o.assign(se(e, v.triangleIndex, v.normal, r.normalTransform, n, v.instanceLeaf));
|
|
92
215
|
});
|
|
93
|
-
let s =
|
|
94
|
-
S.assign(
|
|
216
|
+
let s = Ne(v.normal, r, a, o).toVar();
|
|
217
|
+
S.assign(O(s, r, a)), ee.assign(fe(r, a).y.clamp(.05, 1));
|
|
95
218
|
});
|
|
96
219
|
let C = v.didHit.select(J(S.mul(.5).add(.5), ee), J(0, 0, 0, 1));
|
|
97
|
-
|
|
220
|
+
W(m, Un(G(u), G(g)), C).toWriteOnly();
|
|
98
221
|
});
|
|
99
222
|
})(s, u), o).compute([
|
|
100
223
|
this._dispatchX,
|
|
@@ -140,15 +263,15 @@ var $r = class extends E {
|
|
|
140
263
|
reallocateReservedStorage() {
|
|
141
264
|
this._computeNode?.dispose(), this._computeNode = null, this._outputStorageTex?.dispose(), this._shadingStorageTex?.dispose();
|
|
142
265
|
let e = () => {
|
|
143
|
-
let e = new
|
|
144
|
-
return e.type =
|
|
266
|
+
let e = new M(k, k);
|
|
267
|
+
return e.type = cr, e.format = Q, e.minFilter = Z, e.magFilter = Z, e;
|
|
145
268
|
};
|
|
146
269
|
this._outputStorageTex = e(), this._shadingStorageTex = e(), this._leafStorageTex &&= (this._leafStorageTex.dispose(), this._makeLeafStorage()), this._computeBuilt = !1;
|
|
147
270
|
}
|
|
148
271
|
setInstanceLeafOutput(e) {
|
|
149
|
-
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
|
|
150
|
-
type:
|
|
151
|
-
format:
|
|
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 bn(this._rtA.width, this._rtA.height, {
|
|
273
|
+
type: Ar,
|
|
274
|
+
format: wr,
|
|
152
275
|
minFilter: Z,
|
|
153
276
|
magFilter: Z,
|
|
154
277
|
depthBuffer: !1,
|
|
@@ -159,40 +282,40 @@ var $r = class extends E {
|
|
|
159
282
|
this._leafRT ? e.setTexture("pathtracer:instanceLeaf", this._leafRT.texture) : e.getTexture("pathtracer:instanceLeaf") && e.removeTexture("pathtracer:instanceLeaf");
|
|
160
283
|
}
|
|
161
284
|
_makeLeafStorage() {
|
|
162
|
-
let e = new
|
|
163
|
-
return e.type =
|
|
285
|
+
let e = new M(k, k);
|
|
286
|
+
return e.type = Ar, e.format = wr, e.minFilter = Z, e.magFilter = Z, e;
|
|
164
287
|
}
|
|
165
288
|
dispose() {
|
|
166
289
|
this._computeNode?.dispose(), this._outputStorageTex?.dispose(), this._shadingStorageTex?.dispose(), this._shadingRT?.dispose(), this._leafStorageTex?.dispose(), this._leafRT?.dispose(), this._rtA?.dispose(), this._rtB?.dispose();
|
|
167
290
|
}
|
|
168
|
-
},
|
|
291
|
+
}, Yr = class extends E {
|
|
169
292
|
constructor(e, t, n = {}) {
|
|
170
293
|
super("MotionVector", {
|
|
171
294
|
...n,
|
|
172
|
-
executionMode:
|
|
295
|
+
executionMode: ge.ALWAYS
|
|
173
296
|
}), this.renderer = e, this.camera = t, this.pathTracer = n.pathTracer || null;
|
|
174
297
|
let r = n.width || 1, i = n.height || 1;
|
|
175
|
-
this.prevViewProjectionMatrix = new
|
|
298
|
+
this.prevViewProjectionMatrix = new pr(), this.currentViewProjectionMatrix = new pr(), this.matricesInitialized = !1, this.isFirstFrame = !0, this.frameCount = 0, this.cameraWorldMatrix = K(new pr(), "mat4"), this.cameraProjectionMatrixInverse = K(new pr(), "mat4"), this.cameraRay = A(), this.prevVP = K(new pr(), "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 = cr, this._screenSpaceStorageTex.format = Q, this._screenSpaceStorageTex.minFilter = Z, this._screenSpaceStorageTex.magFilter = Z, this._worldSpaceStorageTex = new M(k, k), this._worldSpaceStorageTex.type = cr, this._worldSpaceStorageTex.format = Q, this._worldSpaceStorageTex.minFilter = Z, this._worldSpaceStorageTex.magFilter = Z, this._srcRegion = new Qn(new jr(0, 0), new jr(0, 0));
|
|
176
299
|
let a = {
|
|
177
|
-
type:
|
|
300
|
+
type: cr,
|
|
178
301
|
format: Q,
|
|
179
302
|
minFilter: Z,
|
|
180
303
|
magFilter: Z,
|
|
181
304
|
depthBuffer: !1,
|
|
182
305
|
stencilBuffer: !1
|
|
183
306
|
};
|
|
184
|
-
this.screenSpaceTarget = new
|
|
307
|
+
this.screenSpaceTarget = new bn(r, i, a), this.worldSpaceTarget = new bn(r, i, a), this._dispatchX = Math.ceil(r / 16), this._dispatchY = Math.ceil(i / 16), this._buildScreenSpaceCompute(), this._buildWorldSpaceCompute();
|
|
185
308
|
}
|
|
186
309
|
_buildScreenSpaceCompute() {
|
|
187
310
|
let e = this._normalDepthTexNode, t = this.cameraWorldMatrix, n = this.cameraProjectionMatrixInverse, r = this.prevVP, i = this.resolutionWidth, a = this.resolutionHeight, o = this._screenSpaceStorageTex;
|
|
188
|
-
this._screenSpaceComputeNode =
|
|
189
|
-
let s =
|
|
190
|
-
|
|
191
|
-
let l =
|
|
192
|
-
|
|
193
|
-
let e =
|
|
194
|
-
d.assign(c.select(J(s, l, 1), J(
|
|
195
|
-
}),
|
|
311
|
+
this._screenSpaceComputeNode = Sn(([t, n]) => {
|
|
312
|
+
let s = I(Y.x).mul(16).add(I(R.x)), c = I(Y.y).mul(16).add(I(R.y));
|
|
313
|
+
P(s.lessThan(I(i)).and(c.lessThan(I(a))), () => {
|
|
314
|
+
let l = U(e, L(s, c)).w, u = Gn(F(s).add(.5).div(i), F(c).add(.5).div(a)), d = J(0, 0, l, 1).toVar();
|
|
315
|
+
P(l.lessThan(F(6e4)), () => {
|
|
316
|
+
let e = ve(u, l, t, n, this.cameraRay), i = r.mul(J(e, 1)), a = i.xy.div(i.w), o = Gn(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));
|
|
317
|
+
d.assign(c.select(J(s, l, 1), J(F(1e3), F(1e3), l, 0)));
|
|
318
|
+
}), W(o, Un(G(s), G(c)), d).toWriteOnly();
|
|
196
319
|
});
|
|
197
320
|
})(t, n).compute([
|
|
198
321
|
this._dispatchX,
|
|
@@ -206,14 +329,14 @@ var $r = class extends E {
|
|
|
206
329
|
}
|
|
207
330
|
_buildWorldSpaceCompute() {
|
|
208
331
|
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;
|
|
209
|
-
this._worldSpaceComputeNode =
|
|
210
|
-
let u =
|
|
211
|
-
|
|
212
|
-
let f =
|
|
213
|
-
|
|
214
|
-
let e =
|
|
332
|
+
this._worldSpaceComputeNode = Sn(([t, n]) => {
|
|
333
|
+
let u = I(Y.x).mul(16).add(I(R.x)), d = I(Y.y).mul(16).add(I(R.y));
|
|
334
|
+
P(u.lessThan(I(s)).and(d.lessThan(I(c))), () => {
|
|
335
|
+
let f = U(e, L(u, d)).w, p = J(0, 0, 0, 0).toVar();
|
|
336
|
+
P(i.lessThan(.5).and(f.lessThan(F(6e4))), () => {
|
|
337
|
+
let e = Gn(F(u).add(.5).div(s), F(d).add(.5).div(c)), i = ve(e, f, t, n, this.cameraRay), l = r.mul(J(i, 1)), m = l.xy.div(l.w), h = Gn(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);
|
|
215
338
|
p.assign(g.select(J(v, 1), J(0, 0, 0, .5)));
|
|
216
|
-
}),
|
|
339
|
+
}), W(l, Un(G(u), G(d)), p).toWriteOnly();
|
|
217
340
|
});
|
|
218
341
|
})(t, n).compute([
|
|
219
342
|
this._dispatchX,
|
|
@@ -277,83 +400,83 @@ var $r = class extends E {
|
|
|
277
400
|
reallocateReservedStorage() {
|
|
278
401
|
this._screenSpaceComputeNode?.dispose(), this._worldSpaceComputeNode?.dispose(), this._screenSpaceStorageTex?.dispose(), this._worldSpaceStorageTex?.dispose();
|
|
279
402
|
let e = () => {
|
|
280
|
-
let e = new
|
|
281
|
-
return e.type =
|
|
403
|
+
let e = new M(k, k);
|
|
404
|
+
return e.type = cr, e.format = Q, e.minFilter = Z, e.magFilter = Z, e;
|
|
282
405
|
};
|
|
283
406
|
this._screenSpaceStorageTex = e(), this._worldSpaceStorageTex = e(), this._buildScreenSpaceCompute(), this._buildWorldSpaceCompute();
|
|
284
407
|
}
|
|
285
408
|
dispose() {
|
|
286
409
|
this._screenSpaceComputeNode?.dispose(), this._worldSpaceComputeNode?.dispose(), this._screenSpaceStorageTex?.dispose(), this._worldSpaceStorageTex?.dispose(), this.screenSpaceTarget?.dispose(), this.worldSpaceTarget?.dispose(), this._normalDepthTexNode?.dispose();
|
|
287
410
|
}
|
|
288
|
-
},
|
|
411
|
+
}, Xr = (e) => H(e.equal(e), e, F(0)).clamp(0, 1e7), Zr = (e) => q(Xr(e.x), Xr(e.y), Xr(e.z)), Qr = class extends E {
|
|
289
412
|
constructor(e, t = {}) {
|
|
290
413
|
super("ASVGF", {
|
|
291
414
|
...t,
|
|
292
|
-
executionMode:
|
|
293
|
-
}), this.renderer = e, this.temporalAlpha =
|
|
415
|
+
executionMode: ge.PER_CYCLE
|
|
416
|
+
}), this.renderer = e, this.temporalAlpha = K(t.temporalAlpha ?? Br.medium.temporalAlpha), this.gradientStrength = K(t.gradientStrength ?? Br.medium.gradientStrength), this.gradientSigmaScale = K(t.gradientSigmaScale ?? Br.medium.gradientSigmaScale), this.gradientNoiseFloor = K(t.gradientNoiseFloor ?? Br.medium.gradientNoiseFloor), this.maxAccumFrames = K(t.maxAccumFrames ?? Br.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();
|
|
294
417
|
let n = t.width || 1, r = t.height || 1;
|
|
295
|
-
this._temporalTexA = new
|
|
296
|
-
type:
|
|
418
|
+
this._temporalTexA = new M(k, k), this._temporalTexA.type = sr, this._temporalTexA.format = Q, this._temporalTexA.minFilter = X, this._temporalTexA.magFilter = X, this._temporalTexB = new M(k, k), this._temporalTexB.type = sr, this._temporalTexB.format = Q, this._temporalTexB.minFilter = X, this._temporalTexB.magFilter = X, this._outputModulatedTex = new M(k, k), this._outputModulatedTex.type = sr, this._outputModulatedTex.format = Q, this._outputModulatedTex.minFilter = X, this._outputModulatedTex.magFilter = X, this._gradientStorageTex = new M(k, k), this._gradientStorageTex.type = cr, this._gradientStorageTex.format = Q, this._gradientStorageTex.minFilter = X, this._gradientStorageTex.magFilter = X, this._srcRegion = new Qn(new jr(0, 0), new jr(0, 0)), this._demodulatedRT = new bn(n, r, {
|
|
419
|
+
type: sr,
|
|
297
420
|
format: Q,
|
|
298
421
|
minFilter: X,
|
|
299
422
|
magFilter: X,
|
|
300
423
|
depthBuffer: !1,
|
|
301
424
|
stencilBuffer: !1
|
|
302
|
-
}), this._outputRT = new
|
|
303
|
-
type:
|
|
425
|
+
}), this._outputRT = new bn(n, r, {
|
|
426
|
+
type: sr,
|
|
304
427
|
format: Q,
|
|
305
428
|
minFilter: X,
|
|
306
429
|
magFilter: X,
|
|
307
430
|
depthBuffer: !1,
|
|
308
431
|
stencilBuffer: !1
|
|
309
|
-
}), this._gradientRT = new
|
|
310
|
-
type:
|
|
432
|
+
}), this._gradientRT = new bn(n, r, {
|
|
433
|
+
type: cr,
|
|
311
434
|
format: Q,
|
|
312
435
|
minFilter: X,
|
|
313
436
|
magFilter: X,
|
|
314
437
|
depthBuffer: !1,
|
|
315
438
|
stencilBuffer: !1
|
|
316
|
-
}), 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 =
|
|
317
|
-
type:
|
|
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 = K(0, "int"), this._heatmapStorageTex = new M(k, k), this._heatmapStorageTex.type = sr, this._heatmapStorageTex.format = Q, this._heatmapStorageTex.minFilter = Z, this._heatmapStorageTex.magFilter = Z, this.heatmapTarget = new bn(n, r, {
|
|
440
|
+
type: sr,
|
|
318
441
|
format: Q,
|
|
319
442
|
minFilter: Z,
|
|
320
443
|
magFilter: Z,
|
|
321
444
|
depthBuffer: !1,
|
|
322
445
|
stencilBuffer: !1
|
|
323
|
-
}), this._heatmapRawColorTexNode = new
|
|
446
|
+
}), 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();
|
|
324
447
|
}
|
|
325
448
|
_buildGradientCompute() {
|
|
326
|
-
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 =
|
|
327
|
-
this._gradientNode =
|
|
328
|
-
let f =
|
|
329
|
-
let a = i.mod(
|
|
449
|
+
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 = qn("float", 144), d = qn("float", 144);
|
|
450
|
+
this._gradientNode = Sn(() => {
|
|
451
|
+
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) => {
|
|
452
|
+
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(Zr(m.div(z(_, q(zr))))).toVar();
|
|
330
453
|
u.element(i).assign(v);
|
|
331
|
-
let y =
|
|
454
|
+
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);
|
|
332
455
|
d.element(i).assign(w);
|
|
333
456
|
};
|
|
334
457
|
_(m);
|
|
335
|
-
let v = m.add(
|
|
336
|
-
|
|
458
|
+
let v = m.add(G(64));
|
|
459
|
+
P(v.lessThan(G(144)), () => {
|
|
337
460
|
_(v);
|
|
338
461
|
});
|
|
339
|
-
let y = m.add(
|
|
340
|
-
|
|
462
|
+
let y = m.add(G(128));
|
|
463
|
+
P(y.lessThan(G(144)), () => {
|
|
341
464
|
_(y);
|
|
342
|
-
}),
|
|
343
|
-
let b =
|
|
344
|
-
|
|
345
|
-
let e =
|
|
465
|
+
}), Jn();
|
|
466
|
+
let b = I(Y.x).mul(8).add(I(f)), x = I(Y.y).mul(8).add(I(p));
|
|
467
|
+
P(b.lessThan(I(c)).and(x.lessThan(I(l))), () => {
|
|
468
|
+
let e = F(0).toVar(), t = F(0).toVar();
|
|
346
469
|
for (let n = -2; n <= 2; n++) for (let r = -2; r <= 2; r++) {
|
|
347
|
-
let i = p.add(
|
|
470
|
+
let i = p.add(G(2 + n)).mul(G(12)).add(f.add(G(2 + r))), a = u.element(i);
|
|
348
471
|
e.addAssign(a), t.addAssign(a.mul(a));
|
|
349
472
|
}
|
|
350
|
-
let o = e.div(25), m =
|
|
473
|
+
let o = e.div(25), m = Vn(z(t.div(25).sub(o.mul(o)), F(0))).mul(a).toVar(), h = F(0).toVar();
|
|
351
474
|
for (let e = -2; e <= 2; e++) for (let t = -2; t <= 2; t++) {
|
|
352
|
-
let n = p.add(
|
|
475
|
+
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(Tn(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)));
|
|
353
476
|
h.addAssign(o.mul(o));
|
|
354
477
|
}
|
|
355
|
-
let g = h.div(25).clamp(0, 1).toVar(), _ =
|
|
356
|
-
|
|
478
|
+
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);
|
|
479
|
+
W(s, Un(G(b), G(x)), J(ee, g, m, 1)).toWriteOnly();
|
|
357
480
|
});
|
|
358
481
|
})().compute([
|
|
359
482
|
this._dispatchX,
|
|
@@ -370,23 +493,23 @@ var $r = class extends E {
|
|
|
370
493
|
}
|
|
371
494
|
_buildTemporalForDirection(e) {
|
|
372
495
|
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;
|
|
373
|
-
return
|
|
374
|
-
let g =
|
|
375
|
-
|
|
376
|
-
let v =
|
|
377
|
-
|
|
378
|
-
let e =
|
|
379
|
-
|
|
380
|
-
let e =
|
|
381
|
-
let o =
|
|
496
|
+
return Sn(() => {
|
|
497
|
+
let g = I(Y.x).mul(8).add(I(R.x)), _ = I(Y.y).mul(8).add(I(R.y));
|
|
498
|
+
P(g.lessThan(I(m)).and(_.lessThan(I(h))), () => {
|
|
499
|
+
let v = L(g, _), y = U(t, v), b = y.xyz, x = y.w, S = U(n, v).xyz, ee = z(S, q(zr)), C = Zr(b.div(ee)), te = J(C, 1).toVar(), w = J(b, x).toVar();
|
|
500
|
+
P(f.greaterThan(.5).and(p.lessThan(.5)), () => {
|
|
501
|
+
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)));
|
|
502
|
+
P(t.and(f), () => {
|
|
503
|
+
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)), E = F(1).sub(y).mul(F(1).sub(b)), ie = y.mul(F(1).sub(b)), ae = F(1).sub(y).mul(b), oe = y.mul(b), se = (e, n, i) => {
|
|
504
|
+
let o = U(a, L(e, n)), s = o.xyz.mul(2).sub(1), c = o.w, l = Rn(jn(t, s).clamp(0, 1), F(16)), u = Mn(Tn(r.sub(c)).div(z(r, F(.001))).div(F(.05)).negate());
|
|
382
505
|
return i.mul(l).mul(u);
|
|
383
|
-
}, D = se(S, re,
|
|
384
|
-
|
|
385
|
-
let e =
|
|
506
|
+
}, D = se(S, re, E), ce = se(ne, re, ie), O = se(S, T, ae), k = se(ne, T, oe), le = D.add(ce).add(O).add(k);
|
|
507
|
+
P(le.greaterThan(F(.01)), () => {
|
|
508
|
+
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 = Zr(B(a, C, B(z(F(1).div(c.add(1)), u), F(1), f))), m = In(c.add(1), l);
|
|
386
509
|
te.assign(J(p, m)), w.assign(J(p.mul(ee), x));
|
|
387
510
|
});
|
|
388
511
|
});
|
|
389
|
-
}),
|
|
512
|
+
}), W(e, Un(G(g), G(_)), te).toWriteOnly(), W(c, Un(G(g), G(_)), w).toWriteOnly();
|
|
390
513
|
});
|
|
391
514
|
})().compute([
|
|
392
515
|
this._dispatchX,
|
|
@@ -400,35 +523,35 @@ var $r = class extends E {
|
|
|
400
523
|
}
|
|
401
524
|
_buildHeatmapCompute() {
|
|
402
525
|
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;
|
|
403
|
-
this._heatmapComputeNode =
|
|
404
|
-
let d =
|
|
405
|
-
|
|
406
|
-
let p =
|
|
407
|
-
|
|
408
|
-
let e =
|
|
526
|
+
this._heatmapComputeNode = Sn(() => {
|
|
527
|
+
let d = I(Y.x).mul(8).add(I(R.x)), f = I(Y.y).mul(8).add(I(R.y));
|
|
528
|
+
P(d.lessThan(I(l)).and(f.lessThan(I(u))), () => {
|
|
529
|
+
let p = L(d, f), m = J(0, 0, 0, 1).toVar();
|
|
530
|
+
P(c.equal(I(0)), () => {
|
|
531
|
+
let e = U(t, p).xyz;
|
|
409
532
|
m.assign(J(e, 1));
|
|
410
|
-
}).ElseIf(c.equal(
|
|
411
|
-
let t =
|
|
533
|
+
}).ElseIf(c.equal(I(1)), () => {
|
|
534
|
+
let t = F(0).toVar(), n = F(0).toVar();
|
|
412
535
|
for (let r = -1; r <= 1; r++) for (let i = -1; i <= 1; i++) {
|
|
413
|
-
let a =
|
|
536
|
+
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);
|
|
414
537
|
t.addAssign(s), n.addAssign(s.mul(s));
|
|
415
538
|
}
|
|
416
539
|
t.divAssign(9), n.divAssign(9);
|
|
417
|
-
let r =
|
|
540
|
+
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));
|
|
418
541
|
m.assign(J(i, a, s, 1));
|
|
419
|
-
}).ElseIf(c.equal(
|
|
420
|
-
let e =
|
|
421
|
-
m.assign(J(
|
|
422
|
-
}).ElseIf(c.equal(
|
|
423
|
-
let e =
|
|
542
|
+
}).ElseIf(c.equal(I(2)), () => {
|
|
543
|
+
let e = U(n, p).w.div(32).clamp(0, 1);
|
|
544
|
+
m.assign(J(F(1).sub(e), e, F(.2), 1));
|
|
545
|
+
}).ElseIf(c.equal(I(3)), () => {
|
|
546
|
+
let e = U(i, p), t = Tn(e.x).mul(100).clamp(0, 1), n = Tn(e.y).mul(100).clamp(0, 1), r = t.add(n).clamp(0, 1);
|
|
424
547
|
m.assign(J(t, n, r.mul(.3), 1));
|
|
425
|
-
}).ElseIf(c.equal(
|
|
426
|
-
let e =
|
|
548
|
+
}).ElseIf(c.equal(I(4)), () => {
|
|
549
|
+
let e = U(r, p);
|
|
427
550
|
m.assign(J(e.xyz, 1));
|
|
428
551
|
}).Else(() => {
|
|
429
|
-
let e =
|
|
430
|
-
m.assign(J(e, e.mul(.5),
|
|
431
|
-
}),
|
|
552
|
+
let e = U(a, p).x.mul(5).clamp(0, 1);
|
|
553
|
+
m.assign(J(e, e.mul(.5), F(1).sub(e), 1));
|
|
554
|
+
}), W(s, Un(G(d), G(f)), m).toWriteOnly();
|
|
432
555
|
});
|
|
433
556
|
})().compute([
|
|
434
557
|
this._dispatchX,
|
|
@@ -469,10 +592,10 @@ var $r = class extends E {
|
|
|
469
592
|
reallocateReservedStorage() {
|
|
470
593
|
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();
|
|
471
594
|
let e = (e, t) => {
|
|
472
|
-
let n = new
|
|
595
|
+
let n = new M(k, k);
|
|
473
596
|
return n.type = e, n.format = Q, n.minFilter = t, n.magFilter = t, n;
|
|
474
597
|
};
|
|
475
|
-
this._temporalTexA = e(
|
|
598
|
+
this._temporalTexA = e(sr, X), this._temporalTexB = e(sr, X), this._outputModulatedTex = e(sr, X), this._gradientStorageTex = e(cr, X), this._heatmapStorageTex = e(sr, Z), this._buildGradientCompute(), this._buildTemporalCompute(), this._buildHeatmapCompute(), this._compiled = !1, this.currentMoments = 0, this._needsWarmReset = !0;
|
|
476
599
|
}
|
|
477
600
|
setSize(e, t) {
|
|
478
601
|
this._demodulatedRT.setSize(e, t), this._demodulatedRT.texture.needsUpdate = !0, this._outputRT.setSize(e, t), this._outputRT.texture.needsUpdate = !0, this._gradientRT.setSize(e, t), this._gradientRT.texture.needsUpdate = !0, this.heatmapTarget.setSize(e, t), this.heatmapTarget.texture.needsUpdate = !0, this.resW.value = e, this.resH.value = t, this._dispatchX = Math.ceil(e / 8), this._dispatchY = Math.ceil(t / 8), this._gradientNode.dispatchSize = [
|
|
@@ -500,7 +623,7 @@ var $r = class extends E {
|
|
|
500
623
|
dispose() {
|
|
501
624
|
this._gradientNode?.dispose(), this._temporalNodeA?.dispose(), this._temporalNodeB?.dispose(), this._temporalTexA?.dispose(), this._temporalTexB?.dispose(), this._outputModulatedTex?.dispose(), this._gradientStorageTex?.dispose(), this._demodulatedRT?.dispose(), this._outputRT?.dispose(), this._gradientRT?.dispose(), this._heatmapComputeNode?.dispose(), this._heatmapStorageTex?.dispose(), this.heatmapTarget?.dispose(), this._colorTexNode?.dispose(), this._albedoTexNode?.dispose(), this._motionTexNode?.dispose(), this._normalDepthTexNode?.dispose(), this._prevNormalDepthTexNode?.dispose(), this._readTemporalTexNode?.dispose(), this._gradientReadTexNode?.dispose(), this._heatmapRawColorTexNode?.dispose(), this._heatmapColorTexNode?.dispose(), this._heatmapTemporalTexNode?.dispose(), this._heatmapNDTexNode?.dispose(), this._heatmapMotionTexNode?.dispose(), this._heatmapGradientTexNode?.dispose();
|
|
502
625
|
}
|
|
503
|
-
},
|
|
626
|
+
}, $r = 1e-6, ei = 1.5 / 255, ti = .01, ni = 3, ri = 2, ii = 2, ai = 3, oi = 2, si = 38, ci = .1, li = 4, ui = Math.cos(89 * Math.PI / 180), di = .5, fi = 16, pi = {
|
|
504
627
|
pre: {
|
|
505
628
|
radiusScale: 1,
|
|
506
629
|
fractionScale: 2
|
|
@@ -513,7 +636,7 @@ var $r = class extends E {
|
|
|
513
636
|
radiusScale: 2,
|
|
514
637
|
fractionScale: .5
|
|
515
638
|
}
|
|
516
|
-
},
|
|
639
|
+
}, mi = .25 * Math.SQRT2, hi = [
|
|
517
640
|
[
|
|
518
641
|
-1,
|
|
519
642
|
0,
|
|
@@ -535,62 +658,62 @@ var $r = class extends E {
|
|
|
535
658
|
1
|
|
536
659
|
],
|
|
537
660
|
[
|
|
538
|
-
-
|
|
539
|
-
|
|
661
|
+
-mi,
|
|
662
|
+
mi,
|
|
540
663
|
.5
|
|
541
664
|
],
|
|
542
665
|
[
|
|
543
|
-
|
|
544
|
-
|
|
666
|
+
mi,
|
|
667
|
+
mi,
|
|
545
668
|
.5
|
|
546
669
|
],
|
|
547
670
|
[
|
|
548
|
-
|
|
549
|
-
-
|
|
671
|
+
mi,
|
|
672
|
+
-mi,
|
|
550
673
|
.5
|
|
551
674
|
],
|
|
552
675
|
[
|
|
553
|
-
-
|
|
554
|
-
-
|
|
676
|
+
-mi,
|
|
677
|
+
-mi,
|
|
555
678
|
.5
|
|
556
679
|
]
|
|
557
|
-
],
|
|
558
|
-
let r = e.mul(t).add(n).abs().mul(-
|
|
559
|
-
return
|
|
560
|
-
},
|
|
561
|
-
let i =
|
|
562
|
-
return
|
|
563
|
-
},
|
|
564
|
-
let n =
|
|
565
|
-
return
|
|
566
|
-
},
|
|
567
|
-
let r =
|
|
568
|
-
return
|
|
569
|
-
},
|
|
570
|
-
let n =
|
|
571
|
-
return
|
|
572
|
-
},
|
|
573
|
-
let i =
|
|
574
|
-
return
|
|
575
|
-
},
|
|
680
|
+
], gi = (e, t, n) => Bn(0, 1, F(1).sub(e.mul(t).add(n).abs())), _i = (e, t, n) => {
|
|
681
|
+
let r = e.mul(t).add(n).abs().mul(-ni);
|
|
682
|
+
return F(1).div(r.mul(r).sub(r).add(1));
|
|
683
|
+
}, vi = (e) => B(F(1.570796), F(1.395402), V(e)).mul(Vn(V(F(1).sub(e)))), yi = (e, t) => F(1).sub(Nn(e.mul(e).mul(-200))).mul(Rn(V(e), t)), bi = (e, t) => V(e).mul(Vn(t.div(F(1).sub(t).add($r)))), xi = (e, t, n, r) => {
|
|
684
|
+
let i = z(En(bi(n, r.mul(B(V(t), F(1), e)))), F(ei));
|
|
685
|
+
return F(1).div(i);
|
|
686
|
+
}, Si = (e, t) => {
|
|
687
|
+
let n = F(1).div(B(F(ti), F(1), V(e.mul(t))));
|
|
688
|
+
return Gn(n, e.mul(n).negate());
|
|
689
|
+
}, Ci = (e, t, n) => {
|
|
690
|
+
let r = F(1).div(B(F(n), F(1), B(e.mul(e), e, V(t))));
|
|
691
|
+
return Gn(r, e.mul(r).negate());
|
|
692
|
+
}, wi = (e, t) => {
|
|
693
|
+
let n = F(1).div(t);
|
|
694
|
+
return Gn(n, e.mul(n).negate());
|
|
695
|
+
}, Ti = (e, t, n, r) => {
|
|
696
|
+
let i = F(1).div(e.mul(t));
|
|
697
|
+
return Gn(i, jn(r, n).mul(i).negate());
|
|
698
|
+
}, Ei = (e) => Gn(1).sub(Gn(1).sub(Fn(e.mul(.5)).mul(2)).abs()).min(.99999), Di = (e) => q(jn(e, q(.25, .5, .25)), jn(e, q(.5, 0, -.5)), jn(e, q(-.25, .5, -.25))), Oi = (e) => {
|
|
576
699
|
let t = e.x.sub(e.z);
|
|
577
|
-
return
|
|
578
|
-
},
|
|
579
|
-
function
|
|
700
|
+
return z(q(t.add(e.y), e.x.add(e.z), t.sub(e.y)), q(0));
|
|
701
|
+
}, ki = (e, t) => t.add($r).div(e.add($r)), Ai = (e, t) => J(e.xyz.mul(ki(e.x, t)), e.w), ji = (e) => J(Di(Oi(e.xyz)), V(e.w)), Mi = (e, t) => Vn(t.sub(e.mul(e)).abs()), Ni = (e, t) => Gn(e.x.mul(t.x).add(e.y.mul(t.y)), e.z.mul(t.x).add(e.w.mul(t.y))), Pi = (e, t) => H(e.equal(0), J(0), t);
|
|
702
|
+
function Fi(e) {
|
|
580
703
|
let t = Math.imul(e | 0, 2654435761) >>> 0;
|
|
581
704
|
return t ^= t >>> 15, t = Math.imul(t, 2246822507) >>> 0, t ^= t >>> 13, t = Math.imul(t, 3266489909) >>> 0, t ^= t >>> 16, t / 4294967296;
|
|
582
705
|
}
|
|
583
|
-
var
|
|
706
|
+
var Ii = class extends E {
|
|
584
707
|
constructor(e, t = {}) {
|
|
585
708
|
super("NRD", {
|
|
586
709
|
...t,
|
|
587
|
-
executionMode:
|
|
710
|
+
executionMode: ge.PER_CYCLE
|
|
588
711
|
}), this.renderer = e, this.pathTracer = t.pathTracer || null, this.settings = {
|
|
589
|
-
...
|
|
712
|
+
...Ur,
|
|
590
713
|
...t.settings || {}
|
|
591
|
-
}, this._releaseHitDistance = this.pathTracer?.requestOutput?.("hitDistance", { encode: (e, t) => e.div(
|
|
714
|
+
}, this._releaseHitDistance = this.pathTracer?.requestOutput?.("hitDistance", { encode: (e, t) => e.div(z(t.mul(.1).add(3), F(1e-4))).clamp(0, 1) }) ?? null;
|
|
592
715
|
let n = t.width || 1, r = t.height || 1;
|
|
593
|
-
this.resW =
|
|
716
|
+
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 Mr(1, 0, 0, 1), "vec4"), this.rotBlur = K(new Mr(1, 0, 0, 1), "vec4"), this.rotPost = K(new Mr(1, 0, 0, 1), "vec4"), this.camWorld = K(new pr(), "mat4"), this.camProjInv = K(new pr(), "mat4"), this.camView = K(new pr(), "mat4"), this.prevCamView = K(new pr(), "mat4"), this.camPos = K(new $(), "vec3"), this.prevCamPos = K(new $(), "vec3"), this.viewVector = K(new $(), "vec3"), this.prevViewVector = K(new $(), "vec3"), this.cameraRay = A(), this.u = {};
|
|
594
717
|
for (let e of [
|
|
595
718
|
"maxAccum",
|
|
596
719
|
"maxFast",
|
|
@@ -610,25 +733,25 @@ var Vi = class extends E {
|
|
|
610
733
|
"disocclusionThreshold",
|
|
611
734
|
"lobeVolumePercent",
|
|
612
735
|
"handoverFrames"
|
|
613
|
-
]) this.u[e] =
|
|
614
|
-
this.u.antilag =
|
|
736
|
+
]) this.u[e] = K(0);
|
|
737
|
+
this.u.antilag = K(new jr(), "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();
|
|
615
738
|
let i = () => {
|
|
616
|
-
let e = new
|
|
739
|
+
let e = new ar(new Float32Array(4), 1, 1, Q, sr);
|
|
617
740
|
e.needsUpdate = !0;
|
|
618
|
-
let t = new
|
|
741
|
+
let t = new N(e);
|
|
619
742
|
return this._placeholders.set(t, e), t;
|
|
620
743
|
};
|
|
621
|
-
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
|
|
622
|
-
type:
|
|
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 Qn(new jr(0, 0), new jr(0, 0)), this.outputTarget = new bn(n, r, {
|
|
745
|
+
type: cr,
|
|
623
746
|
format: Q,
|
|
624
747
|
minFilter: X,
|
|
625
748
|
magFilter: X,
|
|
626
749
|
depthBuffer: !1,
|
|
627
750
|
stencilBuffer: !1
|
|
628
|
-
}), this._compiled = !1, this._needsReset = !0, this._stabPing = 0, this._camInitialized = !1, this._dispatchX = Math.ceil(n /
|
|
751
|
+
}), this._compiled = !1, this._needsReset = !0, this._stabPing = 0, this._camInitialized = !1, this._dispatchX = Math.ceil(n / fi), this._dispatchY = Math.ceil(r / fi), this._buildKernels();
|
|
629
752
|
}
|
|
630
753
|
_allocStorage() {
|
|
631
|
-
let e = () =>
|
|
754
|
+
let e = () => pe(cr);
|
|
632
755
|
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();
|
|
633
756
|
}
|
|
634
757
|
_disposeStorage() {
|
|
@@ -649,7 +772,7 @@ var Vi = class extends E {
|
|
|
649
772
|
}
|
|
650
773
|
updateParameters(e) {
|
|
651
774
|
if (e) {
|
|
652
|
-
for (let t of Object.keys(e)) t === "debugMode" ? this.debugMode.value = e.debugMode | 0 : t in
|
|
775
|
+
for (let t of Object.keys(e)) t === "debugMode" ? this.debugMode.value = e.debugMode | 0 : t in Ur && (this.settings[t] = e[t]);
|
|
653
776
|
this._syncUniforms();
|
|
654
777
|
}
|
|
655
778
|
}
|
|
@@ -660,32 +783,32 @@ var Vi = class extends E {
|
|
|
660
783
|
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;
|
|
661
784
|
}
|
|
662
785
|
_worldPosAt(e, t, n, r) {
|
|
663
|
-
return
|
|
786
|
+
return ve(e, t, n, r, this.cameraRay);
|
|
664
787
|
}
|
|
665
788
|
_viewVector(e, t, n) {
|
|
666
|
-
return
|
|
789
|
+
return H(ne(this.cameraRay.cameraProjection), n, Ln(t.sub(e)));
|
|
667
790
|
}
|
|
668
791
|
_frustumSize(e) {
|
|
669
|
-
return this.minRectDimMulUnproject.mul(
|
|
792
|
+
return this.minRectDimMulUnproject.mul(H(ne(this.cameraRay.cameraProjection), F(1), e));
|
|
670
793
|
}
|
|
671
794
|
_pixelUv(e, t) {
|
|
672
|
-
return
|
|
795
|
+
return Gn(F(e).add(.5).div(this.resW), F(t).add(.5).div(this.resH));
|
|
673
796
|
}
|
|
674
797
|
_clampCoord(e, t) {
|
|
675
|
-
return
|
|
798
|
+
return L(e.clamp(I(0), I(this.resW).sub(1)), t.clamp(I(0), I(this.resH).sub(1)));
|
|
676
799
|
}
|
|
677
800
|
_uvToCoord(e) {
|
|
678
|
-
return this._clampCoord(
|
|
801
|
+
return this._clampCoord(I(e.x.mul(this.resW)), I(e.y.mul(this.resH)));
|
|
679
802
|
}
|
|
680
803
|
_advancedNonLinear(e) {
|
|
681
|
-
let t = this.u.convergence, n =
|
|
682
|
-
return
|
|
804
|
+
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));
|
|
805
|
+
return F(1).div(F(1).add(r.mul(e)));
|
|
683
806
|
}
|
|
684
807
|
_handover(e) {
|
|
685
|
-
return
|
|
808
|
+
return V(e.div(z(this.u.handoverFrames, 1)));
|
|
686
809
|
}
|
|
687
810
|
_bilinear(e) {
|
|
688
|
-
let t = e.mul(
|
|
811
|
+
let t = e.mul(Gn(this.resW, this.resH)).sub(.5), n = Pn(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));
|
|
689
812
|
return {
|
|
690
813
|
f: r,
|
|
691
814
|
taps: [
|
|
@@ -701,22 +824,22 @@ var Vi = class extends E {
|
|
|
701
824
|
o(i.add(1), a.add(1))
|
|
702
825
|
],
|
|
703
826
|
customWeights: (e) => [
|
|
704
|
-
e[0].mul(
|
|
705
|
-
e[1].mul(r.x).mul(
|
|
706
|
-
e[2].mul(
|
|
827
|
+
e[0].mul(F(1).sub(r.x)).mul(F(1).sub(r.y)),
|
|
828
|
+
e[1].mul(r.x).mul(F(1).sub(r.y)),
|
|
829
|
+
e[2].mul(F(1).sub(r.x)).mul(r.y),
|
|
707
830
|
e[3].mul(r.x).mul(r.y)
|
|
708
831
|
],
|
|
709
|
-
filter: (e) =>
|
|
832
|
+
filter: (e) => B(B(e[0], e[1], r.x), B(e[2], e[3], r.x), r.y)
|
|
710
833
|
};
|
|
711
834
|
}
|
|
712
835
|
_applyCustomWeights(e, t, n) {
|
|
713
836
|
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]);
|
|
714
|
-
return
|
|
837
|
+
return H(i.lessThan(1e-4), n, r.div(z(i, 1e-4)));
|
|
715
838
|
}
|
|
716
839
|
_sampleHistory(e, t, n, r, i) {
|
|
717
840
|
let a = J(0).toVar();
|
|
718
|
-
return
|
|
719
|
-
let n =
|
|
841
|
+
return P(i, () => {
|
|
842
|
+
let n = V(t).mul(Gn(this.resW, this.resH)), r = Pn(n.sub(.5)).add(.5), i = V(n.sub(r)), o = di, 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 = [
|
|
720
843
|
s.x,
|
|
721
844
|
c.x,
|
|
722
845
|
l.x,
|
|
@@ -726,13 +849,13 @@ var Vi = class extends E {
|
|
|
726
849
|
c.y,
|
|
727
850
|
l.y,
|
|
728
851
|
u.y
|
|
729
|
-
], p =
|
|
852
|
+
], p = I(r.x).sub(1), m = I(r.y).sub(1), h = J(0).toVar(), g = F(0).toVar();
|
|
730
853
|
for (let t = 0; t < 4; t++) for (let n = 0; n < 4; n++) {
|
|
731
854
|
if ((n === 0 || n === 3) && (t === 0 || t === 3)) continue;
|
|
732
855
|
let r = d[n].mul(f[t]);
|
|
733
856
|
h.addAssign(e(this._clampCoord(p.add(n), m.add(t))).mul(r)), g.addAssign(r);
|
|
734
857
|
}
|
|
735
|
-
a.assign(
|
|
858
|
+
a.assign(H(g.lessThan(1e-4), J(0), h.div(z(g, 1e-4))));
|
|
736
859
|
}).Else(() => {
|
|
737
860
|
a.assign(this._applyCustomWeights(n.taps.map((t) => e(t)), r, J(0)));
|
|
738
861
|
}), a;
|
|
@@ -754,176 +877,176 @@ var Vi = class extends E {
|
|
|
754
877
|
this._dispatchY,
|
|
755
878
|
1
|
|
756
879
|
], [
|
|
757
|
-
|
|
758
|
-
|
|
880
|
+
fi,
|
|
881
|
+
fi,
|
|
759
882
|
1
|
|
760
883
|
]);
|
|
761
884
|
}
|
|
762
885
|
_buildSpatial(e) {
|
|
763
|
-
let t = e === "pre", { radiusScale: r, fractionScale: a } =
|
|
764
|
-
let t =
|
|
765
|
-
return J(
|
|
766
|
-
} : (e) =>
|
|
767
|
-
let s =
|
|
768
|
-
|
|
769
|
-
let l =
|
|
770
|
-
|
|
886
|
+
let t = e === "pre", { radiusScale: r, fractionScale: a } = pi[e], o = this.u, c = 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) => {
|
|
887
|
+
let t = U(c, e), r = U(l, e);
|
|
888
|
+
return J(Di(n(t.xyz.div(z(r.xyz, q(zr))))), i(r.w, s).min(1));
|
|
889
|
+
} : (e) => U(p, e), C = Sn(([n, i]) => {
|
|
890
|
+
let s = I(Y.x).mul(fi).add(I(R.x)), c = I(Y.y).mul(fi).add(I(R.y));
|
|
891
|
+
P(s.lessThan(I(b)).and(c.lessThan(I(x))), () => {
|
|
892
|
+
let l = L(s, c), p = Un(G(s), G(c)), C = U(u, l).w.toVar(), te = C.greaterThanEqual(Rr), w = U(d, l).toVar(), ne = Ln(w.xyz.mul(2).sub(1)).toVar(), re = w.w.clamp(.05, 1).toVar(), T = F(Rr).toVar(), E = ee(l).toVar();
|
|
893
|
+
P(te.not(), () => {
|
|
771
894
|
let e = this._pixelUv(s, c), p = this._worldPosAt(e, C, n, i).toVar();
|
|
772
|
-
T.assign(v.mul(J(p, 1)).z.abs()),
|
|
773
|
-
let s =
|
|
774
|
-
t || (
|
|
775
|
-
let
|
|
895
|
+
T.assign(v.mul(J(p, 1)).z.abs()), P(_.greaterThan(0), () => {
|
|
896
|
+
let s = jn(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 = yi(re, .5).toVar(), w = T.mul(Hr).add(3), ie = E.w.toVar(), ae = V(ie.mul(w).div(c)), oe = F(1).sub(this._handover(m)), se = (t ? ae.div(m) : ae.mul(C)).mul(oe), D = o.minBlurRadius.mul(V(F(2).sub(h.div(z(o.maxAccum, 1))))), ce = z(V(Vn(V(se)).mul(r)).mul(_).mul(te), D.mul(te)).toVar(), O = Ti(o.planeDistSensitivity, c, p, ne).toVar(), k = xi(C, o.lobeAngleFraction, re, o.lobeVolumePercent).div(a).toVar(), le = Si(re, o.roughnessFraction.mul(a)).toVar(), ue = wi(ie, C).toVar(), de = o.minHitDistanceWeight.mul(a).mul(te);
|
|
897
|
+
t || (de = de.mul(C)), de = de.toVar();
|
|
898
|
+
let A = Gn(1);
|
|
776
899
|
if (!t) {
|
|
777
900
|
let e = v.mul(J(ne, 0)).xy;
|
|
778
|
-
|
|
901
|
+
A = B(Gn(1).sub(e.abs()), Gn(1), s), A = A.div(z(A.x, A.y));
|
|
779
902
|
}
|
|
780
|
-
let
|
|
781
|
-
for (let t = 0; t <
|
|
782
|
-
let r =
|
|
783
|
-
s.mulAssign(
|
|
784
|
-
let h =
|
|
785
|
-
s.mulAssign(
|
|
903
|
+
let fe = A.mul(Gn(F(1).div(b), F(1).div(x))).mul(ce).toVar(), pe = F(1).toVar();
|
|
904
|
+
for (let t = 0; t < hi.length; t++) {
|
|
905
|
+
let r = hi[t], a = e.add(Ni(g, Gn(r[0], r[1])).mul(fe)), o = Ei(a), s = H(o.x.notEqual(a.x).or(o.y.notEqual(a.y)), F(1), F(Math.exp(-.66 * r[2] * r[2]))).toVar(), c = this._uvToCoord(o), l = U(u, c).w, f = this._worldPosAt(o, l, n, i), p = U(d, c), m = vi(jn(ne, Ln(p.xyz.mul(2).sub(1))));
|
|
906
|
+
s.mulAssign(gi(m, k, F(0))), s.mulAssign(gi(p.w, le.x, le.y)), s.mulAssign(gi(jn(ne, f), O.x, O.y)), s.assign(H(l.greaterThanEqual(Rr), F(0), s));
|
|
907
|
+
let h = Pi(s, ee(c));
|
|
908
|
+
s.mulAssign(de.add(_i(h.w, ue.x, ue.y))), pe.addAssign(s), E.addAssign(h.mul(s));
|
|
786
909
|
}
|
|
787
|
-
|
|
910
|
+
E.divAssign(z(pe, 1e-6)), t || E.assign(J(E.xyz, ie));
|
|
788
911
|
});
|
|
789
|
-
}),
|
|
912
|
+
}), W(m, p, E).toWriteOnly(), e === "post" && W(h, p, J(ne, T)).toWriteOnly();
|
|
790
913
|
});
|
|
791
914
|
});
|
|
792
915
|
return this._dispatchOf(C);
|
|
793
916
|
}
|
|
794
917
|
_buildTemporalAccumulation() {
|
|
795
|
-
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 =
|
|
796
|
-
let x =
|
|
797
|
-
|
|
798
|
-
let h =
|
|
799
|
-
|
|
800
|
-
|
|
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 = Sn(([y, b]) => {
|
|
919
|
+
let x = I(Y.x).mul(fi).add(I(R.x)), S = I(Y.y).mul(fi).add(I(R.y));
|
|
920
|
+
P(x.lessThan(I(h)).and(S.lessThan(I(g))), () => {
|
|
921
|
+
let h = L(x, S), g = Un(G(x), G(S)), ee = U(t, h).w, C = U(i, h).toVar();
|
|
922
|
+
P(ee.greaterThanEqual(Rr), () => {
|
|
923
|
+
W(l, g, C).toWriteOnly(), W(u, g, J(0)).toWriteOnly(), wn();
|
|
801
924
|
});
|
|
802
|
-
let te = e.maxAccum.mul(
|
|
925
|
+
let te = e.maxAccum.mul(F(1).sub(v)).toVar(), w = e.maxFast.mul(F(1).sub(v)).toVar(), ne = U(n, h), re = Ln(ne.xyz.mul(2).sub(1)).toVar(), T = ne.w.clamp(.05, 1).toVar(), E = this._pixelUv(x, S), ie = this._worldPosAt(E, ee, y, b).toVar(), ae = d.mul(J(ie, 1)).z.abs().toVar(), oe = jn(re, this._viewVector(ie, p, this.viewVector)).abs().toVar(), se = this._frustumSize(ae).toVar(), D = q(0).toVar();
|
|
803
926
|
D.addAssign(re.mul(.25));
|
|
804
927
|
for (let e = -1; e <= 0; e++) for (let r = -1; r <= 0; r++) {
|
|
805
928
|
if (r === 0 && e === 0) continue;
|
|
806
|
-
let i = this._clampCoord(x.add(r), S.add(e)), a =
|
|
807
|
-
D.addAssign(
|
|
929
|
+
let i = this._clampCoord(x.add(r), S.add(e)), a = Ln(U(n, i).xyz.mul(2).sub(1)), o = U(t, i).w.lessThan(Rr);
|
|
930
|
+
D.addAssign(H(o, a, re).mul(.25));
|
|
808
931
|
}
|
|
809
|
-
let ce =
|
|
932
|
+
let ce = U(r, h), O = E.sub(ce.xy).toVar(), k = f.mul(J(ie, 1)).z.abs().toVar(), le = this._bilinear(O), ue = se.mul(V(e.disocclusionThreshold.div(z(oe, .05)))).sub($r).toVar(), de = F(1).sub(v), A = [], fe = [];
|
|
810
933
|
for (let e = 0; e < 4; e++) {
|
|
811
|
-
let t =
|
|
812
|
-
|
|
934
|
+
let t = U(c, le.taps[e]), n = H(jn(t.xyz, D).greaterThan(ui), F(1), F(0)), r = H(t.w.sub(k).abs().lessThanEqual(ue), F(1), F(0)), i = H(t.w.lessThan(Rr), F(1), F(0));
|
|
935
|
+
A.push(n.mul(r).mul(i).mul(le.inScreen[e]).mul(de).toVar()), fe.push(U(s, le.taps[e]).x);
|
|
813
936
|
}
|
|
814
|
-
let
|
|
815
|
-
|
|
816
|
-
let
|
|
817
|
-
|
|
818
|
-
let
|
|
819
|
-
|
|
820
|
-
let
|
|
821
|
-
|
|
822
|
-
let
|
|
823
|
-
|
|
824
|
-
let
|
|
825
|
-
|
|
937
|
+
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 = jn(re, this._viewVector(ie, m, this.prevViewVector)).abs().add(.001).div(oe.add(.001)).toVar();
|
|
938
|
+
_e.assign(B(F(.1), F(1), V(_e.mul(_e))));
|
|
939
|
+
let ve = Vn(V(le.filter(A))).mul(_e).toVar();
|
|
940
|
+
ge.assign(ge.mul(B(ve, F(1), F(1).div(ge.add(1))))), ge.assign(In(ge, te));
|
|
941
|
+
let ye = ji(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(), Te = F(1).div(F(1).add(yi(T, .25).mul(.5).mul(te))), Ee = J(B(ye.xyz, C.xyz, we), B(ye.w, C.w, z(we, Te))).toVar(), De = e.fireflyMinRelativeScale.add(F(si).div(ge.add(1))).toVar(), Oe = ge.mul(e.maxBlurRadius).mul(ci).toVar();
|
|
942
|
+
Oe.assign(Oe.div(Oe.add(1)).mul(F(1).sub(Se)));
|
|
943
|
+
let ke = B(Ee.x, In(Ee.x, ye.x.mul(De)), Oe);
|
|
944
|
+
Ee.assign(Ai(Ee, ke));
|
|
945
|
+
let Ae = F(1.2).add(F(1).div(ge.add(1)));
|
|
946
|
+
Ee.assign(J(Ee.xyz, B(Ee.w, In(Ee.w, ye.w.mul(Ae)), Oe))), W(l, g, Ee).toWriteOnly();
|
|
947
|
+
let je = In(ge, w).mul(F(1).sub(Se)), Me = xe.div(xe.add(je)), Ne = B(be, C.x, Me).toVar(), Pe = In(Ne, ye.x.mul(De).mul(li));
|
|
948
|
+
Ne.assign(B(Ne, Pe, Oe)), W(u, g, J(Ne, ge, he, H(me, F(1), F(0)))).toWriteOnly();
|
|
826
949
|
});
|
|
827
950
|
});
|
|
828
951
|
return this._dispatchOf(y);
|
|
829
952
|
}
|
|
830
953
|
_buildHistoryFix() {
|
|
831
|
-
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 =
|
|
832
|
-
let p =
|
|
833
|
-
|
|
834
|
-
let h =
|
|
835
|
-
|
|
836
|
-
let e =
|
|
837
|
-
|
|
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 = Sn(([d, f]) => {
|
|
955
|
+
let p = I(Y.x).mul(fi).add(I(R.x)), m = I(Y.y).mul(fi).add(I(R.y));
|
|
956
|
+
P(p.lessThan(I(c)).and(m.lessThan(I(l))), () => {
|
|
957
|
+
let h = L(p, m), g = Un(G(p), G(m)), _ = U(t, h).w;
|
|
958
|
+
P(_.greaterThanEqual(Rr), () => {
|
|
959
|
+
let e = U(r, h);
|
|
960
|
+
W(a, g, e).toWriteOnly(), W(o, g, J(e.x, 0, 0, 0)).toWriteOnly(), wn();
|
|
838
961
|
});
|
|
839
|
-
let v =
|
|
840
|
-
|
|
841
|
-
let a =
|
|
962
|
+
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 = Ln(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(), E = F(1).div(b.add(1)).toVar(), ie = ne.mul(Hr).add(3), ae = V(T.w.mul(ie).div(re)), oe = T.w.toVar(), se = zn(H(b.lessThan(e.historyFixFrameNum), F(1), F(0)).mul(.5).mul(2 / ri).mul(e.historyFixStride).mul(B(F(.25).add(Vn(ae).mul(.75)), F(1), E))).toVar();
|
|
963
|
+
P(se.notEqual(0), () => {
|
|
964
|
+
let a = xi(E, e.lobeAngleFraction, C, e.lobeVolumePercent).toVar(), o = Ti(e.planeDistSensitivity, re, w, ee).toVar(), s = wi(oe, E).toVar(), u = Ci(C.mul(C), Vn(e.roughnessFraction), ti).toVar(), p = F(1).add(y).toVar();
|
|
842
965
|
T.mulAssign(p);
|
|
843
|
-
for (let e = -
|
|
844
|
-
if (m === 0 && e === 0 || Math.abs(m) + Math.abs(e) ===
|
|
845
|
-
let h =
|
|
846
|
-
b.mulAssign(
|
|
847
|
-
let x =
|
|
848
|
-
b.mulAssign(
|
|
966
|
+
for (let e = -ri; e <= ri; e++) for (let m = -ri; m <= ri; m++) {
|
|
967
|
+
if (m === 0 && e === 0 || Math.abs(m) + Math.abs(e) === ri * 2) continue;
|
|
968
|
+
let h = Ei(te.add(Gn(m, e).mul(se).mul(Gn(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 = _i(vi(jn(Ln(y.xyz.mul(2).sub(1)), ee)), a, F(0)).toVar();
|
|
969
|
+
b.mulAssign(_i(y.w.mul(y.w), u.x, u.y)), b.mulAssign(F(1).add(U(i, g).y)), b.mulAssign(gi(jn(ee, v), o.x, o.y)), b.assign(H(_.greaterThanEqual(Rr), F(0), b));
|
|
970
|
+
let x = Pi(b, U(r, g));
|
|
971
|
+
b.mulAssign(_i(x.w, s.x, s.y)), p.addAssign(b), T.addAssign(x.mul(b));
|
|
849
972
|
}
|
|
850
|
-
T.divAssign(
|
|
973
|
+
T.divAssign(z(p, 1e-6));
|
|
851
974
|
});
|
|
852
|
-
let D = T.x.toVar(), ce =
|
|
853
|
-
|
|
854
|
-
let
|
|
855
|
-
let a = this._clampCoord(p.add(e), m.add(n)), o =
|
|
856
|
-
Math.abs(e) <=
|
|
857
|
-
},
|
|
858
|
-
for (let e = -
|
|
859
|
-
|
|
860
|
-
for (let e = -
|
|
861
|
-
}),
|
|
862
|
-
let e = 1 / ((
|
|
863
|
-
D.assign(
|
|
975
|
+
let D = T.x.toVar(), ce = V(y.div(z(e.historyFixFrameNum, $r))), O = B(D, v.x, ce).toVar();
|
|
976
|
+
W(o, g, J(O, 0, 0, 0)).toWriteOnly();
|
|
977
|
+
let k = O.toVar(), le = O.mul(O).toVar(), ue = F(0).toVar(), de = F(0).toVar(), A = (e, n, r) => {
|
|
978
|
+
let a = this._clampCoord(p.add(e), m.add(n)), o = U(t, a).w, s = H(o.greaterThanEqual(Rr), O, U(i, a).x);
|
|
979
|
+
Math.abs(e) <= ii && Math.abs(n) <= ii && (k.addAssign(s), le.addAssign(s.mul(s))), r && (ue.addAssign(s), de.addAssign(s.mul(s)));
|
|
980
|
+
}, fe = e.antiFirefly.greaterThan(.5);
|
|
981
|
+
for (let e = -ii; e <= ii; e++) for (let t = -ii; t <= ii; t++) t === 0 && e === 0 || A(t, e, Math.abs(t) > 1 || Math.abs(e) > 1);
|
|
982
|
+
P(fe, () => {
|
|
983
|
+
for (let e = -ai; e <= ai; e++) for (let t = -ai; t <= ai; t++) Math.abs(t) <= ii && Math.abs(e) <= ii || A(t, e, !0);
|
|
984
|
+
}), P(fe, () => {
|
|
985
|
+
let e = 1 / ((ai * 2 + 1) ** 2 - 9), t = ue.mul(e), n = Mi(t, de.mul(e)).mul(oi);
|
|
986
|
+
D.assign(B(D.clamp(t.sub(n), t.add(n)), D, x));
|
|
864
987
|
});
|
|
865
988
|
{
|
|
866
|
-
let t = 1 / (
|
|
867
|
-
D.assign(
|
|
989
|
+
let t = 1 / (ii * 2 + 1) ** 2, n = k.mul(t), r = Mi(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);
|
|
990
|
+
D.assign(B(i, D, o));
|
|
868
991
|
}
|
|
869
|
-
|
|
992
|
+
W(a, g, Ai(T, D)).toWriteOnly();
|
|
870
993
|
});
|
|
871
994
|
});
|
|
872
995
|
return this._dispatchOf(d);
|
|
873
996
|
}
|
|
874
997
|
_buildTemporalStabilization(e) {
|
|
875
998
|
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;
|
|
876
|
-
return
|
|
877
|
-
let _ =
|
|
878
|
-
|
|
879
|
-
let f =
|
|
880
|
-
|
|
881
|
-
|
|
999
|
+
return Sn(() => {
|
|
1000
|
+
let _ = I(Y.x).mul(fi).add(I(R.x)), v = I(Y.y).mul(fi).add(I(R.y));
|
|
1001
|
+
P(_.lessThan(I(f)).and(v.lessThan(I(p))), () => {
|
|
1002
|
+
let f = L(_, v), p = Un(G(_), G(v)), y = U(i, f).w, b = U(n, f).toVar();
|
|
1003
|
+
P(y.greaterThanEqual(Rr), () => {
|
|
1004
|
+
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(), wn();
|
|
882
1005
|
});
|
|
883
|
-
let x =
|
|
1006
|
+
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), E = [
|
|
884
1007
|
1,
|
|
885
1008
|
2,
|
|
886
1009
|
4,
|
|
887
1010
|
8
|
|
888
|
-
].map((e) =>
|
|
1011
|
+
].map((e) => H(ne.bitAnd(G(e)).notEqual(G(0)), F(1), F(0))), ie = T.customWeights(E).map((e) => e.toVar()), ae = Vn(V(T.filter(E))).toVar(), oe = U(s, f).toVar(), se = oe.x.toVar(), D = se.toVar(), ce = se.mul(se).toVar();
|
|
889
1012
|
for (let e = -1; e <= 1; e++) for (let t = -1; t <= 1; t++) {
|
|
890
1013
|
if (t === 0 && e === 0) continue;
|
|
891
|
-
let n = this._clampCoord(_.add(t), v.add(e)), r =
|
|
1014
|
+
let n = this._clampCoord(_.add(t), v.add(e)), r = U(i, n).w, a = H(r.greaterThanEqual(Rr), se, U(s, n).x);
|
|
892
1015
|
D.addAssign(a), ce.addAssign(a.mul(a));
|
|
893
1016
|
}
|
|
894
1017
|
D.divAssign(9), ce.divAssign(9);
|
|
895
|
-
let O =
|
|
896
|
-
|
|
897
|
-
se.assign(
|
|
1018
|
+
let O = Mi(D, ce).toVar();
|
|
1019
|
+
P(w.lessThan(t.historyFixFrameNum), () => {
|
|
1020
|
+
se.assign(In(se, D.mul(F(1.2).add(F(1).div(w.add(1))))));
|
|
898
1021
|
});
|
|
899
|
-
let
|
|
900
|
-
w.assign(
|
|
901
|
-
let
|
|
902
|
-
|
|
903
|
-
let
|
|
904
|
-
|
|
905
|
-
let
|
|
906
|
-
|
|
907
|
-
let e =
|
|
908
|
-
|
|
909
|
-
}).ElseIf(g.equal(
|
|
910
|
-
|
|
911
|
-
}).ElseIf(g.equal(
|
|
912
|
-
|
|
913
|
-
}).ElseIf(g.equal(
|
|
1022
|
+
let k = z(this._sampleHistory((e) => U(l, e), C, T, ie, 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($r)), fe = F(1).div(F(1).add(A.mul(w.mul(ae)).div(ue))).toVar(), pe = In(w, t.historyFixFrameNum);
|
|
1023
|
+
w.assign(B(pe, w, fe));
|
|
1024
|
+
let me = m.add(1), he = this._handover(me), ge = ae.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(se, k.clamp(D.sub(O.mul(_e)), D.add(O.mul(_e))), In(ge, ve)).toVar();
|
|
1025
|
+
oe.assign(Ai(oe, ye)), W(e, p, J(ye, 0, 0, 0)).toWriteOnly();
|
|
1026
|
+
let be = t.maxAccum.mul(F(1).sub(h));
|
|
1027
|
+
W(u, p, J(In(w.add(1), be), x, 0, 0)).toWriteOnly();
|
|
1028
|
+
let xe = U(r, f), Se = J(Oi(oe.xyz).mul(z(xe.xyz, q(zr))), b.w).toVar();
|
|
1029
|
+
P(g.equal(I(1)), () => {
|
|
1030
|
+
let e = V(w.div(z(t.maxAccum, 1)));
|
|
1031
|
+
Se.assign(J(F(1).sub(e), e, .2, 1));
|
|
1032
|
+
}).ElseIf(g.equal(I(2)), () => {
|
|
1033
|
+
Se.assign(J(q(oe.w), 1));
|
|
1034
|
+
}).ElseIf(g.equal(I(3)), () => {
|
|
1035
|
+
Se.assign(J(q(x), 1));
|
|
1036
|
+
}).ElseIf(g.equal(I(4)), () => {
|
|
914
1037
|
let e = te.x.div(te.x.add(1));
|
|
915
|
-
|
|
916
|
-
}).ElseIf(g.equal(
|
|
917
|
-
|
|
918
|
-
}),
|
|
1038
|
+
Se.assign(J(q(e), 1));
|
|
1039
|
+
}).ElseIf(g.equal(I(5)), () => {
|
|
1040
|
+
Se.assign(J(q(te.z.div(15)), 1));
|
|
1041
|
+
}), W(d, p, Se).toWriteOnly();
|
|
919
1042
|
});
|
|
920
1043
|
})().compute([
|
|
921
1044
|
this._dispatchX,
|
|
922
1045
|
this._dispatchY,
|
|
923
1046
|
1
|
|
924
1047
|
], [
|
|
925
|
-
|
|
926
|
-
|
|
1048
|
+
fi,
|
|
1049
|
+
fi,
|
|
927
1050
|
1
|
|
928
1051
|
]);
|
|
929
1052
|
}
|
|
@@ -943,7 +1066,7 @@ var Vi = class extends E {
|
|
|
943
1066
|
}
|
|
944
1067
|
_updateRotators(e) {
|
|
945
1068
|
let t = (t, n) => {
|
|
946
|
-
let r =
|
|
1069
|
+
let r = Fi(e * 3 + n) * Math.PI * 2;
|
|
947
1070
|
t.value.set(Math.cos(r), Math.sin(r), -Math.sin(r), Math.cos(r));
|
|
948
1071
|
};
|
|
949
1072
|
t(this.rotPre, 0), t(this.rotBlur, 1), t(this.rotPost, 2);
|
|
@@ -970,7 +1093,7 @@ var Vi = class extends E {
|
|
|
970
1093
|
this._nTmpA.value = this._tmpA, this._nTmpB.value = this._tmpB, this._nHist.value = this._hist, this._nFast.value = this._fastHist, this._nInternal.value = this._internal, this._nGeom.value = this._geomPrev, this._nData.value = this._dataT, this._nStabRead.value = this._stabPing === 0 ? this._stabB : this._stabA, this.renderer.compute(this._kPre), this.renderer.compute(this._kTa), this.renderer.compute(this._kHf), this.renderer.compute(this._kBlur), this.renderer.compute(this._kPost), this.renderer.compute(this._stabPing === 0 ? this._kTsA : this._kTsB), this._srcRegion.max.set(this.outputTarget.width, this.outputTarget.height), this.renderer.copyTextureToTexture(this._tmpA, this.outputTarget.texture, this._srcRegion), e.setTexture("nrd:output", this.outputTarget.texture), this._stabPing = 1 - this._stabPing, this._needsReset = !1, this._needsReset = !1;
|
|
971
1094
|
}
|
|
972
1095
|
setSize(e, t) {
|
|
973
|
-
this.outputTarget.setSize(e, t), this.outputTarget.texture.needsUpdate = !0, this.resW.value = e, this.resH.value = t, this._dispatchX = Math.ceil(e /
|
|
1096
|
+
this.outputTarget.setSize(e, t), this.outputTarget.texture.needsUpdate = !0, this.resW.value = e, this.resH.value = t, this._dispatchX = Math.ceil(e / fi), this._dispatchY = Math.ceil(t / fi);
|
|
974
1097
|
let n = [
|
|
975
1098
|
this._dispatchX,
|
|
976
1099
|
this._dispatchY,
|
|
@@ -999,15 +1122,15 @@ var Vi = class extends E {
|
|
|
999
1122
|
for (let [e, t] of this._placeholders) e.dispose(), t.dispose();
|
|
1000
1123
|
this._placeholders.clear();
|
|
1001
1124
|
}
|
|
1002
|
-
},
|
|
1125
|
+
}, Li = (e) => H(e.equal(e), e, F(0)).clamp(0, 1e7), Ri = /* @__PURE__ */ Kn("\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"), zi = class extends E {
|
|
1003
1126
|
constructor(e, t = {}) {
|
|
1004
1127
|
super("VarianceEstimation", {
|
|
1005
1128
|
...t,
|
|
1006
|
-
executionMode:
|
|
1007
|
-
}), this.renderer = e, this.inputTextureName = t.inputTextureName || "pathtracer:color", this.varianceBoost =
|
|
1129
|
+
executionMode: ge.ALWAYS
|
|
1130
|
+
}), 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();
|
|
1008
1131
|
let n = t.width || 1, r = t.height || 1;
|
|
1009
|
-
this._storageTexA = new
|
|
1010
|
-
type:
|
|
1132
|
+
this._storageTexA = new M(k, k), this._storageTexA.type = sr, this._storageTexA.format = Q, this._storageTexA.minFilter = X, this._storageTexA.magFilter = X, this._storageTexB = new M(k, k), this._storageTexB.type = sr, this._storageTexB.format = Q, this._storageTexB.minFilter = X, this._storageTexB.magFilter = X, this._srcRegion = new Qn(new jr(0, 0), new jr(0, 0)), this._outputTarget = new bn(n, r, {
|
|
1133
|
+
type: sr,
|
|
1011
1134
|
format: Q,
|
|
1012
1135
|
minFilter: X,
|
|
1013
1136
|
magFilter: X,
|
|
@@ -1019,26 +1142,26 @@ var Vi = class extends E {
|
|
|
1019
1142
|
this.on("pathtracer:viewpointChanged", () => this.reset());
|
|
1020
1143
|
}
|
|
1021
1144
|
_buildCompute() {
|
|
1022
|
-
this._readTexNodeA = new
|
|
1145
|
+
this._readTexNodeA = new N(), this._readTexNodeB = new N(), this._computeNodeA = this._buildComputeForDirection(this._storageTexA, this._readTexNodeB), this._computeNodeB = this._buildComputeForDirection(this._storageTexB, this._readTexNodeA);
|
|
1023
1146
|
}
|
|
1024
1147
|
_buildComputeForDirection(e, t) {
|
|
1025
|
-
let n = this._colorTexNode, r = this.temporalAlpha, i = this.varianceBoost, a = this.resW, s = this.resH, c =
|
|
1026
|
-
return
|
|
1027
|
-
let l =
|
|
1028
|
-
c.element(d).assign(
|
|
1029
|
-
let e = d.add(
|
|
1030
|
-
c.element(e).assign(
|
|
1031
|
-
}),
|
|
1032
|
-
let _ =
|
|
1033
|
-
|
|
1034
|
-
let n =
|
|
1148
|
+
let n = this._colorTexNode, r = this.temporalAlpha, i = this.varianceBoost, a = this.resW, s = this.resH, c = qn("float", 100);
|
|
1149
|
+
return Sn(() => {
|
|
1150
|
+
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;
|
|
1151
|
+
c.element(d).assign(Li(o(g))), P(d.lessThan(G(36)), () => {
|
|
1152
|
+
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
|
+
c.element(e).assign(Li(o(i)));
|
|
1154
|
+
}), Jn();
|
|
1155
|
+
let _ = I(Y.x).mul(8).add(I(l)), v = I(Y.y).mul(8).add(I(u));
|
|
1156
|
+
P(_.lessThan(I(a)).and(v.lessThan(I(s))), () => {
|
|
1157
|
+
let n = F(0).toVar(), a = F(0).toVar();
|
|
1035
1158
|
for (let e = -1; e <= 1; e++) for (let t = -1; t <= 1; t++) {
|
|
1036
1159
|
let r = c.element(u.add(1 + e).mul(10).add(l.add(1 + t)));
|
|
1037
1160
|
n.addAssign(r), a.addAssign(r.mul(r));
|
|
1038
1161
|
}
|
|
1039
1162
|
n.divAssign(9), a.divAssign(9);
|
|
1040
|
-
let o =
|
|
1041
|
-
|
|
1163
|
+
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));
|
|
1164
|
+
W(e, Un(G(_), G(v)), Ri(s, d.x, d.y, r, o, i)).toWriteOnly();
|
|
1042
1165
|
});
|
|
1043
1166
|
})().compute([
|
|
1044
1167
|
this._dispatchX,
|
|
@@ -1084,23 +1207,23 @@ var Vi = class extends E {
|
|
|
1084
1207
|
reallocateReservedStorage() {
|
|
1085
1208
|
this._computeNodeA?.dispose(), this._computeNodeB?.dispose(), this._storageTexA?.dispose(), this._storageTexB?.dispose();
|
|
1086
1209
|
let e = () => {
|
|
1087
|
-
let e = new
|
|
1088
|
-
return e.type =
|
|
1210
|
+
let e = new M(k, k);
|
|
1211
|
+
return e.type = sr, e.format = Q, e.minFilter = X, e.magFilter = X, e;
|
|
1089
1212
|
};
|
|
1090
1213
|
this._storageTexA = e(), this._storageTexB = e(), this._buildCompute(), this._compiled = !1;
|
|
1091
1214
|
}
|
|
1092
1215
|
dispose() {
|
|
1093
1216
|
this._computeNodeA?.dispose(), this._computeNodeB?.dispose(), this._storageTexA?.dispose(), this._storageTexB?.dispose(), this._outputTarget?.dispose(), this._colorTexNode?.dispose(), this._readTexNodeA?.dispose(), this._readTexNodeB?.dispose();
|
|
1094
1217
|
}
|
|
1095
|
-
},
|
|
1218
|
+
}, Bi = /* @__PURE__ */ Kn("\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"), Vi = class extends E {
|
|
1096
1219
|
constructor(e, t = {}) {
|
|
1097
1220
|
super("BilateralFiltering", {
|
|
1098
1221
|
...t,
|
|
1099
|
-
executionMode:
|
|
1100
|
-
}), 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 =
|
|
1222
|
+
executionMode: ge.ALWAYS
|
|
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 = 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();
|
|
1101
1224
|
let n = t.width || 1, r = t.height || 1;
|
|
1102
|
-
this._storageTexA = new
|
|
1103
|
-
type:
|
|
1225
|
+
this._storageTexA = new M(k, k), this._storageTexA.type = cr, this._storageTexA.format = Q, this._storageTexA.minFilter = X, this._storageTexA.magFilter = X, this._storageTexB = new M(k, k), this._storageTexB.type = cr, this._storageTexB.format = Q, this._storageTexB.minFilter = X, this._storageTexB.magFilter = X, this._srcRegion = new Qn(new jr(0, 0), new jr(0, 0)), this._outputTarget = new bn(n, r, {
|
|
1226
|
+
type: cr,
|
|
1104
1227
|
format: Q,
|
|
1105
1228
|
minFilter: X,
|
|
1106
1229
|
magFilter: X,
|
|
@@ -1139,19 +1262,19 @@ var Vi = class extends E {
|
|
|
1139
1262
|
4 / 256,
|
|
1140
1263
|
1 / 256
|
|
1141
1264
|
];
|
|
1142
|
-
return
|
|
1143
|
-
let y =
|
|
1144
|
-
|
|
1145
|
-
let x =
|
|
1146
|
-
let t =
|
|
1147
|
-
return
|
|
1148
|
-
},
|
|
1265
|
+
return Sn(() => {
|
|
1266
|
+
let y = I(Y.x).mul(8).add(I(R.x)), b = I(Y.y).mul(8).add(I(R.y));
|
|
1267
|
+
P(y.lessThan(I(g)).and(b.lessThan(I(_))), () => {
|
|
1268
|
+
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(zr)), T = z(o(re), F(zr)).toVar(), E = h.equal(I(1)), ie = (e) => {
|
|
1269
|
+
let t = U(a, e);
|
|
1270
|
+
return B(t.z, z(t.z, t.w), f);
|
|
1271
|
+
}, ae = E.select(ie(x), S.w.mul(S.w)).toVar(), oe = d.mul(Vn(z(ae, F(0)))).div(T).add(F(1e-4)), se = q(0).toVar(), D = F(0).toVar(), ce = F(0).toVar();
|
|
1149
1272
|
for (let e = 0; e < 5; e++) for (let i = 0; i < 5; i++) {
|
|
1150
|
-
let a = i - 2, s = e - 2, d = v[e * 5 + i], f = y.add(p.mul(a)).clamp(
|
|
1151
|
-
se.addAssign(x.mul(T)), D.addAssign(T), ce.addAssign(T.mul(T).mul(
|
|
1273
|
+
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 = Bi(ne, o(x), te, C, w, re, ee, x, F(d), oe, l, u, c), ae = E.select(ie(L(f, m)), h.w.mul(h.w));
|
|
1274
|
+
se.addAssign(x.mul(T)), D.addAssign(T), ce.addAssign(T.mul(T).mul(z(ae, F(0))));
|
|
1152
1275
|
}
|
|
1153
|
-
let O = se.div(
|
|
1154
|
-
|
|
1276
|
+
let O = se.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, Vn(z(k, F(0))));
|
|
1277
|
+
W(e, Un(G(y), G(b)), J(ue, de)).toWriteOnly();
|
|
1155
1278
|
});
|
|
1156
1279
|
})().compute([
|
|
1157
1280
|
this._dispatchX,
|
|
@@ -1198,15 +1321,15 @@ var Vi = class extends E {
|
|
|
1198
1321
|
reallocateReservedStorage() {
|
|
1199
1322
|
this._computeNodeA?.dispose(), this._computeNodeB?.dispose(), this._storageTexA?.dispose(), this._storageTexB?.dispose();
|
|
1200
1323
|
let e = () => {
|
|
1201
|
-
let e = new
|
|
1202
|
-
return e.type =
|
|
1324
|
+
let e = new M(k, k);
|
|
1325
|
+
return e.type = cr, e.format = Q, e.minFilter = X, e.magFilter = X, e;
|
|
1203
1326
|
};
|
|
1204
1327
|
this._storageTexA = e(), this._storageTexB = e(), this._buildCompute(), this._compiled = !1;
|
|
1205
1328
|
}
|
|
1206
1329
|
dispose() {
|
|
1207
1330
|
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();
|
|
1208
1331
|
}
|
|
1209
|
-
},
|
|
1332
|
+
}, Hi = 6e4, Ui = (e) => H(e.equal(e), e, F(0)).clamp(0, 1e7), Wi = (e) => q(Ui(e.x), Ui(e.y), Ui(e.z)), Gi = 4, Ki = [
|
|
1210
1333
|
1 / 256,
|
|
1211
1334
|
4 / 256,
|
|
1212
1335
|
6 / 256,
|
|
@@ -1232,15 +1355,15 @@ var Vi = class extends E {
|
|
|
1232
1355
|
6 / 256,
|
|
1233
1356
|
4 / 256,
|
|
1234
1357
|
1 / 256
|
|
1235
|
-
],
|
|
1358
|
+
], qi = class extends E {
|
|
1236
1359
|
constructor(e, t = {}) {
|
|
1237
1360
|
super("EdgeAwareFiltering", {
|
|
1238
1361
|
...t,
|
|
1239
|
-
executionMode:
|
|
1240
|
-
}), this.renderer = e, this.filterStrength =
|
|
1362
|
+
executionMode: ge.PER_CYCLE
|
|
1363
|
+
}), 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();
|
|
1241
1364
|
let n = t.width || 1, r = t.height || 1;
|
|
1242
|
-
this._demodTex = this._makeStorageTex(), this._storageTexA = this._makeStorageTex(), this._storageTexB = this._makeStorageTex(), this._srcRegion = new
|
|
1243
|
-
type:
|
|
1365
|
+
this._demodTex = this._makeStorageTex(), this._storageTexA = this._makeStorageTex(), this._storageTexB = this._makeStorageTex(), this._srcRegion = new Qn(new jr(0, 0), new jr(0, 0)), this.outputTarget = new bn(n, r, {
|
|
1366
|
+
type: sr,
|
|
1244
1367
|
format: Q,
|
|
1245
1368
|
minFilter: X,
|
|
1246
1369
|
magFilter: X,
|
|
@@ -1249,19 +1372,19 @@ var Vi = class extends E {
|
|
|
1249
1372
|
}), this._compiled = !1, this._dispatchX = Math.ceil(n / 16), this._dispatchY = Math.ceil(r / 16), this._buildCompute();
|
|
1250
1373
|
}
|
|
1251
1374
|
_makeStorageTex() {
|
|
1252
|
-
let e = new
|
|
1253
|
-
return e.type =
|
|
1375
|
+
let e = new M(k, k);
|
|
1376
|
+
return e.type = sr, e.format = Q, e.minFilter = X, e.magFilter = X, e;
|
|
1254
1377
|
}
|
|
1255
1378
|
_buildCompute() {
|
|
1256
1379
|
this._computeDemod = this._buildDemod(), this._computeAtrousA = this._buildAtrous(this._storageTexA), this._computeAtrousB = this._buildAtrous(this._storageTexB);
|
|
1257
1380
|
}
|
|
1258
1381
|
_buildDemod() {
|
|
1259
1382
|
let e = this._colorTexNode, t = this._ndTexNode, n = this._albedoTexNode, r = this._demodTex, i = this.resW, a = this.resH;
|
|
1260
|
-
return
|
|
1261
|
-
let o =
|
|
1262
|
-
|
|
1263
|
-
let i =
|
|
1264
|
-
|
|
1383
|
+
return Sn(() => {
|
|
1384
|
+
let o = I(Y.x).mul(16).add(I(R.x)), s = I(Y.y).mul(16).add(I(R.y));
|
|
1385
|
+
P(o.lessThan(I(i)).and(s.lessThan(I(a))), () => {
|
|
1386
|
+
let i = L(o, s), a = U(e, i).xyz, c = U(t, i).w.lessThan(F(Hi)), l = U(n, i).xyz, u = H(c, z(l, q(zr)), q(1)), d = Wi(a.div(u));
|
|
1387
|
+
W(r, Un(G(o), G(s)), J(d, 1)).toWriteOnly();
|
|
1265
1388
|
});
|
|
1266
1389
|
})().compute([
|
|
1267
1390
|
this._dispatchX,
|
|
@@ -1275,19 +1398,19 @@ var Vi = class extends E {
|
|
|
1275
1398
|
}
|
|
1276
1399
|
_buildAtrous(e) {
|
|
1277
1400
|
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;
|
|
1278
|
-
return
|
|
1279
|
-
let v =
|
|
1280
|
-
|
|
1281
|
-
let b =
|
|
1282
|
-
let t =
|
|
1283
|
-
return
|
|
1284
|
-
}, se =
|
|
1401
|
+
return Sn(() => {
|
|
1402
|
+
let v = I(Y.x).mul(16).add(I(R.x)), y = I(Y.y).mul(16).add(I(R.y));
|
|
1403
|
+
P(v.lessThan(I(g)).and(y.lessThan(I(_))), () => {
|
|
1404
|
+
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(Hi)), ne = H(w, F(1), F(0)), re = U(a, b).xyz, T = H(w, z(re, q(zr)), q(1)), E = z(o(T), F(zr)), ie = m.equal(I(1)), ae = h.lessThan(I(Gi)), oe = (e) => {
|
|
1405
|
+
let t = U(s, e);
|
|
1406
|
+
return H(ae, z(t.z, t.w), t.z);
|
|
1407
|
+
}, se = ie.select(oe(b), x.w.mul(x.w)).toVar(), D = l.mul(Vn(z(se, F(0)))).div(E).add(F(1e-4)), ce = q(0).toVar(), O = F(0).toVar(), k = F(0).toVar();
|
|
1285
1408
|
for (let e = 0; e < 5; e++) for (let n = 0; n < 5; n++) {
|
|
1286
|
-
let a = n - 2, s = e - 2, c =
|
|
1287
|
-
ce.addAssign(m.mul(
|
|
1409
|
+
let a = n - 2, s = e - 2, c = Ki[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(Hi)), F(1), F(0)), w = ee.sub(h).abs().div(D).negate().exp(), re = Rn(jn(te, x).clamp(0, 1), u), T = C.sub(b).abs().div(z(C.mul(d), F(.001))).negate().exp(), E = ne.mul(S), ae = ne.oneMinus().mul(S.oneMinus()), se = E.add(ae), le = B(F(1), re.mul(T), E), ue = F(c).mul(w).mul(le).mul(se), de = ie.select(oe(l), p.w.mul(p.w));
|
|
1410
|
+
ce.addAssign(m.mul(ue)), O.addAssign(ue), k.addAssign(ue.mul(ue).mul(z(de, F(0))));
|
|
1288
1411
|
}
|
|
1289
|
-
let
|
|
1290
|
-
|
|
1412
|
+
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, Vn(z(ue, F(0))));
|
|
1413
|
+
W(e, Un(G(v), G(y)), J(pe, me)).toWriteOnly();
|
|
1291
1414
|
});
|
|
1292
1415
|
})().compute([
|
|
1293
1416
|
this._dispatchX,
|
|
@@ -1345,38 +1468,45 @@ var Vi = class extends E {
|
|
|
1345
1468
|
dispose() {
|
|
1346
1469
|
this._computeDemod?.dispose(), this._computeAtrousA?.dispose(), this._computeAtrousB?.dispose(), this._demodTex?.dispose(), this._storageTexA?.dispose(), this._storageTexB?.dispose(), this.outputTarget?.dispose(), this._colorTexNode?.dispose(), this._ndTexNode?.dispose(), this._snTexNode?.dispose(), this._albedoTexNode?.dispose(), this._varTexNode?.dispose(), this._readTexNode?.dispose();
|
|
1347
1470
|
}
|
|
1348
|
-
},
|
|
1471
|
+
}, Ji = {
|
|
1472
|
+
autoExposure: !1,
|
|
1473
|
+
autoExposureKeyValue: .18,
|
|
1474
|
+
autoExposureMinExposure: .1,
|
|
1475
|
+
autoExposureMaxExposure: 20,
|
|
1476
|
+
autoExposureAdaptSpeedBright: 3,
|
|
1477
|
+
autoExposureAdaptSpeedDark: .5
|
|
1478
|
+
}, Yi = 256, Xi = -8, Zi = 6 - Xi, Qi = Zi / Yi, $i = 1e4, ea = /* @__PURE__ */ Kn("\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"), ta = class extends E {
|
|
1349
1479
|
constructor(e, t = {}) {
|
|
1350
1480
|
super("AutoExposure", {
|
|
1351
1481
|
...t,
|
|
1352
|
-
executionMode:
|
|
1353
|
-
}), this.renderer = e, this.REDUCTION_SIZE = 64, this.keyValueU =
|
|
1482
|
+
executionMode: ge.ALWAYS
|
|
1483
|
+
}), this.renderer = e, this.REDUCTION_SIZE = 64, this.keyValueU = K(t.keyValue ?? Ji.autoExposureKeyValue), this.minExposureU = K(t.minExposure ?? Ji.autoExposureMinExposure), this.maxExposureU = K(t.maxExposure ?? Ji.autoExposureMaxExposure), this.adaptSpeedBrightU = K(t.adaptSpeedBright ?? Ji.autoExposureAdaptSpeedBright), this.adaptSpeedDarkU = K(t.adaptSpeedDark ?? Ji.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();
|
|
1354
1484
|
}
|
|
1355
1485
|
_initRenderTargets() {
|
|
1356
1486
|
let e = {
|
|
1357
|
-
type:
|
|
1487
|
+
type: sr,
|
|
1358
1488
|
format: Q,
|
|
1359
1489
|
minFilter: Z,
|
|
1360
1490
|
magFilter: Z,
|
|
1361
1491
|
depthBuffer: !1,
|
|
1362
1492
|
stencilBuffer: !1
|
|
1363
1493
|
};
|
|
1364
|
-
this._downsampleTarget = new
|
|
1494
|
+
this._downsampleTarget = new bn(this.REDUCTION_SIZE, this.REDUCTION_SIZE, e), this._downsampleStorageTex = new M(this.REDUCTION_SIZE, this.REDUCTION_SIZE), this._downsampleStorageTex.type = sr, this._downsampleStorageTex.format = Q, this._downsampleStorageTex.minFilter = Z, this._downsampleStorageTex.magFilter = Z, this._reductionStorageTex = new M(1, 1), this._reductionStorageTex.type = sr, this._reductionStorageTex.format = Q, this._reductionStorageTex.minFilter = Z, this._reductionStorageTex.magFilter = Z, this._reductionReadTarget = new bn(1, 1, e), this._adaptationResult = An(1, "vec4"), this._readbackBuffer = new yn(16), this._readbackBuffer.name = "AutoExposureAdaptation", this._histogramBuffer = An(Yi, "uint").toAtomic();
|
|
1365
1495
|
}
|
|
1366
1496
|
_buildCompute() {
|
|
1367
1497
|
this._buildDownsampleCompute(), this._buildHistogramCompute(), this._buildHistogramAnalyzeCompute(), this._buildAdaptationCompute();
|
|
1368
1498
|
}
|
|
1369
1499
|
_buildDownsampleCompute() {
|
|
1370
1500
|
let e = this._inputTexNode, t = this._downsampleStorageTex, n = this.epsilonU, r = this.inputResW, i = this.inputResH;
|
|
1371
|
-
this._downsampleComputeNode =
|
|
1372
|
-
let a =
|
|
1501
|
+
this._downsampleComputeNode = Sn(() => {
|
|
1502
|
+
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();
|
|
1373
1503
|
for (let t = 0; t < 4; t++) for (let r = 0; r < 4; r++) {
|
|
1374
|
-
let i = o(
|
|
1375
|
-
|
|
1504
|
+
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);
|
|
1505
|
+
P(i.greaterThan(n), () => {
|
|
1376
1506
|
f.addAssign(i.add(n).log()), p.addAssign(1);
|
|
1377
1507
|
});
|
|
1378
1508
|
}
|
|
1379
|
-
|
|
1509
|
+
W(t, Un(G(a), G(s)), J(f, p, 0, 1)).toWriteOnly();
|
|
1380
1510
|
})().compute([
|
|
1381
1511
|
64 / 8,
|
|
1382
1512
|
64 / 8,
|
|
@@ -1389,14 +1519,14 @@ var Vi = class extends E {
|
|
|
1389
1519
|
}
|
|
1390
1520
|
_buildHistogramCompute() {
|
|
1391
1521
|
let e = this._downsampleTarget.texture, t = this._histogramBuffer, n = this.centerWeightU;
|
|
1392
|
-
this._histogramComputeNode =
|
|
1393
|
-
let r =
|
|
1394
|
-
|
|
1522
|
+
this._histogramComputeNode = Sn(() => {
|
|
1523
|
+
let r = R.x;
|
|
1524
|
+
kn(t.element(r), G(0)), Jn();
|
|
1395
1525
|
for (let i = 0; i < 16; i++) {
|
|
1396
|
-
let a = r.mul(16).add(i), o = a.mod(64), s = a.div(64), c =
|
|
1397
|
-
|
|
1398
|
-
let e =
|
|
1399
|
-
|
|
1526
|
+
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;
|
|
1527
|
+
P(u.greaterThan(0), () => {
|
|
1528
|
+
let e = G(l.div(u).sub(F(Xi)).div(F(Zi)).mul(F(Yi)).floor().clamp(0, F(Yi - 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($i)));
|
|
1529
|
+
Dn(t.element(e), d);
|
|
1400
1530
|
});
|
|
1401
1531
|
}
|
|
1402
1532
|
})().compute([
|
|
@@ -1411,21 +1541,21 @@ var Vi = class extends E {
|
|
|
1411
1541
|
}
|
|
1412
1542
|
_buildHistogramAnalyzeCompute() {
|
|
1413
1543
|
let e = this._histogramBuffer, t = this._reductionStorageTex, n = this.lowPercentileU, r = this.highPercentileU;
|
|
1414
|
-
this._histogramAnalyzeNode =
|
|
1415
|
-
let i =
|
|
1416
|
-
|
|
1417
|
-
i.addAssign(
|
|
1544
|
+
this._histogramAnalyzeNode = Sn(() => {
|
|
1545
|
+
let i = F(0).toVar();
|
|
1546
|
+
Cn(Yi, ({ i: t }) => {
|
|
1547
|
+
i.addAssign(F(On(e.element(t))));
|
|
1418
1548
|
});
|
|
1419
|
-
let a = i.mul(n), o = i.mul(r), s =
|
|
1420
|
-
|
|
1421
|
-
let n =
|
|
1422
|
-
u.assign(s), s.addAssign(n),
|
|
1423
|
-
let e =
|
|
1549
|
+
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();
|
|
1550
|
+
Cn(Yi, ({ i: t }) => {
|
|
1551
|
+
let n = F(On(e.element(t)));
|
|
1552
|
+
u.assign(s), s.addAssign(n), P(u.lessThan(o).and(s.greaterThan(a)), () => {
|
|
1553
|
+
let e = F(Xi).add(F(t).add(.5).mul(F(Qi)));
|
|
1424
1554
|
c.addAssign(e.mul(n)), l.addAssign(n);
|
|
1425
1555
|
});
|
|
1426
1556
|
});
|
|
1427
|
-
let d =
|
|
1428
|
-
|
|
1557
|
+
let d = z(l, F(1)), f = c.div(d), p = f.exp();
|
|
1558
|
+
W(t, Un(G(0), G(0)), J(p, i, f, 1)).toWriteOnly();
|
|
1429
1559
|
})().compute(1, [
|
|
1430
1560
|
1,
|
|
1431
1561
|
1,
|
|
@@ -1434,9 +1564,9 @@ var Vi = class extends E {
|
|
|
1434
1564
|
}
|
|
1435
1565
|
_buildAdaptationCompute() {
|
|
1436
1566
|
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;
|
|
1437
|
-
this._adaptationComputeNode =
|
|
1438
|
-
let u =
|
|
1439
|
-
t.element(
|
|
1567
|
+
this._adaptationComputeNode = Sn(() => {
|
|
1568
|
+
let u = U(e, L(I(0), I(0))).x, d = ea(u, l, n, r, i, a, o, s, c);
|
|
1569
|
+
t.element(G(0)).assign(d);
|
|
1440
1570
|
})().compute(1, [
|
|
1441
1571
|
1,
|
|
1442
1572
|
1,
|
|
@@ -1497,16 +1627,16 @@ var Vi = class extends E {
|
|
|
1497
1627
|
dispose() {
|
|
1498
1628
|
this._downsampleComputeNode?.dispose(), this._histogramComputeNode?.dispose(), this._histogramAnalyzeNode?.dispose(), this._adaptationComputeNode?.dispose(), this._downsampleTarget?.dispose(), this._downsampleStorageTex?.dispose(), this._reductionStorageTex?.dispose(), this._reductionReadTarget?.dispose(), this._readbackBuffer?.dispose(), this._inputTexNode?.dispose(), this._reductionReadTexNode?.dispose();
|
|
1499
1629
|
}
|
|
1500
|
-
},
|
|
1501
|
-
function
|
|
1502
|
-
return
|
|
1630
|
+
}, na = new $(), ra = new $();
|
|
1631
|
+
function ia(e, t) {
|
|
1632
|
+
return ra.subVectors(e, t.position).dot(t.getWorldDirection(na));
|
|
1503
1633
|
}
|
|
1504
|
-
function
|
|
1505
|
-
return n ? e.distance :
|
|
1634
|
+
function aa(e, t, n = !1) {
|
|
1635
|
+
return n ? e.distance : ia(e.point, t);
|
|
1506
1636
|
}
|
|
1507
|
-
var
|
|
1637
|
+
var oa = class extends or {
|
|
1508
1638
|
constructor({ scene: e, camera: t, canvas: n, assetLoader: r, pathTracer: i, floorPlane: a }) {
|
|
1509
|
-
super(), this.scene = e, this.camera = t, this.canvas = n, this.assetLoader = r, this.pathTracer = i, this.floorPlane = a, this.raycaster = new
|
|
1639
|
+
super(), this.scene = e, this.camera = t, this.canvas = n, this.assetLoader = r, this.pathTracer = i, this.floorPlane = a, this.raycaster = new Cr(), 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;
|
|
1510
1640
|
}
|
|
1511
1641
|
setDependencies({ overlayManager: e, transformManager: t, appDispatch: n, orbitControls: r, helperScene: i }) {
|
|
1512
1642
|
this._overlayManager = e || null, this._transformManager = t || null, this._appDispatch = n || null, this._orbitControls = r || null, this._helperScene = i || null;
|
|
@@ -1514,7 +1644,7 @@ var ua = class extends Sr {
|
|
|
1514
1644
|
select(e) {
|
|
1515
1645
|
let t = this._overlayManager?.getHelper("outline");
|
|
1516
1646
|
t && t.setSelectedObjects(e ? [e] : []), this.selectedObject = e || null, e ? this._transformManager?.attach(e) : this._transformManager?.detach(), this._appDispatch?.({
|
|
1517
|
-
type:
|
|
1647
|
+
type: j.OBJECT_SELECTED,
|
|
1518
1648
|
object: e || null
|
|
1519
1649
|
});
|
|
1520
1650
|
}
|
|
@@ -1538,7 +1668,7 @@ var ua = class extends Sr {
|
|
|
1538
1668
|
this.raycaster.setFromCamera(t, this.camera);
|
|
1539
1669
|
let n = this.raycaster.intersectObjects(this.scene.children, !0);
|
|
1540
1670
|
if (n.length > 0) {
|
|
1541
|
-
let e = n[0], t = this.pathTracer?.cameraProjection?.value ===
|
|
1671
|
+
let e = n[0], t = this.pathTracer?.cameraProjection?.value === he.equirectangular, r = aa(e, this.camera, t);
|
|
1542
1672
|
this.showFocusPoint(e.point), this.toggleFocusMode(), this.dispatchEvent({
|
|
1543
1673
|
type: "focusChanged",
|
|
1544
1674
|
distance: r / this.assetLoader.getSceneScale(),
|
|
@@ -1547,7 +1677,7 @@ var ua = class extends Sr {
|
|
|
1547
1677
|
}
|
|
1548
1678
|
}
|
|
1549
1679
|
showFocusPoint(e) {
|
|
1550
|
-
this.focusPointIndicator && this.scene.remove(this.focusPointIndicator), this.focusPointIndicator = new
|
|
1680
|
+
this.focusPointIndicator && this.scene.remove(this.focusPointIndicator), this.focusPointIndicator = new mr(new Dr(this.assetLoader.getSceneScale() * .02, 16, 16), new hr({
|
|
1551
1681
|
color: 65280,
|
|
1552
1682
|
transparent: !0,
|
|
1553
1683
|
opacity: .8,
|
|
@@ -1710,35 +1840,35 @@ var ua = class extends Sr {
|
|
|
1710
1840
|
wireAppEvents(e) {
|
|
1711
1841
|
this.addEventListener("objectSelected", (t) => {
|
|
1712
1842
|
this.select(t.object), e.refreshFrame(), e.dispatchEvent({
|
|
1713
|
-
type:
|
|
1843
|
+
type: j.OBJECT_SELECTED,
|
|
1714
1844
|
object: t.object,
|
|
1715
1845
|
uuid: t.uuid
|
|
1716
1846
|
});
|
|
1717
1847
|
}), this.addEventListener("objectDeselected", (t) => {
|
|
1718
1848
|
this.select(null), e.refreshFrame(), e.dispatchEvent({
|
|
1719
|
-
type:
|
|
1849
|
+
type: j.OBJECT_DESELECTED,
|
|
1720
1850
|
object: t.object,
|
|
1721
1851
|
uuid: t.uuid
|
|
1722
1852
|
});
|
|
1723
1853
|
}), this.addEventListener("selectModeChanged", (t) => {
|
|
1724
1854
|
e.dispatchEvent({
|
|
1725
|
-
type:
|
|
1855
|
+
type: j.SELECT_MODE_CHANGED,
|
|
1726
1856
|
enabled: t.enabled
|
|
1727
1857
|
});
|
|
1728
1858
|
}), this.addEventListener("objectDoubleClicked", (t) => {
|
|
1729
1859
|
this.select(t.object), e.refreshFrame(), e.dispatchEvent({
|
|
1730
|
-
type:
|
|
1860
|
+
type: j.OBJECT_DOUBLE_CLICKED,
|
|
1731
1861
|
object: t.object,
|
|
1732
1862
|
uuid: t.uuid
|
|
1733
1863
|
});
|
|
1734
1864
|
}), this.addEventListener("focusChanged", (t) => {
|
|
1735
1865
|
e.settings.set("focusDistance", t.worldDistance), e.dispatchEvent({
|
|
1736
|
-
type:
|
|
1866
|
+
type: j.FOCUS_CHANGED,
|
|
1737
1867
|
distance: t.distance
|
|
1738
1868
|
});
|
|
1739
1869
|
}), this.addEventListener("afPointPlaced", (t) => {
|
|
1740
1870
|
e.dispatchEvent({
|
|
1741
|
-
type:
|
|
1871
|
+
type: j.AF_POINT_PLACED,
|
|
1742
1872
|
point: t.point
|
|
1743
1873
|
});
|
|
1744
1874
|
});
|
|
@@ -1746,7 +1876,7 @@ var ua = class extends Sr {
|
|
|
1746
1876
|
dispose() {
|
|
1747
1877
|
this.canvas.removeEventListener("click", this.handleAFPointClick), this.canvas.removeEventListener("click", this.handleFocusClick), this.canvas.removeEventListener("mousedown", this.handleMouseDown), this.canvas.removeEventListener("mouseup", this.handleMouseUp), this.canvas.removeEventListener("click", this.handleSelectClick), this.canvas.removeEventListener("dblclick", this.handleSelectDoubleClick), this.canvas.removeEventListener("contextmenu", this.handleContextMenu), this.canvas.removeEventListener("pointerdown", this.handleContextPointerDown), this.canvas.removeEventListener("pointerup", this.handleContextPointerUp), this.clickTimeout &&= (clearTimeout(this.clickTimeout), null), this.mouseDownPosition = null, this.contextPointerDownPosition = null, this.focusPointIndicator &&= (this.scene.remove(this.focusPointIndicator), null), this.canvas.style.cursor = "auto", this.scene = null, this.camera = null, this.canvas = null, this.assetLoader = null, this.pathTracer = null, this.floorPlane = null, this.raycaster = null;
|
|
1748
1878
|
}
|
|
1749
|
-
},
|
|
1879
|
+
}, sa = 8, ca = 4, la = .25, ua = fr.degToRad(89), da = .25, fa = {
|
|
1750
1880
|
KeyD: [
|
|
1751
1881
|
1,
|
|
1752
1882
|
0,
|
|
@@ -1797,15 +1927,15 @@ var ua = class extends Sr {
|
|
|
1797
1927
|
0,
|
|
1798
1928
|
-1
|
|
1799
1929
|
]
|
|
1800
|
-
},
|
|
1930
|
+
}, pa = "input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=textbox], [role=combobox], [role=listbox], [role=menu], [role=menuitem]", ma = (e) => e.shiftKey ? ca : e.altKey ? la : 1, ha = { type: "change" }, ga = { type: "start" }, _a = new $(), va = new $(), ya = new $(), ba = new $(), xa = new Sr(), Sa = class extends nr {
|
|
1801
1931
|
constructor(e, t, n) {
|
|
1802
|
-
super(e, t), this.orbit = n, this.enabled = !1, this.speed = 1 /
|
|
1932
|
+
super(e, t), this.orbit = n, this.enabled = !1, this.speed = 1 / sa, this._held = /* @__PURE__ */ new Set(), this._factor = 1, this._lastTime = 0, this._drag = null, this._onKeyDown = this._onKeyDown.bind(this), this._onKeyUp = this._onKeyUp.bind(this), this.release = this.release.bind(this), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), t && this.connect(t);
|
|
1803
1933
|
}
|
|
1804
1934
|
get active() {
|
|
1805
1935
|
return this.enabled && this.orbit.enabled;
|
|
1806
1936
|
}
|
|
1807
1937
|
fitSpeed(e) {
|
|
1808
|
-
this.speed = (e > 0 ? e : 1) /
|
|
1938
|
+
this.speed = (e > 0 ? e : 1) / sa;
|
|
1809
1939
|
}
|
|
1810
1940
|
connect(e) {
|
|
1811
1941
|
super.connect(e);
|
|
@@ -1825,34 +1955,34 @@ var ua = class extends Sr {
|
|
|
1825
1955
|
if (!this._held.size || !this.active) return !1;
|
|
1826
1956
|
let t = 0, n = 0, r = 0;
|
|
1827
1957
|
for (let e of this._held) {
|
|
1828
|
-
let [i, a, o] =
|
|
1958
|
+
let [i, a, o] = fa[e];
|
|
1829
1959
|
t += i, n += a, r += o;
|
|
1830
1960
|
}
|
|
1831
1961
|
if (!t && !n && !r) return !1;
|
|
1832
1962
|
let i = this.object;
|
|
1833
|
-
return
|
|
1963
|
+
return va.set(1, 0, 0).applyQuaternion(i.quaternion), _a.crossVectors(i.up, va).normalize(), va.crossVectors(_a, i.up), ya.set(0, 0, 0).addScaledVector(va, t).addScaledVector(_a, n).addScaledVector(i.up, r).normalize().multiplyScalar(this.speed * this._factor * e), i.position.add(ya), this.orbit.target.add(ya), i.updateMatrixWorld(), this.dispatchEvent(ha), !0;
|
|
1834
1964
|
}
|
|
1835
1965
|
_elapsed() {
|
|
1836
|
-
let e = performance.now(), t = Math.min((e - this._lastTime) / 1e3,
|
|
1966
|
+
let e = performance.now(), t = Math.min((e - this._lastTime) / 1e3, da);
|
|
1837
1967
|
return this._lastTime = e, t;
|
|
1838
1968
|
}
|
|
1839
1969
|
_look(e, t) {
|
|
1840
|
-
let n = this.object, r = this.orbit.target, i = n.position.distanceTo(r) || 1, a =
|
|
1841
|
-
n.quaternion.premultiply(
|
|
1842
|
-
let o = Math.asin(
|
|
1843
|
-
n.quaternion.multiply(
|
|
1970
|
+
let n = this.object, r = this.orbit.target, i = n.position.distanceTo(r) || 1, a = fr.degToRad(n.fov) / (this.domElement.clientHeight || 1);
|
|
1971
|
+
n.quaternion.premultiply(xa.setFromAxisAngle(n.up, e * a)), n.getWorldDirection(_a);
|
|
1972
|
+
let o = Math.asin(fr.clamp(_a.dot(n.up), -1, 1)), s = fr.clamp(o + t * a, -ua, ua);
|
|
1973
|
+
n.quaternion.multiply(xa.setFromAxisAngle(ba.set(1, 0, 0), s - o)), n.updateMatrixWorld(), r.copy(n.position).addScaledVector(n.getWorldDirection(_a), i), this.dispatchEvent(ha);
|
|
1844
1974
|
}
|
|
1845
1975
|
_onKeyDown(e) {
|
|
1846
|
-
if (!(!this.active || e.defaultPrevented || e.target?.closest?.(
|
|
1976
|
+
if (!(!this.active || e.defaultPrevented || e.target?.closest?.(pa))) {
|
|
1847
1977
|
if (e.metaKey || e.ctrlKey) {
|
|
1848
1978
|
this.release();
|
|
1849
1979
|
return;
|
|
1850
1980
|
}
|
|
1851
|
-
this._factor =
|
|
1981
|
+
this._factor = ma(e), fa[e.code] && (e.preventDefault(), !this._held.has(e.code) && (this._held.add(e.code), this._held.size === 1 && (this._lastTime = performance.now(), this.dispatchEvent(ga))));
|
|
1852
1982
|
}
|
|
1853
1983
|
}
|
|
1854
1984
|
_onKeyUp(e) {
|
|
1855
|
-
this._factor =
|
|
1985
|
+
this._factor = ma(e), this._held.delete(e.code);
|
|
1856
1986
|
}
|
|
1857
1987
|
release() {
|
|
1858
1988
|
this._held.clear(), this._factor = 1;
|
|
@@ -1873,20 +2003,24 @@ var ua = class extends Sr {
|
|
|
1873
2003
|
_onPointerUp(e) {
|
|
1874
2004
|
this._drag?.id === e.pointerId && (this._drag = null, this.domElement.releasePointerCapture?.(e.pointerId));
|
|
1875
2005
|
}
|
|
1876
|
-
},
|
|
2006
|
+
}, Ca = {
|
|
2007
|
+
autoFocusMode: "auto",
|
|
2008
|
+
afScreenPoint: {
|
|
2009
|
+
x: .5,
|
|
2010
|
+
y: .5
|
|
2011
|
+
},
|
|
2012
|
+
afSmoothingFactor: .15
|
|
2013
|
+
}, wa = .05, Ta = 10, Ea = .5, Da = Object.freeze(new $(1, 1, 1)), Oa = (e) => e?.isOrthographicCamera ? (e.top - e.bottom) / e.zoom : null, ka = class extends or {
|
|
1877
2014
|
constructor(e) {
|
|
1878
2015
|
super();
|
|
1879
2016
|
let t = e.clientWidth, n = e.clientHeight;
|
|
1880
|
-
this.camera = new _(60, t / n || 1, .01, 1e3), this.camera.position.set(0, 0, 5), this.controls = new
|
|
1881
|
-
x: .5,
|
|
1882
|
-
y: .5
|
|
1883
|
-
}, this.afSmoothingFactor = it.SMOOTHING_FACTOR, this._lastValidFocusDistance = null, this._smoothedFocusDistance = null, this._afPointDirty = !1, this._afSuspended = !1, this._afPick = null, this._defaultCameraState = null, this._onResize = null, this._onReset = null, this._getSettings = null, this._applySettings = null;
|
|
2017
|
+
this.camera = new _(60, t / n || 1, .01, 1e3), this.camera.position.set(0, 0, 5), this.controls = new Pr(this.camera, e), this.controls.screenSpacePanning = !0, this.controls.zoomToCursor = !0, this.controls.saveState(), this._reportedOrthoHeight = null, this._reportOrthoHeight = this._reportOrthoHeight.bind(this), this.controls.addEventListener("change", this._reportOrthoHeight), this.walkControls = new Sa(this.camera, e, this.controls), this.interactionManager = null, this.cameras = [this.camera], this.currentCameraIndex = 0, this._userCameraCounter = 0, this.autoFocusMode = Ca.autoFocusMode, this.afScreenPoint = { ...Ca.afScreenPoint }, this.afSmoothingFactor = Ca.afSmoothingFactor, this._lastValidFocusDistance = null, this._smoothedFocusDistance = null, this._afPointDirty = !1, this._afSuspended = !1, this._afPick = null, this._defaultCameraState = null, this._onResize = null, this._onReset = null, this._getSettings = null, this._applySettings = null;
|
|
1884
2018
|
}
|
|
1885
2019
|
setCameras(e) {
|
|
1886
2020
|
this.cameras = e, this._userCameraCounter = 0, this.resetAutoFocus();
|
|
1887
2021
|
}
|
|
1888
2022
|
addCameraFromView(e) {
|
|
1889
|
-
let t = this.camera, n = t.orthographic ? new
|
|
2023
|
+
let t = this.camera, n = t.orthographic ? new yr(t.left, t.right, t.top, t.bottom, t.near, t.far) : new br(t.fov, t.aspect, t.near, t.far);
|
|
1890
2024
|
return n.zoom = t.zoom, n.position.copy(t.position), n.quaternion.copy(t.quaternion), n.scale.copy(t.scale), n.updateMatrixWorld(!0), n.userData.__rayzeeUserCamera = !0, n.userData.__rayzeeEffects = this._captureEffects(), this.controls && (n.userData.__rayzeeOrbitTarget = this.controls.target.clone()), this._userCameraCounter += 1, n.name = e || `View Camera ${this._userCameraCounter}`, this.cameras.push(n), this.cameras.length - 1;
|
|
1891
2025
|
}
|
|
1892
2026
|
removeCamera(e) {
|
|
@@ -1945,7 +2079,7 @@ var ua = class extends Sr {
|
|
|
1945
2079
|
this.resetAutoFocus();
|
|
1946
2080
|
let a = this.cameras[e], o = a?.userData?.__rayzeeEffects;
|
|
1947
2081
|
this._showOrthographic(o ? o.orthoHeight : Oa(a)), this._applyEffects(o), n?.(), r?.(), this.dispatchEvent({
|
|
1948
|
-
type:
|
|
2082
|
+
type: j.CAMERA_SWITCHED,
|
|
1949
2083
|
cameraIndex: e,
|
|
1950
2084
|
effects: this._captureEffects(),
|
|
1951
2085
|
fov: this.camera.fov,
|
|
@@ -1982,7 +2116,7 @@ var ua = class extends Sr {
|
|
|
1982
2116
|
if (t.orthographic !== n) {
|
|
1983
2117
|
if (n) this._setView(!0, this._fittedHalfHeight());
|
|
1984
2118
|
else {
|
|
1985
|
-
let e = this.controls.target, n = this.orthoHeight / 2 / Math.tan(
|
|
2119
|
+
let e = this.controls.target, n = this.orthoHeight / 2 / Math.tan(fr.degToRad(t.fov) / 2);
|
|
1986
2120
|
t.position.sub(e).setLength(n).add(e), this._setView(!1);
|
|
1987
2121
|
}
|
|
1988
2122
|
this.controls.update();
|
|
@@ -2002,13 +2136,13 @@ var ua = class extends Sr {
|
|
|
2002
2136
|
n.orthographic = e, n.orthoHalfHeight = t, n.zoom = 1, n.updateProjectionMatrix(), this._reportOrthoHeight();
|
|
2003
2137
|
}
|
|
2004
2138
|
_fittedHalfHeight() {
|
|
2005
|
-
return this.camera.position.distanceTo(this.controls.target) * Math.tan(
|
|
2139
|
+
return this.camera.position.distanceTo(this.controls.target) * Math.tan(fr.degToRad(this.camera.fov) / 2);
|
|
2006
2140
|
}
|
|
2007
2141
|
_reportOrthoHeight() {
|
|
2008
2142
|
if (!this.camera.orthographic) return;
|
|
2009
2143
|
let e = this.orthoHeight;
|
|
2010
2144
|
e !== this._reportedOrthoHeight && (this._reportedOrthoHeight = e, this.dispatchEvent({
|
|
2011
|
-
type:
|
|
2145
|
+
type: j.ORTHO_HEIGHT_UPDATED,
|
|
2012
2146
|
height: e
|
|
2013
2147
|
}));
|
|
2014
2148
|
}
|
|
@@ -2023,7 +2157,7 @@ var ua = class extends Sr {
|
|
|
2023
2157
|
this.walkControls.release();
|
|
2024
2158
|
let r = this.interactionManager?.pickSurface(0, 0);
|
|
2025
2159
|
if (!r) return;
|
|
2026
|
-
let i =
|
|
2160
|
+
let i = fr.clamp(r.distance, n.minDistance, n.maxDistance);
|
|
2027
2161
|
n.target.copy(this.camera.position).addScaledVector(this.camera.getWorldDirection(new $()), i), n.update();
|
|
2028
2162
|
}
|
|
2029
2163
|
get navigationMode() {
|
|
@@ -2079,7 +2213,7 @@ var ua = class extends Sr {
|
|
|
2079
2213
|
let n = {
|
|
2080
2214
|
index: t,
|
|
2081
2215
|
name: e.name ?? "",
|
|
2082
|
-
effects:
|
|
2216
|
+
effects: je(e.userData?.__rayzeeEffects) ?? null
|
|
2083
2217
|
};
|
|
2084
2218
|
return t === 0 || !e.userData?.__rayzeeUserCamera ? n : {
|
|
2085
2219
|
...n,
|
|
@@ -2111,8 +2245,8 @@ var ua = class extends Sr {
|
|
|
2111
2245
|
let n = /* @__PURE__ */ new Map();
|
|
2112
2246
|
for (let r of e.cameras ?? []) {
|
|
2113
2247
|
if (r.user) {
|
|
2114
|
-
let e = r.orthographic ? new
|
|
2115
|
-
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 =
|
|
2248
|
+
let e = r.orthographic ? new yr(...r.frustum, r.near, r.far) : new br(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 = ye(r.effects), r.orbitTarget && (e.userData.__rayzeeOrbitTarget = new $().fromArray(r.orbitTarget)), n.set(r.index, this.cameras.length), this.cameras.push(e);
|
|
2116
2250
|
continue;
|
|
2117
2251
|
}
|
|
2118
2252
|
let e = this.cameras[r.index];
|
|
@@ -2120,13 +2254,13 @@ var ua = class extends Sr {
|
|
|
2120
2254
|
t.push(r.name);
|
|
2121
2255
|
continue;
|
|
2122
2256
|
}
|
|
2123
|
-
n.set(r.index, r.index), r.effects && (e.userData.__rayzeeEffects =
|
|
2257
|
+
n.set(r.index, r.index), r.effects && (e.userData.__rayzeeEffects = ye(r.effects));
|
|
2124
2258
|
}
|
|
2125
2259
|
this._userCameraCounter = this.cameras.filter((e) => e.userData?.__rayzeeUserCamera).length, this.currentCameraIndex = n.get(e.current) ?? 0;
|
|
2126
2260
|
let r = e.defaultView;
|
|
2127
2261
|
this._defaultCameraState = r ? {
|
|
2128
2262
|
position: new $().fromArray(r.position),
|
|
2129
|
-
quaternion: new
|
|
2263
|
+
quaternion: new Sr().fromArray(r.quaternion),
|
|
2130
2264
|
scale: new $().fromArray(r.scale),
|
|
2131
2265
|
fov: r.fov,
|
|
2132
2266
|
near: r.near,
|
|
@@ -2139,7 +2273,7 @@ var ua = class extends Sr {
|
|
|
2139
2273
|
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();
|
|
2140
2274
|
}
|
|
2141
2275
|
return e.autoFocus && (this.setAutoFocusMode(e.autoFocus.mode), this.setAFScreenPoint(e.autoFocus.point.x, e.autoFocus.point.y)), this.resetAutoFocus(), this._reportOrthoHeight(), this.dispatchEvent({
|
|
2142
|
-
type:
|
|
2276
|
+
type: j.CAMERA_SWITCHED,
|
|
2143
2277
|
cameraIndex: this.currentCameraIndex,
|
|
2144
2278
|
effects: this._captureEffects(),
|
|
2145
2279
|
fov: this.camera.fov,
|
|
@@ -2175,7 +2309,7 @@ var ua = class extends Sr {
|
|
|
2175
2309
|
if (!t || !this.interactionManager) return;
|
|
2176
2310
|
let { assetLoader: n, currentFocusDistance: r, pathTracer: i, setFocusDistance: a, softReset: o, hardReset: s } = t;
|
|
2177
2311
|
if (this.autoFocusMode === "manual") return;
|
|
2178
|
-
if (!i?.enableDOF?.value || i.cameraProjection?.value ===
|
|
2312
|
+
if (!i?.enableDOF?.value || i.cameraProjection?.value === he.equirectangular) {
|
|
2179
2313
|
this._afSuspended = !0;
|
|
2180
2314
|
return;
|
|
2181
2315
|
}
|
|
@@ -2183,25 +2317,25 @@ var ua = class extends Sr {
|
|
|
2183
2317
|
let c = i;
|
|
2184
2318
|
if (c?.isReady && c.renderMode?.value === 1 && c.frameCount > 0 && !c.isComplete) return;
|
|
2185
2319
|
let l = this._pickFocusPoint(c.resetCount), u;
|
|
2186
|
-
if (l) u =
|
|
2320
|
+
if (l) u = ia(l, this.camera), this._lastValidFocusDistance = u;
|
|
2187
2321
|
else if (this._lastValidFocusDistance !== null) u = this._lastValidFocusDistance;
|
|
2188
2322
|
else {
|
|
2189
|
-
let e = this.controls ?
|
|
2190
|
-
u = e > 0 ? e :
|
|
2323
|
+
let e = this.controls ? ia(this.controls.target, this.camera) : 0;
|
|
2324
|
+
u = e > 0 ? e : Ta * (n?.getSceneScale() || 1), this._lastValidFocusDistance = u;
|
|
2191
2325
|
}
|
|
2192
2326
|
let d = this._afPointDirty;
|
|
2193
|
-
this._afPointDirty = !1, d || this._smoothedFocusDistance === null || this._smoothedFocusDistance === 0 || Math.abs(u - this._smoothedFocusDistance) / this._smoothedFocusDistance >
|
|
2327
|
+
this._afPointDirty = !1, d || this._smoothedFocusDistance === null || this._smoothedFocusDistance === 0 || Math.abs(u - this._smoothedFocusDistance) / this._smoothedFocusDistance > Ea ? this._smoothedFocusDistance = u : this._smoothedFocusDistance += this.afSmoothingFactor * (u - this._smoothedFocusDistance);
|
|
2194
2328
|
let f = r, p = this._smoothedFocusDistance;
|
|
2195
2329
|
if (d || f === 0 || Math.abs(p - f) / Math.max(f, .001) > .001) {
|
|
2196
2330
|
a(p);
|
|
2197
2331
|
let e = n?.getSceneScale() || 1;
|
|
2198
2332
|
this.dispatchEvent({
|
|
2199
|
-
type:
|
|
2333
|
+
type: j.AUTO_FOCUS_UPDATED,
|
|
2200
2334
|
distance: p / e,
|
|
2201
2335
|
worldDistance: p
|
|
2202
2336
|
});
|
|
2203
2337
|
let t = Math.abs(p - f) / Math.max(f, .001);
|
|
2204
|
-
d ? s?.() : t >
|
|
2338
|
+
d ? s?.() : t > wa && o?.();
|
|
2205
2339
|
}
|
|
2206
2340
|
}
|
|
2207
2341
|
_pickFocusPoint(e) {
|
|
@@ -2211,8 +2345,8 @@ var ua = class extends Sr {
|
|
|
2211
2345
|
resetCount: NaN,
|
|
2212
2346
|
x: NaN,
|
|
2213
2347
|
y: NaN,
|
|
2214
|
-
view: new
|
|
2215
|
-
projection: new
|
|
2348
|
+
view: new pr(),
|
|
2349
|
+
projection: new pr()
|
|
2216
2350
|
};
|
|
2217
2351
|
if (this._afPointDirty || e !== i.resetCount || n !== i.x || r !== i.y || !i.view.equals(t.matrixWorld) || !i.projection.equals(t.projectionMatrix)) {
|
|
2218
2352
|
let a = this.interactionManager.pickSurface(n * 2 - 1, 1 - r * 2);
|
|
@@ -2235,7 +2369,7 @@ var ua = class extends Sr {
|
|
|
2235
2369
|
dispose() {
|
|
2236
2370
|
this.walkControls?.dispose(), this.controls?.removeEventListener("change", this._reportOrthoHeight), this.controls?.dispose();
|
|
2237
2371
|
}
|
|
2238
|
-
}, Aa = .001, ja = 2, Ma = (e, t, n, r) => new e(t, n, r,
|
|
2372
|
+
}, Aa = .001, ja = 2, Ma = (e, t, n, r) => new e(t, n, r, lr).createInterpolant(), Na = class {
|
|
2239
2373
|
constructor(e, t) {
|
|
2240
2374
|
this._cameraManager = e, this._onChange = t, this.keys = [], this._nextId = 1, this._interpolants = null;
|
|
2241
2375
|
}
|
|
@@ -2310,7 +2444,7 @@ var ua = class extends Sr {
|
|
|
2310
2444
|
orthoHeight: 0
|
|
2311
2445
|
}) {
|
|
2312
2446
|
if (!this.keys.length) return null;
|
|
2313
|
-
let { position: n, target: r, fov: i, logHeight: a, start: o, end: s } = this._interpolants ??= this._build(), c =
|
|
2447
|
+
let { position: n, target: r, fov: i, logHeight: a, start: o, end: s } = this._interpolants ??= this._build(), c = fr.clamp(e, o, s);
|
|
2314
2448
|
return t.position.fromArray(n.evaluate(c)), t.target.fromArray(r.evaluate(c)), t.fov = i.evaluate(c)[0], t.orthoHeight = Math.exp(a.evaluate(c)[0]), t;
|
|
2315
2449
|
}
|
|
2316
2450
|
_build() {
|
|
@@ -2329,10 +2463,10 @@ var ua = class extends Sr {
|
|
|
2329
2463
|
return {
|
|
2330
2464
|
start: t,
|
|
2331
2465
|
end: n,
|
|
2332
|
-
position: Ma(
|
|
2333
|
-
target: Ma(
|
|
2334
|
-
fov: Ma(
|
|
2335
|
-
logHeight: Ma(
|
|
2466
|
+
position: Ma(Nr, ".position", e, i((e) => e.position)),
|
|
2467
|
+
target: Ma(Nr, ".target", e, i((e) => e.target)),
|
|
2468
|
+
fov: Ma(_r, ".fov", e, r.map((e) => e.fov)),
|
|
2469
|
+
logHeight: Ma(_r, ".orthoHeight", e, r.map((e) => Math.log(e.orthoHeight)))
|
|
2336
2470
|
};
|
|
2337
2471
|
}
|
|
2338
2472
|
_changed() {
|
|
@@ -2349,9 +2483,9 @@ function Pa({ position: e, target: t, fov: n, orthoHeight: r }) {
|
|
|
2349
2483
|
}
|
|
2350
2484
|
//#endregion
|
|
2351
2485
|
//#region src/managers/timeline/TimelineManager.js
|
|
2352
|
-
var Fa = class extends
|
|
2486
|
+
var Fa = class extends or {
|
|
2353
2487
|
constructor({ cameraManager: e, onReset: t }) {
|
|
2354
|
-
super(), this._cameraManager = e, this._onReset = t, this.camera = new Na(e, () => this._changed("camera")), this._playback = null, this._timer = new
|
|
2488
|
+
super(), this._cameraManager = e, this._onReset = t, this.camera = new Na(e, () => this._changed("camera")), this._playback = null, this._timer = new Or(), typeof document < "u" && this._timer.connect(document);
|
|
2355
2489
|
}
|
|
2356
2490
|
get duration() {
|
|
2357
2491
|
return this.camera.duration;
|
|
@@ -2383,7 +2517,7 @@ var Fa = class extends Sr {
|
|
|
2383
2517
|
let e = this._playback;
|
|
2384
2518
|
if (!e) return;
|
|
2385
2519
|
this._timer.update(), e.elapsed += this._timer.getDelta();
|
|
2386
|
-
let t =
|
|
2520
|
+
let t = fr.clamp(e.elapsed, 0, this.duration);
|
|
2387
2521
|
this.seek(t), t >= this.duration && this.stop();
|
|
2388
2522
|
}
|
|
2389
2523
|
serialize() {
|
|
@@ -2400,7 +2534,7 @@ var Fa = class extends Sr {
|
|
|
2400
2534
|
}
|
|
2401
2535
|
_changed(e) {
|
|
2402
2536
|
this.dispatchEvent({
|
|
2403
|
-
type:
|
|
2537
|
+
type: j.TIMELINE_CHANGED,
|
|
2404
2538
|
track: e
|
|
2405
2539
|
});
|
|
2406
2540
|
}
|
|
@@ -2419,8 +2553,8 @@ var Fa = class extends Sr {
|
|
|
2419
2553
|
let t = c.getImageData(0, 0, r, i);
|
|
2420
2554
|
o.set(t.data, e * r * i * 4), performance.now() - l > 16 && (await new Promise((e) => setTimeout(e, 0)), l = performance.now());
|
|
2421
2555
|
}
|
|
2422
|
-
let u = new
|
|
2423
|
-
u.minFilter = X, u.magFilter = X, u.format = Q, u.type =
|
|
2556
|
+
let u = new ir(o, r, i, a);
|
|
2557
|
+
u.minFilter = X, u.magFilter = X, u.format = Q, u.type = kr, u.generateMipmaps = !1, u.needsUpdate = !0;
|
|
2424
2558
|
let d = this.texture;
|
|
2425
2559
|
return this.texture = u, this.entries = e.map((e, t) => ({
|
|
2426
2560
|
name: e.name,
|
|
@@ -2436,7 +2570,7 @@ var Fa = class extends Sr {
|
|
|
2436
2570
|
if (o.userData = o.userData || {}, t == null) delete o.userData.gobo;
|
|
2437
2571
|
else {
|
|
2438
2572
|
let e = this.entries.find((e) => e.name === t);
|
|
2439
|
-
if (!e) return this._issues?.record(
|
|
2573
|
+
if (!e) return this._issues?.record(Ze.ASSET_UNREACHABLE, `no gobo named "${t}" is loaded — the light projects without one`, {
|
|
2440
2574
|
name: t,
|
|
2441
2575
|
asset: "gobo"
|
|
2442
2576
|
}), !1;
|
|
@@ -2631,7 +2765,7 @@ var Ja = class {
|
|
|
2631
2765
|
grid: Va(a, t, n)
|
|
2632
2766
|
};
|
|
2633
2767
|
} catch (t) {
|
|
2634
|
-
return this._issues?.warn(
|
|
2768
|
+
return this._issues?.warn(Ze.ASSET_UNREACHABLE, `IES profile "${e.name}" could not be loaded: ${t.message}`, {
|
|
2635
2769
|
url: e.url,
|
|
2636
2770
|
asset: "ies",
|
|
2637
2771
|
cause: t.message
|
|
@@ -2657,8 +2791,8 @@ var Ja = class {
|
|
|
2657
2791
|
lumens: i.lumens
|
|
2658
2792
|
});
|
|
2659
2793
|
}
|
|
2660
|
-
let c = new
|
|
2661
|
-
c.format = Q, c.type =
|
|
2794
|
+
let c = new ir(o, t, n, i);
|
|
2795
|
+
c.format = Q, c.type = kr, c.minFilter = X, c.magFilter = X, c.generateMipmaps = !1, c.needsUpdate = !0;
|
|
2662
2796
|
let l = this.texture;
|
|
2663
2797
|
return this.texture = c, this.entries = s, this.pathTracer.iesProfiles = c, this.pathTracer.shaderBuilder?.updateIESProfiles?.(c), l?.dispose?.(), this.entries.map(({ name: e, index: t }) => ({
|
|
2664
2798
|
name: e,
|
|
@@ -2682,7 +2816,7 @@ var Ja = class {
|
|
|
2682
2816
|
if (t == null) delete i.userData.ies;
|
|
2683
2817
|
else {
|
|
2684
2818
|
let e = this.entries.find((e) => e.name === t);
|
|
2685
|
-
if (!e) return this._issues?.record(
|
|
2819
|
+
if (!e) return this._issues?.record(Ze.ASSET_UNREACHABLE, `no IES profile named "${t}" is loaded — the light keeps its plain distribution`, {
|
|
2686
2820
|
name: t,
|
|
2687
2821
|
asset: "ies"
|
|
2688
2822
|
}), a;
|
|
@@ -2717,7 +2851,7 @@ function Ya(e) {
|
|
|
2717
2851
|
}
|
|
2718
2852
|
//#endregion
|
|
2719
2853
|
//#region src/Passes/OIDNDenoiser.js
|
|
2720
|
-
var Xa =
|
|
2854
|
+
var Xa = Ke("oidn"), Za = 16, Qa = null;
|
|
2721
2855
|
async function $a() {
|
|
2722
2856
|
return Qa ||= (await import("oidn-web/dist/oidn.js")).initUNetFromBuffer, Qa;
|
|
2723
2857
|
}
|
|
@@ -2847,7 +2981,7 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
|
|
|
2847
2981
|
if ( gid.x >= size.x || gid.y >= size.y ) { return; }
|
|
2848
2982
|
dst[ gid.y * size.x + gid.x ] = textureLoad( src, gid.xy, 0 );
|
|
2849
2983
|
}
|
|
2850
|
-
`, mo = class extends
|
|
2984
|
+
`, mo = class extends or {
|
|
2851
2985
|
constructor(e, t = {}) {
|
|
2852
2986
|
if (super(), !e) throw Error("OIDNDenoiser requires a renderer");
|
|
2853
2987
|
this.renderer = e, this._renderWidth = e.domElement.width, this._renderHeight = e.domElement.height, this.backendParamsGetter = t.backendParams || null, this.getGPUTextures = t.getGPUTextures || null, this.gpuDevice = null, this._gpuInputBuffers = {
|
|
@@ -2950,7 +3084,7 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
|
|
|
2950
3084
|
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;
|
|
2951
3085
|
}
|
|
2952
3086
|
_generateTzaUrl() {
|
|
2953
|
-
let { oidnWeightsBaseUrl: e } =
|
|
3087
|
+
let { oidnWeightsBaseUrl: e } = at(), { QUALITY_MODELS: t } = eo;
|
|
2954
3088
|
return `${e}${(t[this.quality] || t.balance).model}.tza`;
|
|
2955
3089
|
}
|
|
2956
3090
|
async updateConfiguration(e) {
|
|
@@ -2968,7 +3102,7 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
|
|
|
2968
3102
|
continuous: e
|
|
2969
3103
|
});
|
|
2970
3104
|
let t = performance.now(), n = await this.execute(e);
|
|
2971
|
-
return n && (this.renderer?.resetState?.(), this.lastDenoiseMs = performance.now() - t, Xa.debug(`denoise complete in ${
|
|
3105
|
+
return n && (this.renderer?.resetState?.(), this.lastDenoiseMs = performance.now() - t, Xa.debug(`denoise complete in ${We.ms(this.lastDenoiseMs)} · quality ${this.quality}`)), n;
|
|
2972
3106
|
}
|
|
2973
3107
|
async execute(e = !1) {
|
|
2974
3108
|
if (!this.enabled || !this.unet) return !1;
|
|
@@ -3276,12 +3410,12 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
|
|
|
3276
3410
|
format: "rgba16float",
|
|
3277
3411
|
usage: GPUTextureUsage.STORAGE_BINDING | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_SRC
|
|
3278
3412
|
});
|
|
3279
|
-
let r = new
|
|
3413
|
+
let r = new gn(this._outGPUTexture);
|
|
3280
3414
|
r.name = "oidn:output", r.image = {
|
|
3281
3415
|
width: t,
|
|
3282
3416
|
height: n,
|
|
3283
3417
|
depth: 1
|
|
3284
|
-
}, r.type =
|
|
3418
|
+
}, r.type = cr, r.format = Q, r.colorSpace = gr, r.minFilter = Z, r.magFilter = Z, r.wrapS = er, r.wrapT = er, r.generateMipmaps = !1, r.flipY = !1, this._outTexture = r, this._outTexSize = {
|
|
3285
3419
|
width: t,
|
|
3286
3420
|
height: n
|
|
3287
3421
|
};
|
|
@@ -3460,7 +3594,7 @@ fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
|
|
|
3460
3594
|
var pick = -1;
|
|
3461
3595
|
var movedFlag = 0;
|
|
3462
3596
|
|
|
3463
|
-
if ( P.reset == 0u && g.w < ${
|
|
3597
|
+
if ( P.reset == 0u && g.w < ${Rr.toFixed(1)} ) {
|
|
3464
3598
|
|
|
3465
3599
|
let size = vec2<f32>( P.size );
|
|
3466
3600
|
let uv = ( vec2<f32>( gid.xy ) + 0.5 ) / size;
|
|
@@ -3894,7 +4028,7 @@ var Po = {
|
|
|
3894
4028
|
}
|
|
3895
4029
|
};
|
|
3896
4030
|
function Fo() {
|
|
3897
|
-
let { upscalerModelBaseUrl: e } =
|
|
4031
|
+
let { upscalerModelBaseUrl: e } = at(), t = {};
|
|
3898
4032
|
for (let n in Po) {
|
|
3899
4033
|
t[n] = {};
|
|
3900
4034
|
for (let r in Po[n]) t[n][r] = e + Po[n][r];
|
|
@@ -3914,10 +4048,10 @@ var Io = {
|
|
|
3914
4048
|
}],
|
|
3915
4049
|
graphOptimizationLevel: "all"
|
|
3916
4050
|
}
|
|
3917
|
-
}, Lo = class extends
|
|
4051
|
+
}, Lo = class extends or {
|
|
3918
4052
|
constructor(e, t, n = {}) {
|
|
3919
4053
|
if (super(), !e || !t) throw Error("AIUpscaler requires output canvas and renderer");
|
|
3920
|
-
this.renderer = t, this.input = t.domElement, this.output = e, this.getSourceCanvas = n.getSourceCanvas || null, this.getGPUTextures = n.getGPUTextures || null, this.getExposure = n.getExposure || (() => 1), this.getToneMapping = n.getToneMapping || (() =>
|
|
4054
|
+
this.renderer = t, this.input = t.domElement, this.output = e, this.getSourceCanvas = n.getSourceCanvas || null, this.getGPUTextures = n.getGPUTextures || null, this.getExposure = n.getExposure || (() => 1), this.getToneMapping = n.getToneMapping || (() => Yn), this.getSaturation = n.getSaturation || (() => 1), this.enabled = !1, this.hdr = !1, this.scaleFactor = n.scaleFactor || 2, this.quality = n.quality || "fast", this.refreshInput = n.refreshInput || null, this.tileSize = n.tileSize || Io.TILE_SIZE, this._tileSizeOverride = !!n.tileSize, this.state = {
|
|
3921
4055
|
isUpscaling: !1,
|
|
3922
4056
|
isLoading: !1,
|
|
3923
4057
|
abortController: null
|
|
@@ -3937,7 +4071,7 @@ var Io = {
|
|
|
3937
4071
|
this._worker ||= new No(), await new Promise((e, n) => {
|
|
3938
4072
|
let r = (t) => {
|
|
3939
4073
|
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)));
|
|
3940
|
-
}, { ortRuntimeUrl: i, ortWasmPaths: a, cacheNamespace: o, storage: s } =
|
|
4074
|
+
}, { ortRuntimeUrl: i, ortWasmPaths: a, cacheNamespace: o, storage: s } = at();
|
|
3941
4075
|
this._worker.addEventListener("message", r), this._worker.postMessage({
|
|
3942
4076
|
type: "load",
|
|
3943
4077
|
url: t,
|
|
@@ -4057,13 +4191,13 @@ var Io = {
|
|
|
4057
4191
|
let e = this.getGPUTextures();
|
|
4058
4192
|
if (!e?.color) throw Error("No GPU color texture available for HDR capture");
|
|
4059
4193
|
let t = e.color, { width: n, height: r } = t;
|
|
4060
|
-
this._toneMapper ??= new
|
|
4194
|
+
this._toneMapper ??= new xt(this.renderer.backend.device, "aiupscaler-tonemap", {
|
|
4061
4195
|
input: "texture",
|
|
4062
4196
|
output: "planar"
|
|
4063
4197
|
}), this._toneMapper.ensureSize(n, r);
|
|
4064
4198
|
let i = await this._toneMapper.toPlanar(t, {
|
|
4065
4199
|
exposure: this.getExposure(),
|
|
4066
|
-
toneMapping: this.getToneMapping() ??
|
|
4200
|
+
toneMapping: this.getToneMapping() ?? Yn,
|
|
4067
4201
|
saturation: this.getSaturation()
|
|
4068
4202
|
});
|
|
4069
4203
|
return this._toneMapper.release(), {
|
|
@@ -4181,9 +4315,9 @@ var Io = {
|
|
|
4181
4315
|
async dispose() {
|
|
4182
4316
|
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");
|
|
4183
4317
|
}
|
|
4184
|
-
}, Ro =
|
|
4318
|
+
}, Ro = Ke("neural"), zo = 120, Bo = 2, Vo = 1, Ho = 0, Uo = 300, Wo = 5, Go = 3, Ko = 3, qo = 16, Jo = (e) => Math.max(0, 1 - e / qo), Yo = class extends or {
|
|
4185
4319
|
constructor({ renderer: e, mainCanvas: t, stages: n, pipeline: r, getExposure: i, getSaturation: a, issues: o = null }) {
|
|
4186
|
-
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 =
|
|
4320
|
+
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 = qr.oidnQuality, this.finalDenoise = qr.enableOIDN, this.continuousDenoise = qr.continuousDenoise, this.continuousDenoiseInterval = qr.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 = qr.oidnTemporalHistory, this._history = null, this._historyDirty = !0, this._knownResetCount = 0, this._seenTracedFrames = 0, this._viewProj = new pr(), this._historyCamera = {
|
|
4187
4321
|
world: null,
|
|
4188
4322
|
projInv: null,
|
|
4189
4323
|
viewProj: null,
|
|
@@ -4192,7 +4326,7 @@ var Io = {
|
|
|
4192
4326
|
count: 0,
|
|
4193
4327
|
leaves: new Uint32Array(),
|
|
4194
4328
|
toPrev: new Float32Array()
|
|
4195
|
-
}, this._matA = new
|
|
4329
|
+
}, this._matA = new pr(), this._matB = new pr(), this._lastRenderWidth = 0, this._lastRenderHeight = 0, this._pendingStartUpscaler = null, this._pendingCloseDenoise = null, this._denoiserStartHandler = null, this._denoiserEndHandler = null, this._denoiserTileHandler = null, this._denoiserErrorHandler = null, this._upscalerResChangedHandler = null, this._upscalerStartHandler = null, this._upscalerProgressHandler = null, this._upscalerEndHandler = null;
|
|
4196
4330
|
}
|
|
4197
4331
|
_createUpscalerCanvas(e) {
|
|
4198
4332
|
let t = e.parentNode;
|
|
@@ -4204,7 +4338,7 @@ var Io = {
|
|
|
4204
4338
|
return (this.denoiser?.gpuBytes?.() ?? 0) + (this._history?.gpuBytes?.() ?? 0);
|
|
4205
4339
|
}
|
|
4206
4340
|
_recordNoOverlayCanvas(e) {
|
|
4207
|
-
this._issues?.record(
|
|
4341
|
+
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 });
|
|
4208
4342
|
}
|
|
4209
4343
|
setRenderSize(e, t) {
|
|
4210
4344
|
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();
|
|
@@ -4215,7 +4349,8 @@ var Io = {
|
|
|
4215
4349
|
setupDenoiser() {
|
|
4216
4350
|
let e = this._stages.pathTracer;
|
|
4217
4351
|
this.denoiser = new mo(this.renderer, {
|
|
4218
|
-
|
|
4352
|
+
enableOIDN: qr.enableOIDN,
|
|
4353
|
+
oidnQuality: qr.oidnQuality,
|
|
4219
4354
|
backendParams: () => ({
|
|
4220
4355
|
device: this.renderer.backend.device,
|
|
4221
4356
|
adapterInfo: null
|
|
@@ -4232,11 +4367,11 @@ var Io = {
|
|
|
4232
4367
|
};
|
|
4233
4368
|
}
|
|
4234
4369
|
}), this._syncOIDNInUse(), this._denoiserStartHandler = (e) => this.dispatchEvent({
|
|
4235
|
-
type:
|
|
4370
|
+
type: j.DENOISING_START,
|
|
4236
4371
|
continuous: !!e.continuous
|
|
4237
4372
|
}), this._denoiserEndHandler = (e) => {
|
|
4238
4373
|
this.denoiser?.hasOutput && this._publishOutput(), this.dispatchEvent({
|
|
4239
|
-
type:
|
|
4374
|
+
type: j.DENOISING_END,
|
|
4240
4375
|
continuous: !!e.continuous
|
|
4241
4376
|
});
|
|
4242
4377
|
}, this._denoiserTileHandler = (e) => {
|
|
@@ -4244,7 +4379,7 @@ var Io = {
|
|
|
4244
4379
|
this._publishOutput();
|
|
4245
4380
|
let t = this.pipeline?.context;
|
|
4246
4381
|
this._stages.compositor && t && this._stages.compositor.render(t);
|
|
4247
|
-
}, this._denoiserErrorHandler = (e) => e.url && this._issues?.record(
|
|
4382
|
+
}, this._denoiserErrorHandler = (e) => e.url && this._issues?.record(Ze.ASSET_UNREACHABLE, `denoiser weights "${e.url}" could not be loaded — the render is not denoised`, {
|
|
4248
4383
|
url: e.url,
|
|
4249
4384
|
asset: "oidn-weights",
|
|
4250
4385
|
cause: String(e.error?.message ?? e.error)
|
|
@@ -4254,8 +4389,8 @@ var Io = {
|
|
|
4254
4389
|
if (!this.upscalerCanvas) return;
|
|
4255
4390
|
let e = this._stages.pathTracer;
|
|
4256
4391
|
this.upscaler = new Lo(this.upscalerCanvas, this.renderer, {
|
|
4257
|
-
scaleFactor:
|
|
4258
|
-
quality:
|
|
4392
|
+
scaleFactor: qr.upscalerScale || 2,
|
|
4393
|
+
quality: qr.upscalerQuality || "fast",
|
|
4259
4394
|
getSourceCanvas: () => this.renderer.domElement,
|
|
4260
4395
|
refreshInput: () => {
|
|
4261
4396
|
let e = this.pipeline?.context;
|
|
@@ -4269,14 +4404,14 @@ var Io = {
|
|
|
4269
4404
|
getExposure: () => this._getEffectiveExposure(),
|
|
4270
4405
|
getToneMapping: () => this._getToneMapping(),
|
|
4271
4406
|
getSaturation: () => this._getSaturation()
|
|
4272
|
-
}), this.upscaler.enabled =
|
|
4273
|
-
type:
|
|
4407
|
+
}), this.upscaler.enabled = qr.enableUpscaler || !1, this._upscalerResChangedHandler = (e) => this.dispatchEvent({
|
|
4408
|
+
type: j.RESOLUTION_CHANGED,
|
|
4274
4409
|
width: e.width,
|
|
4275
4410
|
height: e.height
|
|
4276
|
-
}), this._upscalerStartHandler = () => this.dispatchEvent({ type:
|
|
4277
|
-
type:
|
|
4411
|
+
}), this._upscalerStartHandler = () => this.dispatchEvent({ type: j.UPSCALING_START }), this._upscalerProgressHandler = (e) => this.dispatchEvent({
|
|
4412
|
+
type: j.UPSCALING_PROGRESS,
|
|
4278
4413
|
progress: e.progress
|
|
4279
|
-
}), this._upscalerEndHandler = () => this.dispatchEvent({ type:
|
|
4414
|
+
}), 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);
|
|
4280
4415
|
}
|
|
4281
4416
|
get denoiserStrategy() {
|
|
4282
4417
|
return this.continuousDenoise ? "oidn" : this._stages.asvgf?.enabled ? "asvgf" : this._stages.nrd?.enabled ? "nrd" : this._stages.edgeFilter?.enabled ? "edgeaware" : "none";
|
|
@@ -4389,7 +4524,7 @@ var Io = {
|
|
|
4389
4524
|
}
|
|
4390
4525
|
get historyActive() {
|
|
4391
4526
|
let e = this._stages.pathTracer;
|
|
4392
|
-
return this.historyWanted && !this._cadenceSuspended && !!this._stages.normalDepth?.enabled && e?.uniforms?.get("cameraProjection")?.value !==
|
|
4527
|
+
return this.historyWanted && !this._cadenceSuspended && !!this._stages.normalDepth?.enabled && e?.uniforms?.get("cameraProjection")?.value !== he.equirectangular && !(e?.visMode?.value > 0);
|
|
4393
4528
|
}
|
|
4394
4529
|
beforeReset({ keepHistory: e = !1 } = {}) {
|
|
4395
4530
|
let t = this._stages.pathTracer;
|
|
@@ -4471,7 +4606,7 @@ var Io = {
|
|
|
4471
4606
|
let e = this._stages.pathTracer;
|
|
4472
4607
|
this._viewProj.multiplyMatrices(e.cameraProjectionMatrix.value, e.cameraViewMatrix.value);
|
|
4473
4608
|
let t = this._historyCamera;
|
|
4474
|
-
return t.world = e.cameraWorldMatrix.value.elements, t.projInv = e.cameraProjectionMatrixInverse.value.elements, t.viewProj = this._viewProj.elements, t.orthographic = e.uniforms?.get("cameraProjection")?.value ===
|
|
4609
|
+
return t.world = e.cameraWorldMatrix.value.elements, t.projInv = e.cameraProjectionMatrixInverse.value.elements, t.viewProj = this._viewProj.elements, t.orthographic = e.uniforms?.get("cameraProjection")?.value === he.orthographic, t;
|
|
4475
4610
|
}
|
|
4476
4611
|
_ensureHistory() {
|
|
4477
4612
|
return this._history ??= new Ao(this.renderer.backend.device), this._history.settings.cleanAux = !!this.denoiser?.expectsCleanAux(this._finalQuality), this._history;
|
|
@@ -4486,7 +4621,7 @@ var Io = {
|
|
|
4486
4621
|
_restoreRenderDisplay() {
|
|
4487
4622
|
let e = this.upscalerCanvas && this.upscalerCanvas.style.display !== "none";
|
|
4488
4623
|
return this.upscalerCanvas && (this.upscalerCanvas.style.display = "none"), this.mainCanvas && (this.mainCanvas.style.opacity = "1"), e && this._lastRenderWidth && this._lastRenderHeight && this.dispatchEvent({
|
|
4489
|
-
type:
|
|
4624
|
+
type: j.RESOLUTION_CHANGED,
|
|
4490
4625
|
width: this._lastRenderWidth,
|
|
4491
4626
|
height: this._lastRenderHeight
|
|
4492
4627
|
}), !!e;
|
|
@@ -4514,11 +4649,11 @@ var Io = {
|
|
|
4514
4649
|
Ro.warn("neural pass skipped: no denoised picture — it needs OIDN");
|
|
4515
4650
|
return;
|
|
4516
4651
|
}
|
|
4517
|
-
this._neuralPostBusy = !0, this.dispatchEvent({ type:
|
|
4652
|
+
this._neuralPostBusy = !0, this.dispatchEvent({ type: j.UPSCALING_START });
|
|
4518
4653
|
try {
|
|
4519
|
-
let r = await import("./NeuralSuperRes-
|
|
4654
|
+
let r = await import("./NeuralSuperRes-sZAeS142.js").then((e) => e.t);
|
|
4520
4655
|
this._superResModule = r;
|
|
4521
|
-
let i = n ? await import("./NeuralRetouch-
|
|
4656
|
+
let i = n ? await import("./NeuralRetouch-BCXylThH.js").then((e) => e.t) : null, a = this.denoiser?._outTexSize, o = (a?.width ?? 0) * (a?.height ?? 0), s = n && o <= i.RETOUCH_MAX_PIXELS;
|
|
4522
4657
|
if (n && !s && (Ro.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;
|
|
4523
4658
|
let c = {
|
|
4524
4659
|
exposure: this._getEffectiveExposure(),
|
|
@@ -4549,14 +4684,14 @@ var Io = {
|
|
|
4549
4684
|
return;
|
|
4550
4685
|
}
|
|
4551
4686
|
this.mainCanvas && (this.mainCanvas.style.opacity = "0"), this.dispatchEvent({
|
|
4552
|
-
type:
|
|
4687
|
+
type: j.RESOLUTION_CHANGED,
|
|
4553
4688
|
width: u.width,
|
|
4554
4689
|
height: u.height
|
|
4555
4690
|
});
|
|
4556
4691
|
} catch (e) {
|
|
4557
4692
|
Ro.warn("neural pass failed", e);
|
|
4558
4693
|
} finally {
|
|
4559
|
-
this._neuralPostBusy = !1, this.dispatchEvent({ type:
|
|
4694
|
+
this._neuralPostBusy = !1, this.dispatchEvent({ type: j.UPSCALING_END });
|
|
4560
4695
|
}
|
|
4561
4696
|
}
|
|
4562
4697
|
}
|
|
@@ -4707,17 +4842,17 @@ var Io = {
|
|
|
4707
4842
|
].forEach((t) => e.removeTexture(t));
|
|
4708
4843
|
}
|
|
4709
4844
|
_applyNRDPreset(e) {
|
|
4710
|
-
let t =
|
|
4845
|
+
let t = Gr[e];
|
|
4711
4846
|
if (!t) return;
|
|
4712
4847
|
let n = {};
|
|
4713
|
-
for (let e of
|
|
4848
|
+
for (let e of Wr) n[e] = Ur[e];
|
|
4714
4849
|
this._stages.nrd?.updateParameters({
|
|
4715
4850
|
...n,
|
|
4716
4851
|
...t
|
|
4717
4852
|
});
|
|
4718
4853
|
}
|
|
4719
4854
|
_applyASVGFPreset(e) {
|
|
4720
|
-
let t =
|
|
4855
|
+
let t = Br[e];
|
|
4721
4856
|
t && (this._stages.asvgf?.updateParameters(t), this._stages.bilateralFilter?.updateParameters(t), this._stages.variance && t.varianceBoost !== void 0 && (this._stages.variance.varianceBoost.value = t.varianceBoost));
|
|
4722
4857
|
}
|
|
4723
4858
|
}, Xo = class {
|
|
@@ -4749,13 +4884,13 @@ var Io = {
|
|
|
4749
4884
|
this.layer = "scene", this._enabled = !0, this._scene = e, this._camera = t, this._build([]);
|
|
4750
4885
|
}
|
|
4751
4886
|
_build(e) {
|
|
4752
|
-
this._orthographic = this._camera.isOrthographicCamera === !0, this._outlineNode =
|
|
4887
|
+
this._orthographic = this._camera.isOrthographicCamera === !0, this._outlineNode = Fr(this._scene, this._camera, {
|
|
4753
4888
|
selectedObjects: e,
|
|
4754
|
-
edgeThickness:
|
|
4755
|
-
edgeGlow:
|
|
4889
|
+
edgeThickness: K(1),
|
|
4890
|
+
edgeGlow: K(0)
|
|
4756
4891
|
});
|
|
4757
|
-
let t =
|
|
4758
|
-
this._material = new
|
|
4892
|
+
let t = K(3), n = K(new tr(16777215)), r = K(new tr(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);
|
|
4893
|
+
this._material = new _n(), this._material.colorNode = J(o, s), this._material.transparent = !0, this._material.blending = rr, this._material.blendEquation = Xn, this._material.blendSrc = vr, this._material.blendDst = vr, this._material.blendEquationAlpha = Xn, this._material.blendSrcAlpha = vr, this._material.blendDstAlpha = vr, this._material.toneMapped = !1, this._material.depthTest = !1, this._material.depthWrite = !1, this._quad = new vn(this._material);
|
|
4759
4894
|
}
|
|
4760
4895
|
setSelectedObjects(e) {
|
|
4761
4896
|
this._outlineNode.selectedObjects = e;
|
|
@@ -4803,13 +4938,13 @@ var es = 4096, ts = class {
|
|
|
4803
4938
|
}
|
|
4804
4939
|
async init({ device: e, sizeSource: t }) {
|
|
4805
4940
|
this._sizeSource = t;
|
|
4806
|
-
let n = e.onuncapturederror, r = new
|
|
4941
|
+
let n = e.onuncapturederror, r = new xn({
|
|
4807
4942
|
canvas: this.canvas,
|
|
4808
4943
|
device: e,
|
|
4809
4944
|
alpha: !0,
|
|
4810
4945
|
antialias: (window.devicePixelRatio || 1) < 2
|
|
4811
4946
|
});
|
|
4812
|
-
return await r.init(), e.onuncapturederror = n, r.outputColorSpace =
|
|
4947
|
+
return await r.init(), e.onuncapturederror = n, r.outputColorSpace = Tr, r.setPixelRatio(1), r.setClearColor(0, 0), r.autoClear = !1, this.renderer = r, this.syncSize(), this;
|
|
4813
4948
|
}
|
|
4814
4949
|
get isVisible() {
|
|
4815
4950
|
return this._visible;
|
|
@@ -4826,9 +4961,9 @@ var es = 4096, ts = class {
|
|
|
4826
4961
|
this._visible !== e && (this._visible = e, this.canvas.style.display = e ? "" : "none");
|
|
4827
4962
|
}
|
|
4828
4963
|
dispose() {
|
|
4829
|
-
|
|
4964
|
+
Ie(this.renderer), this.renderer = null, this.canvas.parentElement?.removeChild(this.canvas);
|
|
4830
4965
|
}
|
|
4831
|
-
}, ns =
|
|
4966
|
+
}, ns = Ke("overlay"), rs = (e, t) => e.visible && e.layer === t && e.render, is = class {
|
|
4832
4967
|
constructor(e) {
|
|
4833
4968
|
this.camera = e, this._helpers = /* @__PURE__ */ new Map(), this._hudCanvas = Qo(), this._hudCtx = this._hudCanvas.getContext("2d"), this._helperScene = null, this._viewOverlay = null;
|
|
4834
4969
|
}
|
|
@@ -4860,7 +4995,7 @@ var es = 4096, ts = class {
|
|
|
4860
4995
|
setupDefaultHelpers({ helperScene: e, meshScene: t, pipeline: n, denoisingManager: r, app: i, renderWidth: a, renderHeight: o }) {
|
|
4861
4996
|
this.setHelperScene(e);
|
|
4862
4997
|
let s = new Xo();
|
|
4863
|
-
this.register("tiles", s), s.setRenderSize(a || 1, o || 1), i.addEventListener(
|
|
4998
|
+
this.register("tiles", s), s.setRenderSize(a || 1, o || 1), i.addEventListener(j.RESOLUTION_CHANGED, (e) => {
|
|
4864
4999
|
s.setRenderSize(e.width, e.height);
|
|
4865
5000
|
}), n.eventBus.on("pipeline:reset", () => s.hide()), this._wireDenoiserTileEvents(s, r);
|
|
4866
5001
|
let c = new Zo(t, this.camera);
|
|
@@ -4954,18 +5089,18 @@ function as(e, t) {
|
|
|
4954
5089
|
for (let e of n) e.traverse?.(() => i++);
|
|
4955
5090
|
return i + n.length / 2 < r ? n : null;
|
|
4956
5091
|
}
|
|
4957
|
-
var os = class extends
|
|
5092
|
+
var os = class extends or {
|
|
4958
5093
|
constructor() {
|
|
4959
|
-
super(), this.mixer = null, this.timer = new
|
|
5094
|
+
super(), this.mixer = null, this.timer = new Or(), this.actions = [], this.isPlaying = !1, this._scene = null, this._mixerRoot = null, this._meshes = null, this._meshTriRanges = null, this._meshPositions = null, this._tempVec = new $(), this._skinnedCache = null, this._clipsCache = null, this._savedTimeScale = 1, this.onFinished = null, this._rigid = !1, this._plans = null, this._allPlan = null, this._activeClip = 0, this._slotOf = null, this._lastWorld = null, this._lastVisible = null, this._lastMeshWorld = null, this._lastMorphWeights = null, this.wakeCallback = null, this.applyPoseCallback = null;
|
|
4960
5095
|
}
|
|
4961
5096
|
init(e, t, n, r) {
|
|
4962
5097
|
if (this.dispose(), !r || r.length === 0) return;
|
|
4963
|
-
this._scene = e, this._mixerRoot = t, this._meshes = n, this.mixer = new
|
|
5098
|
+
this._scene = e, this._mixerRoot = t, this._meshes = n, this.mixer = new Zn(t);
|
|
4964
5099
|
let i = r.map((e) => this.mixer.clipAction(e)), a = (e, t) => e.name === t || e.getObjectByName(t) !== void 0;
|
|
4965
5100
|
!i.some((e) => e.getClip().tracks.some((e) => {
|
|
4966
5101
|
let n = e.name.split(".")[0];
|
|
4967
5102
|
return a(t, n);
|
|
4968
|
-
})) && t !== e && (console.log("[AnimationManager] Tracks did not resolve from model root, retrying with scene root"), this.mixer = new
|
|
5103
|
+
})) && t !== e && (console.log("[AnimationManager] Tracks did not resolve from model root, retrying with scene root"), this.mixer = new Zn(e), this._mixerRoot = e, i = r.map((e) => this.mixer.clipAction(e))), this.actions = i, this._rigid = !n.some((e) => e?.isSkinnedMesh) && !r.some((e) => e.tracks.some((e) => e.name.includes("morphTargetInfluences"))), this._planClips(r), this.mixer.addEventListener("finished", () => {
|
|
4969
5104
|
this.isPlaying = !1, this.timer.reset(), this.onFinished && this.onFinished();
|
|
4970
5105
|
}), this._meshTriRanges = [], this._skinnedCache = [];
|
|
4971
5106
|
let o = 0;
|
|
@@ -4989,7 +5124,7 @@ var os = class extends Sr {
|
|
|
4989
5124
|
}), this._plans = e.map((e) => {
|
|
4990
5125
|
let r = /* @__PURE__ */ new Set(), i = !1, a = !1;
|
|
4991
5126
|
for (let o of e.tracks) {
|
|
4992
|
-
let { nodeName: e, propertyName: s } =
|
|
5127
|
+
let { nodeName: e, propertyName: s } = xr.parseTrackName(o.name), c = e === "" || e === "." ? t : n.get(e);
|
|
4993
5128
|
if (!c) {
|
|
4994
5129
|
a = !0;
|
|
4995
5130
|
continue;
|
|
@@ -5062,23 +5197,23 @@ var os = class extends Sr {
|
|
|
5062
5197
|
if (!(!this.mixer || this.actions.length === 0)) {
|
|
5063
5198
|
if (this.mixer.stopAllAction(), e === -1) for (let e of this.actions) e.play();
|
|
5064
5199
|
else e >= 0 && e < this.actions.length && this.actions[e].play();
|
|
5065
|
-
this._activeClip = e, this.timer.reset(), this.isPlaying = !0, this.wakeCallback?.(), this.dispatchEvent({ type:
|
|
5200
|
+
this._activeClip = e, this.timer.reset(), this.isPlaying = !0, this.wakeCallback?.(), this.dispatchEvent({ type: j.ANIMATION_STARTED });
|
|
5066
5201
|
}
|
|
5067
5202
|
}
|
|
5068
5203
|
pause() {
|
|
5069
|
-
this.mixer && (this.mixer.timeScale = 0, this.timer.reset(), this.isPlaying = !1, this.dispatchEvent({ type:
|
|
5204
|
+
this.mixer && (this.mixer.timeScale = 0, this.timer.reset(), this.isPlaying = !1, this.dispatchEvent({ type: j.ANIMATION_PAUSED }));
|
|
5070
5205
|
}
|
|
5071
5206
|
resume() {
|
|
5072
|
-
this.mixer && (this.mixer.timeScale = this._savedTimeScale || 1, this.timer.reset(), this.isPlaying = !0, this.wakeCallback?.(), this.dispatchEvent({ type:
|
|
5207
|
+
this.mixer && (this.mixer.timeScale = this._savedTimeScale || 1, this.timer.reset(), this.isPlaying = !0, this.wakeCallback?.(), this.dispatchEvent({ type: j.ANIMATION_STARTED }));
|
|
5073
5208
|
}
|
|
5074
5209
|
stop() {
|
|
5075
|
-
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:
|
|
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: j.ANIMATION_STOPPED }));
|
|
5076
5211
|
}
|
|
5077
5212
|
setSpeed(e) {
|
|
5078
5213
|
this._savedTimeScale = e, this.mixer && this.isPlaying && (this.mixer.timeScale = e);
|
|
5079
5214
|
}
|
|
5080
5215
|
setLoop(e) {
|
|
5081
|
-
let t = e ?
|
|
5216
|
+
let t = e ? dr : ur;
|
|
5082
5217
|
for (let n of this.actions) n.setLoop(t), n.clampWhenFinished = !e;
|
|
5083
5218
|
}
|
|
5084
5219
|
seekTo(e, t = 0) {
|
|
@@ -5164,7 +5299,7 @@ var os = class extends Sr {
|
|
|
5164
5299
|
return e.isScene ? e : null;
|
|
5165
5300
|
}, ls = class {
|
|
5166
5301
|
constructor({ camera: e, canvas: t, orbitControls: n, app: r }) {
|
|
5167
|
-
this._app = r, this._orbitControls = n, this._camera = e, this._controls = new
|
|
5302
|
+
this._app = r, this._orbitControls = n, this._camera = e, this._controls = new Ir(e, t), this._gizmoScene = new Er(), this._gizmoScene.add(this._controls.getHelper()), this._attached = null, this._isDragging = !1, this._meshes = null, this._refitInFlight = !1, this._baselineComputed = !1, this._moved = /* @__PURE__ */ new Set(), this._tempForward = new $(), this._lightTargetDistance = null, this._lastLightPosition = null, this._onDraggingChanged = this._onDraggingChanged.bind(this), this._onObjectChange = this._onObjectChange.bind(this), this._controls.addEventListener("dragging-changed", this._onDraggingChanged), this._controls.addEventListener("objectChange", this._onObjectChange);
|
|
5168
5303
|
}
|
|
5169
5304
|
setMeshData(e) {
|
|
5170
5305
|
this._meshes = e;
|
|
@@ -5184,7 +5319,7 @@ var os = class extends Sr {
|
|
|
5184
5319
|
}
|
|
5185
5320
|
setMode(e) {
|
|
5186
5321
|
this._controls.setMode(e), this._app?.dispatchEvent({
|
|
5187
|
-
type:
|
|
5322
|
+
type: j.TRANSFORM_MODE_CHANGED,
|
|
5188
5323
|
mode: e
|
|
5189
5324
|
}), this._app?.refreshFrame();
|
|
5190
5325
|
}
|
|
@@ -5206,7 +5341,7 @@ var os = class extends Sr {
|
|
|
5206
5341
|
e.autoClear = !1, e.clearDepth(), e.setRenderTarget(null), e.render(this._gizmoScene, this._camera), e.autoClear = t;
|
|
5207
5342
|
}
|
|
5208
5343
|
_onDraggingChanged(e) {
|
|
5209
|
-
this._isDragging = e.value, this._orbitControls && (this._orbitControls.enabled = !e.value), e.value ? this._app.dispatchEvent({ type:
|
|
5344
|
+
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 }));
|
|
5210
5345
|
}
|
|
5211
5346
|
_onObjectChange() {
|
|
5212
5347
|
this._app.needsReset = !0, this._app.wake(), this._attached?.isLight && this._syncLightDuringDrag();
|
|
@@ -5339,7 +5474,7 @@ function vs(e) {
|
|
|
5339
5474
|
e !== t && e.visible === !1 && r.push(ps(e, t));
|
|
5340
5475
|
}), {
|
|
5341
5476
|
v: 1,
|
|
5342
|
-
engine:
|
|
5477
|
+
engine: Ue,
|
|
5343
5478
|
savedAt: Date.now(),
|
|
5344
5479
|
scene: hs(e),
|
|
5345
5480
|
appended: t.children.filter((t) => t !== e.sceneModel && t.userData?.__rayzeeSceneObject).map((e) => ({
|
|
@@ -5457,7 +5592,7 @@ async function Ss(e, t, { resolve: n = async () => null } = {}) {
|
|
|
5457
5592
|
continue;
|
|
5458
5593
|
}
|
|
5459
5594
|
for (let [n, i] of Object.entries(r.props)) {
|
|
5460
|
-
let a =
|
|
5595
|
+
let a = ye(i);
|
|
5461
5596
|
ys(t, n, a), e.setMaterialProperty(r.index, n, a);
|
|
5462
5597
|
}
|
|
5463
5598
|
}
|
|
@@ -5489,9 +5624,10 @@ async function Ss(e, t, { resolve: n = async () => null } = {}) {
|
|
|
5489
5624
|
}
|
|
5490
5625
|
//#endregion
|
|
5491
5626
|
//#region src/PathTracerApp.js
|
|
5492
|
-
var Cs =
|
|
5627
|
+
var Cs = Ke("engine"), ws = class extends te {
|
|
5493
5628
|
constructor(e, t = {}) {
|
|
5494
|
-
super(e, t), this.setColorManagement(
|
|
5629
|
+
super(e, t), this.setColorManagement(Xt), this.setStorageOpener(sn), this.settings.define("interactionRenderScale", {
|
|
5630
|
+
default: .5,
|
|
5495
5631
|
apply: () => {
|
|
5496
5632
|
this.stages?.pathTracer?.interactionMode && this._requestRenderScale(this._interactionRenderScale());
|
|
5497
5633
|
},
|
|
@@ -5505,7 +5641,7 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5505
5641
|
}), this.cameraManager.camera;
|
|
5506
5642
|
}
|
|
5507
5643
|
_initAssetPipeline() {
|
|
5508
|
-
super._initAssetPipeline(), this.assetLoader.controls = this.cameraManager.controls, this.assetLoader.registerFormat(...
|
|
5644
|
+
super._initAssetPipeline(), this.assetLoader.controls = this.cameraManager.controls, this.assetLoader.registerFormat(...Tt), this.assetLoader.setArchiveImporterLoader(() => import("./ArchiveImporter-BRQvLggb.js").then((e) => e.r).then((e) => new e.ArchiveImporter(this.assetLoader)), wt);
|
|
5509
5645
|
let e = () => {
|
|
5510
5646
|
this.needsReset = !0, this.stages.pathTracer?.enterInteractionMode(), this.wake();
|
|
5511
5647
|
};
|
|
@@ -5513,10 +5649,10 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5513
5649
|
}
|
|
5514
5650
|
_createExtraStages() {
|
|
5515
5651
|
let { renderer: e, stages: t } = this;
|
|
5516
|
-
return t.normalDepth = new
|
|
5652
|
+
return t.normalDepth = new Jr(e, { pathTracer: t.pathTracer }), t.motionVector = new Yr(e, this.camera, { pathTracer: t.pathTracer }), t.asvgf = new Qr(e, { enabled: !1 }), t.nrd = new Ii(e, {
|
|
5517
5653
|
enabled: !1,
|
|
5518
5654
|
pathTracer: t.pathTracer
|
|
5519
|
-
}), t.variance = new
|
|
5655
|
+
}), t.variance = new zi(e, { enabled: !1 }), t.bilateralFilter = new Vi(e, { enabled: !1 }), t.edgeFilter = new qi(e, { enabled: !1 }), t.autoExposure = new ta(e, { enabled: Ji.autoExposure }), [
|
|
5520
5656
|
t.normalDepth,
|
|
5521
5657
|
t.motionVector,
|
|
5522
5658
|
t.nrd,
|
|
@@ -5531,7 +5667,7 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5531
5667
|
super._initPipeline(), this.pipeline.eventBus.on("pathtracer:interactionStart", () => this._requestRenderScale(this._interactionRenderScale())), this.pipeline.eventBus.on("pathtracer:interactionEnd", () => this._applyRenderScale(1));
|
|
5532
5668
|
}
|
|
5533
5669
|
async _initManagers() {
|
|
5534
|
-
await super._initManagers(), this.environmentManager.setProceduralSkyLoader(() => import("./PhysicalSky-
|
|
5670
|
+
await super._initManagers(), this.environmentManager.setProceduralSkyLoader(() => import("./PhysicalSky-BvqCw_dy.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 oa({
|
|
5535
5671
|
scene: this.meshScene,
|
|
5536
5672
|
camera: this.camera,
|
|
5537
5673
|
canvas: this.canvas,
|
|
@@ -5558,20 +5694,20 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5558
5694
|
}), 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);
|
|
5559
5695
|
}
|
|
5560
5696
|
_wireEvents() {
|
|
5561
|
-
this._addTrackedListener(this.cameraManager,
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5697
|
+
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, [
|
|
5698
|
+
j.DENOISING_START,
|
|
5699
|
+
j.DENOISING_END,
|
|
5700
|
+
j.UPSCALING_START,
|
|
5701
|
+
j.UPSCALING_PROGRESS,
|
|
5702
|
+
j.UPSCALING_END,
|
|
5703
|
+
j.RESOLUTION_CHANGED
|
|
5568
5704
|
]), this._setupAutoExposureListener(), this.animationManager.wakeCallback = () => this.wake(), this.animationManager.applyPoseCallback = (e) => this._applyAnimationPose(e), this._forwardEvents(this.animationManager, [
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
]), this._addTrackedListener(this.animationManager,
|
|
5705
|
+
j.ANIMATION_STARTED,
|
|
5706
|
+
j.ANIMATION_PAUSED,
|
|
5707
|
+
j.ANIMATION_STOPPED
|
|
5708
|
+
]), this._addTrackedListener(this.animationManager, j.ANIMATION_PAUSED, () => {
|
|
5573
5709
|
this._animRefitInFlight = !1, this._refreshMovedEmitters();
|
|
5574
|
-
}), this._addTrackedListener(this.animationManager,
|
|
5710
|
+
}), this._addTrackedListener(this.animationManager, j.ANIMATION_STOPPED, () => {
|
|
5575
5711
|
this._animRefitInFlight = !1;
|
|
5576
5712
|
}), this.cameraManager.initCallbacks({
|
|
5577
5713
|
onResize: () => this.onResize(),
|
|
@@ -5721,7 +5857,7 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5721
5857
|
}
|
|
5722
5858
|
_dispatchCamerasUpdated() {
|
|
5723
5859
|
this.dispatchEvent({
|
|
5724
|
-
type:
|
|
5860
|
+
type: j.CAMERAS_UPDATED,
|
|
5725
5861
|
cameras: this.cameraManager.cameras,
|
|
5726
5862
|
cameraNames: this.cameraManager.getCameraNames()
|
|
5727
5863
|
});
|
|
@@ -5775,8 +5911,8 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5775
5911
|
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));
|
|
5776
5912
|
}
|
|
5777
5913
|
configureForMode(e, t = {}) {
|
|
5778
|
-
let n = e === "production", r = n ?
|
|
5779
|
-
this.denoisingManager?.setCadenceSuspended(n), this.timeline.stop(), this.cameraManager.controls.enabled = !n, this.settings.setMany(
|
|
5914
|
+
let n = e === "production", r = n ? we : ae;
|
|
5915
|
+
this.denoisingManager?.setCadenceSuspended(n), this.timeline.stop(), this.cameraManager.controls.enabled = !n, this.settings.setMany(re(r), {
|
|
5780
5916
|
silent: !0,
|
|
5781
5917
|
source: x.MODE_PRESET
|
|
5782
5918
|
}), this.stages.pathTracer?.setUniform("renderMode", parseInt(r.renderMode)), n && this._applyRenderScale(1), this.stages.pathTracer?.updateCompletionThreshold?.();
|
|
@@ -5799,13 +5935,13 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5799
5935
|
let e = this.denoisingManager;
|
|
5800
5936
|
if (await e?.denoiseOnce()) return !0;
|
|
5801
5937
|
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";
|
|
5802
|
-
return this._issues.record(
|
|
5938
|
+
return this._issues.record(Ze.DENOISER_UNAVAILABLE, `final denoise produced no picture: ${t}`, { reason: t }), !1;
|
|
5803
5939
|
}
|
|
5804
5940
|
_abortPostProcess({ keepDisplay: e = !1 } = {}) {
|
|
5805
5941
|
if (this.denoisingManager?.abort(this.canvas, { keepDisplay: e }), this.denoisingManager?.restoreBaseResolution()) {
|
|
5806
5942
|
let e = this.denoisingManager._lastRenderWidth, t = this.denoisingManager._lastRenderHeight;
|
|
5807
5943
|
this.dispatchEvent({
|
|
5808
|
-
type:
|
|
5944
|
+
type: j.RESOLUTION_CHANGED,
|
|
5809
5945
|
width: e,
|
|
5810
5946
|
height: t
|
|
5811
5947
|
});
|
|
@@ -5833,7 +5969,7 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5833
5969
|
if (e.length > 0) {
|
|
5834
5970
|
let t = this.sceneModel || this.meshScene;
|
|
5835
5971
|
this.animationManager.init(this.meshScene, t, this._sdf.meshes, e), this.animationManager.onFinished = () => {
|
|
5836
|
-
this._animRefitInFlight = !1, this._refreshMovedEmitters(), this.dispatchEvent({ type:
|
|
5972
|
+
this._animRefitInFlight = !1, this._refreshMovedEmitters(), this.dispatchEvent({ type: j.ANIMATION_FINISHED });
|
|
5837
5973
|
};
|
|
5838
5974
|
}
|
|
5839
5975
|
this.transformManager?.setMeshData(this._sdf.meshes);
|
|
@@ -5865,7 +6001,7 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5865
6001
|
_setupAutoExposureListener() {
|
|
5866
6002
|
this.stages.autoExposure && this.stages.autoExposure.on("autoexposure:updated", (e) => {
|
|
5867
6003
|
this.dispatchEvent({
|
|
5868
|
-
type:
|
|
6004
|
+
type: j.AUTO_EXPOSURE_UPDATED,
|
|
5869
6005
|
exposure: e.exposure,
|
|
5870
6006
|
luminance: e.luminance
|
|
5871
6007
|
});
|
|
@@ -5890,7 +6026,7 @@ var Cs = ft("engine"), ws = class extends te {
|
|
|
5890
6026
|
}
|
|
5891
6027
|
_recalibrateControlLimits() {
|
|
5892
6028
|
if (!this.meshScene || !this.cameraManager) return;
|
|
5893
|
-
let e = new
|
|
6029
|
+
let e = new $n(), t = new $n();
|
|
5894
6030
|
for (let n of this.meshScene.children) n.userData?.__rayzeeSceneObject && (t.setFromObject(n), t.isEmpty() || e.union(t));
|
|
5895
6031
|
if (e.isEmpty()) return;
|
|
5896
6032
|
let n = Math.max(e.max.x - e.min.x, e.max.y - e.min.y, e.max.z - e.min.z);
|
|
@@ -5930,18 +6066,17 @@ async function Es(e, { samples: t = 64, colorSpace: n = "srgb", allowEarlyRetire
|
|
|
5930
6066
|
provenance: e.getProvenance()
|
|
5931
6067
|
};
|
|
5932
6068
|
}
|
|
5933
|
-
async function Ds({ canvas: e, model: t = null, width: n = 1920, height: r = 1080, strict: i = !0,
|
|
5934
|
-
let
|
|
6069
|
+
async function Ds({ canvas: e, model: t = null, width: n = 1920, height: r = 1080, strict: i = !0, deterministic: a = !0, settings: o = null, storage: s = !1, hostMemoryGB: c = void 0 } = {}) {
|
|
6070
|
+
let l = new ws(e ?? null, {
|
|
5935
6071
|
autoResize: !1,
|
|
5936
6072
|
strict: i,
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
hostMemoryGB: l
|
|
6073
|
+
storage: s,
|
|
6074
|
+
hostMemoryGB: c
|
|
5940
6075
|
});
|
|
5941
6076
|
try {
|
|
5942
|
-
return
|
|
6077
|
+
return l.setReservedRenderResolution(Math.max(n, r)), await l.init(), l.setCanvasSize(n, r), o && l.settings.setMany(o, { silent: !0 }), t && await l.loadModel(t), o && l.settings.setMany(o, { silent: !0 }), a && l.setDeterministicMode(!0), l;
|
|
5943
6078
|
} catch (e) {
|
|
5944
|
-
throw
|
|
6079
|
+
throw l.dispose(), e;
|
|
5945
6080
|
}
|
|
5946
6081
|
}
|
|
5947
6082
|
//#endregion
|
|
@@ -5951,7 +6086,7 @@ var Os = class {
|
|
|
5951
6086
|
this._app = e, this._cancelled = !1, this._rendering = !1;
|
|
5952
6087
|
}
|
|
5953
6088
|
async renderAnimation(e = {}) {
|
|
5954
|
-
let { clipIndex: t = 0, fps: n = 30, speed: r = 1, samplesPerFrame: i =
|
|
6089
|
+
let { clipIndex: t = 0, fps: n = 30, speed: r = 1, samplesPerFrame: i = we.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;
|
|
5955
6090
|
if (!f && !o?.animates) {
|
|
5956
6091
|
console.warn(d.animationManager?.hasAnimations ? `VideoRenderManager: Invalid clip index ${t}` : "VideoRenderManager: No animation clips or keyframes"), u?.(!1);
|
|
5957
6092
|
return;
|
|
@@ -5979,7 +6114,7 @@ var Os = class {
|
|
|
5979
6114
|
percent: (e + 1) / m * 100
|
|
5980
6115
|
};
|
|
5981
6116
|
l?.(u), d.dispatchEvent({
|
|
5982
|
-
type:
|
|
6117
|
+
type: j.VIDEO_RENDER_PROGRESS,
|
|
5983
6118
|
...u
|
|
5984
6119
|
});
|
|
5985
6120
|
}
|
|
@@ -5989,7 +6124,7 @@ var Os = class {
|
|
|
5989
6124
|
this._restoreState(g), this._rendering = !1;
|
|
5990
6125
|
let e = !this._cancelled;
|
|
5991
6126
|
u?.(e), d.dispatchEvent({
|
|
5992
|
-
type:
|
|
6127
|
+
type: j.VIDEO_RENDER_COMPLETE,
|
|
5993
6128
|
success: e
|
|
5994
6129
|
});
|
|
5995
6130
|
}
|
|
@@ -6008,26 +6143,26 @@ var Os = class {
|
|
|
6008
6143
|
await n;
|
|
6009
6144
|
continue;
|
|
6010
6145
|
}
|
|
6011
|
-
e.cameraManager.camera.updateMatrixWorld(), e.pipeline.render(), t.frameCount % 4 == 0 && (
|
|
6146
|
+
e.cameraManager.camera.updateMatrixWorld(), e.pipeline.render(), t.frameCount % 4 == 0 && (Ve({ samples: Fe(t) }), await new Promise((e) => setTimeout(e, 0)));
|
|
6012
6147
|
}
|
|
6013
6148
|
}
|
|
6014
6149
|
_waitForDenoise(e) {
|
|
6015
6150
|
return new Promise((t) => {
|
|
6016
6151
|
let n, r = () => {
|
|
6017
|
-
e.removeEventListener(
|
|
6152
|
+
e.removeEventListener(j.DENOISING_END, i), clearTimeout(n);
|
|
6018
6153
|
}, i = () => {
|
|
6019
6154
|
r(), t();
|
|
6020
6155
|
};
|
|
6021
6156
|
n = setTimeout(() => {
|
|
6022
6157
|
console.warn("VideoRenderManager: Denoise timed out, skipping"), r(), t();
|
|
6023
|
-
}, 3e4), e.addEventListener(
|
|
6158
|
+
}, 3e4), e.addEventListener(j.DENOISING_END, i), e.denoisingManager.onRenderComplete({
|
|
6024
6159
|
isStillComplete: () => !this._cancelled,
|
|
6025
6160
|
context: e.pipeline?.context
|
|
6026
6161
|
});
|
|
6027
6162
|
});
|
|
6028
6163
|
}
|
|
6029
6164
|
_saveState({ view: e }) {
|
|
6030
|
-
let t = this._app, n = t.settings.getEffective(), r = Object.keys(
|
|
6165
|
+
let t = this._app, n = t.settings.getEffective(), r = Object.keys(re(we));
|
|
6031
6166
|
return e && r.push("focusDistance"), {
|
|
6032
6167
|
view: e ? t.cameraManager.captureView() : null,
|
|
6033
6168
|
settings: r.map((e) => [e, n[e]]),
|
|
@@ -6050,4 +6185,4 @@ var Os = class {
|
|
|
6050
6185
|
}
|
|
6051
6186
|
};
|
|
6052
6187
|
//#endregion
|
|
6053
|
-
export {
|
|
6188
|
+
export { wt as ARCHIVE_FORMATS, Br as ASVGF_QUALITY_PRESETS, Ji as AUTO_EXPOSURE_DEFAULTS, Ca as AUTO_FOCUS_DEFAULTS, os as AnimationManager, Je as BVH_LEAF_MARKERS, ka as CameraManager, Na as CameraTrack, Xt as ColorManagement, Rt as DEFAULT_LUT_SIZE, qt as DEFAULT_MAX_EV, Wt as DEFAULT_MIN_EV, Te as DEFAULT_SUN_PATH, gt as DEFAULT_VIEW, it as DEFAULT_WORKING_SPACE, qr as DENOISER_DEFAULTS, C as DOWNLOAD_POLICY, Yo as DenoisingManager, f as DownloadCache, tt as ENGINE_AREAS, oe as ENGINE_DEFAULTS, j as EngineEvents, $e as EngineIssueError, Ia as GoboManager, Ja as IESManager, ae as INTERACTIVE_RENDER_CONFIG, Ze as ISSUE_CODES, Qe as ISSUE_SEVERITY, oa as InteractionManager, Xe as IssueLog, Pe as LEGACY_EVENT_NAMES, qe as LOG_LEVELS, ee as LightManager, Ge as Logger, ue as MATERIAL_DEFAULTS, me as MATERIAL_VALUE_SOURCE, D as MAX_RESERVABLE_RENDER_SIZE, Be as MAX_SCENE_BYTES, mt as MAX_TABLE_TRANSFORMS, Le as MemoryLedger, Ur as NRD_DEFAULTS, Vr as NRD_HIT_DIST_A, Hr as NRD_HIT_DIST_B, Wr as NRD_PRESET_KEYS, Gr as NRD_QUALITY_PRESETS, ut as OCIO_VIEW_BASE, is as OverlayManager, we as PRODUCTION_RENDER_CONFIG, ws as PathTracerApp, u as PipelineContext, mn as RETOUCH_DEFAULTS, hn as RETOUCH_MAX_PIXELS, pn as RETOUCH_RANGES, te as RayzeeRenderer, S as RenderPipeline, d as RenderSettings, E as RenderStage, Re as SAFE_SCENE_BYTES, ds as SCENE_STATE_VERSION, x as SETTING_SOURCE, Ae as SKY_DEFAULTS, dn as SR_MAX_INPUT, fn as SR_SCALE, et as STORAGE_KIND, ge as StageExecutionMode, on as StorageManager, Ye as TRIANGLE_DATA_LAYOUT, Fa as TimelineManager, ls as TransformManager, Ue as VERSION, st as VIEW_TRANSFORMS, xe as VRAMTracker, Os as VideoRenderManager, nn as acquireLock, Bt as addAllOcioViews, zt as addOcioView, ft as addViewTransform, en as applyMatrixRGBA8, Qt as bakeLut, ke as bufferBytes, Nt as buildOcioView, ht as buildToneMapWGSL, v as cachedObjectURL, Gt as canvasColorSpaceFor, Es as captureHeadless, y as clearBindingAuditFindings, Pt as clearInputOverrides, ot as configureAssets, Ee as configurePlatform, jt as convertColor, Dt as convertEncodedRGBA8, $t as convertPixelsF32, Ke as createLogger, be as dayOfYearForMonth, ie as deriveAlphaMode, b as describeAdapter, Et as displayCanvasFit, ze as estimateSceneBytes, Mt as extractMatrix, St as extractSceneMetadata, w as fetchFile, yt as fileIdentity, Jt as findNativeLinearSpace, We as fmt, ye as fromPortable, rt as getActiveColorManagement, at as getAssetConfig, g as getBindingAuditFindings, Ce as getPlatform, dt as getRegistryVersion, _t as getViewTransform, kt as hasColorSpace, rn as heldLockNames, bt as identityKey, Vt as isColorManaged, Ot as isDataSpace, Kt as isDataTexture, At as linearToSrgb, Yt as listFileRules, It as listInputOverrides, ct as listViewTransforms, tn as makeCpuSampler, Ft as measureBakeError, p as nameFromUrl, pt as onRegistryChange, Ds as openHeadless, an as openStorage, ln as openZip, Ct as parseSceneMetadata, He as probeAddressSpace, cn as readZipDirectory, lt as removeViewTransform, Ts as renderHeadless, un as renderUpscaled, Ut as resolveInputSpace, vt as sameIdentity, nt as setActiveColorManagement, h as setBindingAudit, Zt as setInputOverride, Ht as srgbToLinear, Se as sunPosition, De as textureBytes, Lt as textureInputSpace, Oe as timeForSunElevation, je as toPortable };
|