rayzee 11.2.1 → 11.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +58 -29
  2. package/dist/ArchiveImporter-D735xX-4.js +7860 -0
  3. package/dist/BidirectionalIntegrator-M89c0AlP.js +954 -0
  4. package/dist/{BufferLayout-D_IBo2ci.js → BufferLayout-xPRH9jYD.js} +41 -5
  5. package/dist/{NeuralRetouch-Cr-otSW8.js → NeuralRetouch-DiBH63kz.js} +1 -1
  6. package/dist/{NeuralSuperRes-B7E3_M0t.js → NeuralSuperRes-CZNQP13W.js} +1 -1
  7. package/dist/{PathTracer-D6nbknj5.js → PathTracer-BXCCVrPK.js} +4371 -4612
  8. package/dist/{PhysicalSky-Dq5VSiCQ.js → PhysicalSky-DqmaS0lb.js} +2 -2
  9. package/dist/{RayzeeRenderer-DbjqO6v-.js → RayzeeRenderer-DUSMFhmc.js} +426 -363
  10. package/dist/SolarLimb-bZE6y63S.js +762 -0
  11. package/dist/addons/archives.es.js +1 -1
  12. package/dist/addons/bidirectional.es.js +1 -1
  13. package/dist/addons/physical-sky.es.js +1 -1
  14. package/dist/rayzee-core.es.js +7 -7
  15. package/dist/rayzee.es.js +472 -468
  16. package/dist/rayzee.umd.js +106 -105
  17. package/dist/sceneCachePolicy-BAib5fCp.js +1602 -0
  18. package/package.json +1 -1
  19. package/src/PathTracerApp.js +4 -3
  20. package/src/Processor/ArchiveImporter.js +173 -94
  21. package/src/Processor/ArchiveReader.js +20 -23
  22. package/src/Processor/AssetLoader.js +48 -1
  23. package/src/Processor/BVHRefitter.js +109 -13
  24. package/src/Processor/BufferLayout.js +115 -0
  25. package/src/Processor/ChunkedRecords.js +3 -2
  26. package/src/Processor/EmissiveTriangleBuilder.js +6 -6
  27. package/src/Processor/GeometryExtractor.js +189 -79
  28. package/src/Processor/HostMemory.js +39 -9
  29. package/src/Processor/InstanceTable.js +714 -42
  30. package/src/Processor/PBRT/PBRTCurves.js +224 -6
  31. package/src/Processor/PBRT/PBRTMaterials.js +3 -0
  32. package/src/Processor/PBRT/PBRTSceneBuilder.js +82 -25
  33. package/src/Processor/PackedRayBuffer.js +5 -2
  34. package/src/Processor/SceneProcessor.js +747 -141
  35. package/src/Processor/TLASBuilder.js +32 -17
  36. package/src/Processor/USD/USDLayer.js +1149 -0
  37. package/src/Processor/USD/USDScene.js +1655 -0
  38. package/src/Processor/USD/USDStage.js +682 -0
  39. package/src/Processor/USD/USDText.js +674 -0
  40. package/src/Processor/USD/index.js +138 -0
  41. package/src/Processor/Workers/BVHRefitWorker.js +3 -3
  42. package/src/RayzeeRenderer.js +167 -26
  43. package/src/Stages/NormalDepth.js +7 -12
  44. package/src/Stages/PathTracer.js +12 -17
  45. package/src/Stages/PathTracerStage.js +273 -96
  46. package/src/Storage/GeometrySpill.js +46 -14
  47. package/src/Storage/SceneGraphCodec.js +17 -3
  48. package/src/Storage/SpillStore.js +9 -0
  49. package/src/TSL/BVHTraversal.js +183 -7
  50. package/src/TSL/Common.js +57 -13
  51. package/src/TSL/ShadeKernel.js +3 -2
  52. package/src/TSL/TextureSampling.js +11 -8
  53. package/src/TSL/patches.js +84 -0
  54. package/src/integrators/BidirectionalIntegrator.js +20 -2
  55. package/src/managers/DenoisingManager.js +4 -4
  56. package/src/managers/InteractionManager.js +19 -6
  57. package/src/managers/MaterialDataManager.js +22 -5
  58. package/src/managers/UniformManager.js +3 -0
  59. package/dist/ArchiveImporter-D_x863yu.js +0 -5198
  60. package/dist/BidirectionalIntegrator-DmkxxEOR.js +0 -946
  61. package/dist/SolarLimb-CPaeZVwz.js +0 -721
  62. package/dist/sceneCachePolicy-C4-4qwt6.js +0 -485
@@ -1,946 +0,0 @@
1
- import { $t as e, F as t, Ft as n, I as r, J as i, K as a, L as o, Mt as s, R as c, Rt as l, U as u, X as d, Y as f, Z as p, Zt as m, c as ee, ct as te, dt as ne, et as h, ft as re, i as g, j as ie, jt as ae, k as oe, lt as se, nn as ce, q as _, qt as v, r as le, rn as ue, wt as de, y as fe } from "./SolarLimb-CPaeZVwz.js";
2
- import { A as y, At as b, C as pe, D as x, Dt as S, E as C, F as w, G as me, I as T, J as he, M as ge, O as _e, Ot as ve, S as ye, T as be, U as xe, V as E, W as Se, Y as D, _ as O, a as Ce, at as we, b as k, bt as A, c as Te, d as Ee, f as De, g as j, h as M, i as Oe, it as N, j as ke, jt as Ae, k as je, kt as Me, l as Ne, m as Pe, o as Fe, p as Ie, q as Le, r as Re, rt as P, s as ze, t as Be, u as F, v as Ve, w as He, x as Ue, xt as We, y as Ge } from "./PathTracer-D6nbknj5.js";
3
- import "./BufferLayout-D_IBo2ci.js";
4
- import { Break as Ke, Fn as I, If as L, Loop as qe, Return as R, abs as z, atomicAdd as Je, atomicFunc as Ye, atomicLoad as B, atomicStore as Xe, bool as Ze, cos as Qe, cross as $e, dot as V, exp2 as et, float as H, floor as tt, instanceIndex as U, int as W, ivec2 as nt, ivec3 as rt, length as it, localId as at, log2 as ot, max as G, min as st, mix as ct, normalize as lt, sampler as ut, select as K, sin as dt, sqrt as ft, storage as pt, texture as mt, uint as q, uniform as J, uniformArray as ht, vec2 as gt, vec3 as Y, vec4 as _t, workgroupId as vt } from "three/tsl";
5
- import { DataTexture as yt, FloatType as bt, RedFormat as xt, Vector3 as St } from "three";
6
- //#region \0rolldown/runtime.js
7
- var Ct = Object.defineProperty, wt = (e, t) => {
8
- let n = {};
9
- for (var r in e) Ct(n, r, {
10
- get: e[r],
11
- enumerable: !0
12
- });
13
- return t || Ct(n, Symbol.toStringTag, { value: "Module" }), n;
14
- }, Tt = /* @__PURE__ */ wt({
15
- LampPick: () => Et,
16
- areaLightDirectPdfW: () => Ft,
17
- directionalConeSolidAngle: () => Pt,
18
- lampCount: () => Dt,
19
- lampPickPdf: () => Mt,
20
- lampTypeAt: () => Ot,
21
- pickLamp: () => jt,
22
- spotConeSolidAngle: () => Nt
23
- }), Et = ue({
24
- kind: "int",
25
- index: "int",
26
- pdf: "float",
27
- total: "float"
28
- }), Dt = (e) => e.numDirectional.add(e.numArea).add(e.numPoint).add(e.numSpot), Ot = (e, t) => K(t.lessThan(e.numDirectional), W(0), K(t.lessThan(e.numDirectional.add(e.numArea)), W(1), K(t.lessThan(e.numDirectional.add(e.numArea).add(e.numPoint)), W(2), W(3)))), kt = (e, t) => K(t.equal(W(0)), W(0), K(t.equal(W(1)), e.numDirectional, K(t.equal(W(2)), e.numDirectional.add(e.numArea), e.numDirectional.add(e.numArea).add(e.numPoint)))), At = (e, t, n, r, i) => {
29
- let a = (e, t, n) => L(t.greaterThan(W(0)), () => {
30
- qe({
31
- start: W(0),
32
- end: t,
33
- type: "int",
34
- condition: "<"
35
- }, ({ i: t }) => {
36
- i(W(e), t, n(t).toVar());
37
- });
38
- });
39
- a(0, e.numDirectional, (t) => Ie(Ge.wrap(pe(e.directional, t)), n, r, W(0))), a(1, e.numArea, (i) => {
40
- let a = Ve.wrap(ye(e.area, i));
41
- return K(a.intensity.greaterThan(0), j(a, t, n, r), H(0));
42
- }), a(2, e.numPoint, (i) => Pe(k.wrap(He(e.point, i)), t, n, r)), a(3, e.numSpot, (i) => M(Ue.wrap(C(e.spot, i)), t, n, r));
43
- };
44
- function jt(e, t, n, r, i, a) {
45
- let o = W(-1).toVar(), s = W(-1).toVar(), c = H(0).toVar(), l = H(0).toVar();
46
- At(e, t, n, r, (t, n, r) => {
47
- l.addAssign(r), L(r.greaterThan(0).and(a(W(S + 64).add(kt(e, t)).add(n)).mul(l).lessThan(r)), () => {
48
- o.assign(t), s.assign(n), c.assign(r);
49
- });
50
- });
51
- let u = Dt(e).toVar(), d = c.div(G(l, 1e-10)).toVar();
52
- return L(l.lessThanEqual(0), () => {
53
- let t = st(W(i.mul(H(u))), u.sub(W(1))).toVar();
54
- o.assign(Ot(e, t)), s.assign(t.sub(kt(e, o))), d.assign(H(1).div(G(H(u), 1)));
55
- }), Et({
56
- kind: o,
57
- index: s,
58
- pdf: d,
59
- total: l
60
- });
61
- }
62
- function Mt(e, t, n, r, i, a) {
63
- let o = H(0).toVar(), s = H(0).toVar();
64
- return At(e, r, i, a, (e, r, i) => {
65
- o.addAssign(i), L(e.equal(t).and(r.equal(n)), () => {
66
- s.assign(i);
67
- });
68
- }), K(o.greaterThan(0), s.div(o), H(1).div(G(H(Dt(e)), 1)));
69
- }
70
- var Nt = (e) => H(2 * se).mul(G(H(1).sub(Qe(e.angle)), 1e-10)), Pt = (e) => H(2 * se).mul(G(H(1).sub(Qe(e.angle.mul(.5))), 1e-10)), Ft = (e, t, n, r) => {
71
- let i = y(t, e.position.sub(e.u).sub(e.v), e.u.mul(2), e.v.mul(2)).toVar();
72
- return K(e.shape.lessThan(.5).and(i.greaterThan(1e-5)), H(1).div(i), n.mul(n).div(G(e.area.mul(G(r, .001)), 1e-10)));
73
- }, It = /* @__PURE__ */ wt({
74
- DIM_CONNECT_PATH: () => 16,
75
- DIM_CONNECT_VERTEX: () => 17,
76
- DIM_EMIT: () => X,
77
- LIGHT_PIXEL_ROW_OFFSET: () => Lt,
78
- PASS_TAG_BIT: () => Bt,
79
- SOURCE: () => rn,
80
- SPLAT_MAX: () => zt,
81
- SPLAT_SCALE: () => Rt,
82
- STRATEGY: () => Qt,
83
- STRATEGY_ALONE: () => 8,
84
- emitterAreaPdf: () => tn,
85
- emitterSideProbability: () => en,
86
- facingSide: () => un,
87
- lampSource: () => on,
88
- lightEndCosine: () => dn,
89
- lightPathPixel: () => Ht,
90
- mergeEta: () => Jt,
91
- mergeRadiusAt: () => qt,
92
- mergeVmAt: () => Yt,
93
- mis: () => Q,
94
- misMergePartial: () => Xt,
95
- misOnHit: () => Ut,
96
- misOnScatter: () => Gt,
97
- misOnSpecular: () => Wt,
98
- misPartial: () => Kt,
99
- misWeight: () => Zt,
100
- resolveSurfaceMaterial: () => ln,
101
- sourceLampIndex: () => cn,
102
- sourceLampType: () => sn,
103
- sourcePick: () => an,
104
- strategyWeight: () => $t,
105
- sunEmissionPdf: () => nn
106
- }), X = S + 2048, Lt = 65536, Rt = 16384, zt = 4096, Bt = 2147483648, Vt = 1e30, Z = (e) => K(e.equal(e), e, H(0)).clamp(0, Vt), Ht = (e, t) => {
107
- let n = q(t.x);
108
- return gt(H(q(e).mod(n)).add(.5), H(q(e).div(n).add(q(Lt))).add(.5));
109
- }, Q = (e) => e.mul(e), Ut = (e, t, n) => {
110
- let r = G(n, 1e-6);
111
- e.dVCM.assign(Z(e.dVCM.mul(Q(t.mul(t).div(r))))), e.dVC.assign(Z(e.dVC.div(Q(r))));
112
- }, Wt = (e, t) => {
113
- e.dVC.assign(Z(e.dVC.mul(Q(t)))), e.dVCM.assign(0);
114
- }, Gt = (e, t, n, r) => {
115
- let i = G(n, 1e-12), a = e.dVC.mul(Q(r)).add(e.dVCM);
116
- e.dVC.assign(Z(Q(t.div(i)).mul(Z(e.vm ? a.add(e.vm) : a)))), e.dVCM.assign(Z(Q(H(1).div(i))));
117
- }, Kt = (e, t, n) => {
118
- let r = t.dVCM.add(t.dVC.mul(Q(n)));
119
- return Z(Z(Q(e)).mul(Z(t.vm ? r.add(t.vm) : r)));
120
- }, qt = (e, t) => G(e.mergeConst.add(e.mergeSlope.mul(it(t.sub(e.cameraPosition)))), e.mergeMin), Jt = (e, t) => t.mul(t).mul(Math.PI).mul(H(e.lightPaths)), Yt = (e, t) => {
121
- let n = Jt(e, qt(e, t)).mul(e.mergeTrust);
122
- return n.mul(n);
123
- }, Xt = (e, t, n) => Z(Z(e.dVCM.add(e.dVC.mul(Q(t)))).mul(n)), Zt = (e, t) => H(1).div(H(1).add(Z(e)).add(Z(t))), Qt = {
124
- ALL: 0,
125
- HIT: 1,
126
- NEE: 2,
127
- CONNECT: 3,
128
- LIGHT_TRACE: 4,
129
- MERGE: 5
130
- }, $t = (e, t, n, r = H(1)) => K(e.equal(q(Qt.ALL)).or(e.equal(q(t))), n, K(e.equal(q(t + 8)), r, H(0))), en = (e, t) => K(e.equal(W(2)), H(.5), K(e.equal(W(1)), K(t.lessThan(0), H(1), H(0)), K(t.greaterThan(0), H(1), H(0)))), tn = (e, t, n = 1) => G(V(e, ne), 0).div(G(t, 1e-10)).mul(n), nn = (e, t, n) => e.sunPick.mul(n).div(G(t.y, 1e-30)), rn = {
131
- SUN: 0,
132
- EMITTERS: 1,
133
- ENVIRONMENT: 2,
134
- LAMPS: 3
135
- }, an = (e, t) => {
136
- let n = W(t);
137
- return e.sourceCdf.element(n).sub(K(n.greaterThan(W(0)), e.sourceCdf.element(G(n.sub(W(1)), W(0))), H(0)));
138
- }, on = (e, t, n) => K(t.equal(W(0)), W(e.sourceOffsets[0]), K(t.equal(W(1)), W(e.sourceOffsets[1]), K(t.equal(W(2)), W(e.sourceOffsets[2]), W(e.sourceOffsets[3])))).add(n), sn = (e, t) => K(t.lessThan(W(e.sourceOffsets[1])), W(0), K(t.lessThan(W(e.sourceOffsets[2])), W(1), K(t.lessThan(W(e.sourceOffsets[3])), W(2), W(3)))), cn = (e, t, n) => t.sub(K(n.equal(W(0)), W(e.sourceOffsets[0]), K(n.equal(W(1)), W(e.sourceOffsets[1]), K(n.equal(W(2)), W(e.sourceOffsets[2]), W(e.sourceOffsets[3])))));
139
- function ln(t, n, r, i) {
140
- let a = e.wrap(de(W(t), i)).toVar();
141
- a.normalMapIndex.assign(W(-1)), a.bumpMapIndex.assign(W(-1)), a.displacementMapIndex.assign(W(-1));
142
- let o = m.wrap(E(a, n, r, _t(0))).toVar(), s = o.roughness.toVar();
143
- a.color.assign(o.albedo), a.metalness.assign(o.metalness.clamp(0, 1)), a.roughness.assign(o.roughness.clamp(te, 1)), a.sheenRoughness.assign(a.sheenRoughness.clamp(.05, 1));
144
- let c = w({
145
- uv: n,
146
- transform: a.albedoTransform
147
- }).toVar();
148
- L(a.anisotropyMapIndex.greaterThanEqual(W(0)), () => {
149
- let e = T(a, c).toVar();
150
- a.anisotropy.assign(e.x), a.anisotropyRotation.assign(e.y);
151
- });
152
- let l = v.wrap(ge(a, c)).toVar();
153
- return a.transmission.assign(l.transmission), a.clearcoat.assign(l.clearcoat), a.clearcoatRoughness.assign(l.clearcoatRoughness), a.sheenColor.assign(l.sheenColor), a.sheenRoughness.assign(l.sheenRoughness), a.iridescence.assign(l.iridescence), a.iridescenceThicknessRange.assign(gt(a.iridescenceThicknessRange.x, l.iridescenceThickness)), a.specularIntensity.assign(l.specularIntensity), a.specularColor.assign(l.specularColor), a.diffuseTransmission.assign(l.diffuseTransmission), a.diffuseTransmissionColor.assign(l.diffuseTransmissionColor), L(s.lessThan(te).and(a.anisotropy.equal(0)).and(a.clearcoat.equal(0)).and(a.transmission.equal(0)).and(a.subsurface.equal(0)), () => {
154
- a.roughness.assign(0);
155
- }), a;
156
- }
157
- var un = (e, t, n) => K(n.diffuseTransmission.greaterThan(0).and(V(e, t).lessThan(0)), e.negate(), e), dn = (e, t, n, r) => z(V(e, t)).mul(z(V(r, n))).div(G(z(V(e, n)), 1e-4)), fn = 4096, pn = fn + 1, mn = Math.ceil(pn * 4 / 256) * 64, hn = .2, gn = (e) => {
158
- let t = lt($e(K(z(e.x).greaterThan(.9), Y(0, 1, 0), Y(1, 0, 0)), e)).toVar();
159
- return {
160
- u: t,
161
- v: $e(e, t).toVar()
162
- };
163
- }, _n = (e) => {
164
- let t = e.div(G(z(e.x).add(z(e.y)).add(z(e.z)), 1e-20)).toVar(), n = gt(t.x, t.z).toVar();
165
- L(t.y.lessThan(0), () => {
166
- n.assign(gt(H(1).sub(z(t.z)).mul(K(t.x.greaterThanEqual(0), 1, -1)), H(1).sub(z(t.x)).mul(K(t.z.greaterThanEqual(0), 1, -1))));
167
- });
168
- let r = tt(n.mul(.5).add(.5).mul(4)).clamp(0, 3);
169
- return W(r.y).mul(4).add(W(r.x));
170
- }, vn = (e, t, n) => {
171
- let { u: r, v: i } = gn(t), a = n.sub(e.sceneCenter);
172
- return gt(V(a, r), V(a, i)).div(e.sceneRadius);
173
- }, yn = (e) => {
174
- let t = e.mul(.5).add(.5).mul(64).toVar();
175
- return K(t.x.greaterThanEqual(0).and(t.y.greaterThanEqual(0)).and(t.x.lessThan(64)).and(t.y.lessThan(64)), W(t.y).mul(64).add(W(t.x)), W(-1));
176
- }, bn = (e, t, n) => e.guide.greaterThan(q(0)).and(t.load(nt(W(fn), n)).x.greaterThan(0)), xn = (e, t, n, r) => {
177
- let i = vn(e, n, r).toVar(), a = e.sceneRadius.mul(e.sceneRadius).toVar(), o = K(V(i, i).lessThanEqual(1), H(1).div(G(a.mul(Math.PI), 1e-30)), H(0)).toVar(), s = _n(n).toVar(), c = yn(i).toVar(), l = (e) => t.load(nt(G(e, W(0)), s)).x, u = K(c.greaterThanEqual(W(0)), l(c).sub(K(c.greaterThan(W(0)), l(c.sub(W(1))), H(0))), H(0)).mul(fn / 4).div(G(a, 1e-30));
178
- return K(bn(e, t, s), ct(u, o, hn), o);
179
- }, Sn = (e, t, n, r, i) => {
180
- let { u: a, v: o } = gn(n), s = gt(0).toVar(), c = _n(n).toVar();
181
- return L(bn(e, t, c).and(r.lessThan(1 - hn)), () => {
182
- let e = r.div(1 - hn).toVar(), n = W(0).toVar(), a = W(fn - 1).toVar();
183
- qe(n.lessThan(a), () => {
184
- let r = n.add(a).div(2).toVar();
185
- L(t.load(nt(r, c)).x.lessThanEqual(e), () => {
186
- n.assign(r.add(1));
187
- }).Else(() => {
188
- a.assign(r);
189
- });
190
- });
191
- let o = gt(H(n.mod(W(64))), H(n.div(W(64))));
192
- s.assign(o.add(i).div(64).mul(2).sub(1));
193
- }).Else(() => {
194
- let e = ft(i.x), t = i.y.mul(2 * Math.PI);
195
- s.assign(gt(e.mul(Qe(t)), e.mul(dt(t))));
196
- }), e.sceneCenter.add(n.mul(e.sceneRadius)).add(a.mul(s.x).add(o.mul(s.y)).mul(e.sceneRadius));
197
- }, Cn = (e, t, n, r) => {
198
- let i = yn(vn(t, n, r)).toVar();
199
- L(t.guideLearning.greaterThan(q(0)).and(i.greaterThanEqual(W(0))), () => {
200
- Je(e.element(q(P.GUIDE).add(q(_n(n).mul(W(fn)).add(i)))), q(1));
201
- });
202
- };
203
- function wn({ counters: e, out: t }) {
204
- return I(() => {
205
- let n = U;
206
- L(n.greaterThanEqual(q(16)), () => {
207
- R();
208
- });
209
- let r = q(P.GUIDE).add(n.mul(q(fn))).toVar(), i = H(0).toVar();
210
- qe({
211
- start: W(0),
212
- end: W(fn),
213
- type: "int",
214
- condition: "<"
215
- }, ({ i: t }) => {
216
- i.addAssign(H(B(e.element(r.add(q(t))))));
217
- });
218
- let a = n.mul(q(mn)).toVar(), o = H(0).toVar();
219
- qe({
220
- start: W(0),
221
- end: W(fn),
222
- type: "int",
223
- condition: "<"
224
- }, ({ i: n }) => {
225
- o.addAssign(H(B(e.element(r.add(q(n)))))), t.element(a.add(q(n))).assign(K(i.greaterThan(0), K(n.equal(W(fn - 1)), H(1), o.div(i)), H(0)));
226
- }), t.element(a.add(q(fn))).assign(i);
227
- })().compute(16, [16]);
228
- }
229
- function Tn({ counters: e }) {
230
- return I(() => {
231
- L(U.lessThan(q(N)), () => {
232
- Xe(e.element(q(P.GUIDE).add(U)), q(0));
233
- });
234
- })().compute(N, [256]);
235
- }
236
- //#endregion
237
- //#region src/TSL/LightGenerateKernel.js
238
- function En(e) {
239
- let { rayBufferRW: t, hitBufferRW: n, activeIndicesRW: r, counters: o, lightBuffer: c, triangleBuffer: m, bvhBuffer: ee, emissiveTriangleCount: te, emissiveVec4Offset: ne, emissiveTotalPower: h, emissiveBoost: re, sunDirection: g, sunRadiance: ie, sunParams: ae, environmentIntensity: oe, envTexture: se, envCDFTexture: ce, envMatrix: v, envResolution: le, directionalLightsBuffer: ue, areaLightsBuffer: de, pointLightsBuffer: fe, spotLightsBuffer: y, bidirectional: S, resolution: w, frame: T, transmissiveBounces: he } = e, { lightPaths: ge } = S;
240
- return I(() => {
241
- let e = U;
242
- L(e.equal(q(0)), () => {
243
- Xe(o.element(q(P.ACTIVE_RAY_COUNT)), ge), Xe(o.element(q(P.ENTERING_COUNT)), ge);
244
- }), L(e.greaterThanEqual(ge), () => {
245
- R();
246
- }), r.element(e).assign(e);
247
- let E = Ht(e, w).toVar(), O = Ae({ state: ve({
248
- pixelCoord: E,
249
- rayIndex: W(3),
250
- frame: T
251
- }) }).toVar(), A = Y(0).toVar(), j = Y(0, 1, 0).toVar(), M = Y(0).toVar(), N = H(0).toVar(), ke = H(0).toVar(), Pe = W(-1).toVar(), Ie = W(0).toVar(), Le = H(1).toVar(), ze = Ze(!1).toVar(), Be = Me(E, W(0), W(X + 4), O, w, T).toVar(), F = W(0).toVar(), We = W(S.sourceCount - 1).toVar();
252
- qe(F.lessThan(We), () => {
253
- let e = F.add(We).div(2).toVar();
254
- L(S.sourceCdf.element(e).lessThanEqual(Be), () => {
255
- F.assign(e.add(1));
256
- }).Else(() => {
257
- We.assign(e);
258
- });
259
- });
260
- let Ke = S.guideTexture, I = (e) => {
261
- let t = Sn(S, Ke, e, Me(E, W(0), W(X + 7), O, w, T), b(E, W(0), W(X + 6), O, w, T)).toVar();
262
- return {
263
- start: t,
264
- pdf: xn(S, Ke, e, t)
265
- };
266
- };
267
- L(F.equal(W(rn.SUN)), () => {
268
- let e = Ee(g, ae, b(E, W(0), W(X + 5), O, w, T)).toVar(), t = De(e, g, ie, ae).mul(oe).toVar(), n = I(e), r = nn(S, ae, n.pdf).toVar();
269
- L(t.x.add(t.y).add(t.z).greaterThan(0).and(r.greaterThan(0)), () => {
270
- A.assign(n.start), j.assign(e.negate()), M.assign(t.div(r)), N.assign(Q(H(1).div(ae.y.mul(r)))), ke.assign(Q(H(1).div(r))), ze.assign(!0);
271
- });
272
- }).ElseIf(F.equal(W(rn.EMITTERS)), () => {
273
- let e = Oe(c, ne, te, Me(E, W(0), W(X), O, w, T)).toVar(), t = ne.add(e.mul(W(2))), n = c.element(t).toVar(), r = c.element(t.add(W(1))).toVar();
274
- Pe.assign(W(n.x)), Ie.assign(W(n.w));
275
- let i = Re.wrap(Ce(Pe, m, ee, Ie)).toVar(), a = Fe(i.v0, i.v1, i.v2, b(E, W(0), W(X + 1), O, w, T)).toVar(), o = lt($e(i.v1.sub(i.v0), i.v2.sub(i.v0))).toVar(), u = D(l(m, Pe, 4).z).toVar(), d = K(u.equal(W(1)).or(u.equal(W(2)).and(Me(E, W(0), W(X + 3), O, w, T).lessThan(.5))).toVar(), o.negate(), o).toVar();
276
- j.assign(xe(d, b(E, W(0), W(X + 2), O, w, T)));
277
- let f = V(j, d).toVar(), p = G(n.y, 0).div(G(h, 1e-10)).div(G(r.w, 1e-20)).mul(K(u.equal(W(2)), H(.5), H(1))).mul(S.emitterPick).toVar(), g = p.mul(f).div(Math.PI).toVar();
278
- L(f.greaterThan(1e-6).and(g.greaterThan(0)), () => {
279
- A.assign(s(a, d)), M.assign(r.xyz.mul(re).mul(Math.PI).div(p)), N.assign(Q(H(1).div(g))), ke.assign(Q(f.div(g))), Le.assign(f), ze.assign(!0);
280
- });
281
- }).ElseIf(F.equal(W(rn.ENVIRONMENT)), () => {
282
- let e = me(ce, v, le, b(E, W(0), W(X + 5), O, w, T)), t = e.direction.toVar(), n = e.pdf.toVar(), r = Se({
283
- tex: se,
284
- samp: ut(se),
285
- direction: t,
286
- environmentMatrix: v,
287
- environmentIntensity: oe,
288
- enableEnvironmentLight: H(1)
289
- }).xyz.toVar(), i = I(t), a = S.envPick.mul(n).mul(i.pdf).toVar();
290
- L(r.x.add(r.y).add(r.z).greaterThan(0).and(a.greaterThan(0)), () => {
291
- A.assign(i.start), j.assign(t.negate()), M.assign(r.div(a)), N.assign(Q(n.div(a))), ke.assign(Q(H(1).div(a))), Pe.assign(W(-1 - rn.ENVIRONMENT)), ze.assign(!0);
292
- });
293
- }).ElseIf(F.greaterThanEqual(W(rn.LAMPS)), () => {
294
- let e = an(S, F).toVar(), t = sn(S, F).toVar(), n = cn(S, F, t).toVar();
295
- Pe.assign(W(-1).sub(F));
296
- let r = H(0).toVar(), i = Y(0).toVar(), a = b(E, W(0), W(X + 2), O, w, T).toVar();
297
- L(t.equal(W(0)), () => {
298
- let t = Ge.wrap(pe(ue, n)), a = lt(t.direction).toVar();
299
- i.assign(t.color.mul(t.intensity)), r.assign(e), L(t.angle.greaterThan(0), () => {
300
- let e = Pt(t).toVar();
301
- a.assign(x(a, t.angle.mul(.5), b(E, W(0), W(X + 5), O, w, T))), i.divAssign(e), r.divAssign(e);
302
- });
303
- let o = I(a);
304
- r.mulAssign(o.pdf), A.assign(o.start), j.assign(a.negate());
305
- }).ElseIf(t.equal(W(1)), () => {
306
- let t = Ve.wrap(ye(de, n)), o = t.shape.greaterThan(.5), s = b(E, W(0), W(X + 1), O, w, T).toVar(), c = ft(s.x), l = s.y.mul(2 * Math.PI);
307
- A.assign(t.position.add(t.u.mul(K(o, c.mul(Qe(l)), s.x.mul(2).sub(1)))).add(t.v.mul(K(o, c.mul(dt(l)), s.y.mul(2).sub(1))))), j.assign(xe(t.normal, a));
308
- let u = V(j, t.normal).toVar();
309
- i.assign(K(t.area.greaterThan(0).and(u.greaterThan(1e-6)), Te(t).mul(Ne(u, t.spread)).mul(u), Y(0))), r.assign(e.div(G(t.area, 1e-20)).mul(u).div(Math.PI)), ke.assign(Q(u.div(G(r, 1e-30))));
310
- }).ElseIf(t.equal(W(2)), () => {
311
- let t = k.wrap(He(fe, n));
312
- A.assign(t.position), j.assign(x(Y(0, 1, 0), H(Math.PI), a)), i.assign(t.color.mul(t.intensity)), r.assign(e.div(4 * Math.PI));
313
- }).Else(() => {
314
- let t = Ue.wrap(C(y, n));
315
- A.assign(t.position), j.assign(x(t.direction, t.angle, a));
316
- let o = j.negate();
317
- i.assign(t.color.mul(t.intensity).mul(be({
318
- coneCosine: Qe(t.angle),
319
- blend: t.penumbra,
320
- angleCosine: V(j, t.direction)
321
- })).mul(je(t, o)).mul(_e(t, o))), r.assign(e.div(Nt(t)));
322
- }), L(i.x.add(i.y).add(i.z).greaterThan(0).and(r.greaterThan(0)), () => {
323
- M.assign(i.div(r)), N.assign(Q(H(1).div(r))), ze.assign(!0);
324
- });
325
- }), L(ze.not(), () => {
326
- _(t, e, j, q(0)), R();
327
- });
328
- let z = G(G(G(M.x, M.y), M.z), 1e-20).toVar();
329
- i(t, e, A, W(0), W(0)), _(t, e, j, q(we.ACTIVE | we.REDIRECTED | we.LIGHT_PATH | we.LIGHT_EMITTED)), d(t, e, M.div(z), H(0)), f(t, e, _t(Y(0), H(1))), a(t, e, q(0), q(he), H(1), H(1), H(1)), p(n, e, O, N, ke), u(n, e, Pe, Ie, Le, z);
330
- });
331
- }
332
- //#endregion
333
- //#region src/TSL/ConnectKernel.js
334
- function Dn(e) {
335
- let { rayBufferRW: t, hitBufferRO: n, activeIndicesRO: r, counters: i, bvhBuffer: a, triangleBuffer: l, materialBuffer: u, resolution: d, frame: p, accumFrame: m, currentBounce: te, chunkRowBase: ne, lightPaths: h, slotsPerPath: g, lightTag: se, passTag: ce, strategyView: _, maxBounceCount: v, globalIlluminationIntensity: ue, fireflyThreshold: de, mergeVm: y = null, diffuseTransmission: b = !0 } = e;
336
- return I(() => {
337
- let e = U;
338
- L(e.greaterThanEqual(B(i.element(q(P.ENTERING_COUNT)))), () => {
339
- R();
340
- });
341
- let pe = r.element(e).toVar(), x = ee(pe);
342
- L(c(n, x).notEqual(ce), () => {
343
- R();
344
- });
345
- let S = o(n, x), C = {
346
- ...S,
347
- vm: y?.(S.position) ?? null
348
- }, w = W(C.extra).add(W(1)).toVar(), me = W(d.x), T = W(pe).add(ne.mul(me)), he = gt(H(T.mod(me)).add(.5), H(T.div(me)).add(.5)).toVar(), ge = W(te).mul(W(32)), _e = Ae({ state: ie(n, pe).bitXor(q(2654435769)) }).toVar(), ve = Me(he, W(0), ge.add(W(16)), _e, d, p).toVar(), ye = Me(he, W(0), ge.add(W(17)), _e, d, p).toVar(), be = st(q(H(h).mul(ve)), h.sub(q(1))).toVar().mul(g).toVar(), xe = st(W(fe(n, le(be), se)), W(v).add(W(1)).sub(w)).toVar();
349
- L(xe.lessThan(W(1)), () => {
350
- R();
351
- });
352
- let E = st(W(H(xe).mul(ye)), xe.sub(W(1))).toVar(), Se = o(n, le(be.add(q(E)))), D = {
353
- ...Se,
354
- vm: y?.(Se.position) ?? null
355
- }, Ce = D.position.sub(C.position).toVar(), we = G(V(Ce, Ce), 1e-12).toVar(), k = Ce.div(ft(we)).toVar(), A = V(k, C.N).toVar(), Te = V(k, C.facetN).toVar(), Ee = V(k, D.facetN).negate().toVar(), De = A.greaterThan(0).and(Te.greaterThan(0)).and(Ee.greaterThan(0)), j = A.lessThan(0).and(Te.lessThan(0)), M = Ee.lessThan(0);
356
- L((b ? j.or(A.greaterThan(0).and(Te.greaterThan(0))).and(M.or(Ee.greaterThan(0))) : De).not(), () => {
357
- R();
358
- });
359
- let Oe = ln(C.materialIndex, C.uv, C.N, u), N = ln(D.materialIndex, D.uv, D.N, u), je = k.negate();
360
- b && L(j.and(Oe.diffuseTransmission.lessThanEqual(0)).or(M.and(N.diffuseTransmission.lessThanEqual(0))), () => {
361
- R();
362
- });
363
- let Ne = (e) => b ? un(C.N, e, Oe) : C.N, Pe = (e) => b ? un(D.N, e, N) : D.N, Fe = ke(C.V, k, C.N, Oe).toVar(), Ie = ke(je, D.V, Pe(je), N).toVar(), Re = (b ? z(A) : A).mul(dn(D.V, D.N, D.facetN, je)).div(we), Be = F(C.V, k, C.N, Oe), Ve = F(k, C.V, Ne(k), Oe), He = F(D.V, je, D.N, N), Ue = F(je, D.V, Pe(je), N), We = Kt(Be.mul(b ? z(Ee) : Ee).div(we), D, Ue), Ge = Kt(He.mul(b ? z(Te) : Te).div(we), C, Ve), Ke = w.add(E).add(W(1)), I = $t(_, Qt.CONNECT, Zt(We, Ge), H(1).div(H(Ke.sub(W(1))))), qe = ze(C.throughput.mul(Fe).mul(Ie).mul(D.throughput).mul(Re.mul(I).mul(H(xe)).mul(ue)), H(Ke.sub(W(1))), de, W(m)).toVar();
364
- L(ae(qe).greaterThan(0), () => {
365
- let e = s(C.position, b ? K(j, C.facetN.negate(), C.facetN) : C.facetN).toVar(), n = s(D.position, b ? K(M, D.facetN.negate(), D.facetN) : D.facetN).sub(e).toVar(), r = it(n).toVar(), i = O(e, n.div(r), r.mul(re), Le, a, l, u);
366
- L(i.greaterThan(0), () => {
367
- let e = oe(t, pe).toVar();
368
- f(t, pe, _t(e.xyz.add(qe.mul(i)), e.w));
369
- });
370
- });
371
- });
372
- }
373
- var On = 4294967295, kn = 1024, An = Math.log2(1.25), jn = (e, t) => W(G(tt(ot(t.div(e.mergeMin)).div(An)), 0)), Mn = (e, t) => e.mergeMin.mul(et(H(t.add(W(1))).mul(An))).mul(2).div(G(H(1).sub(e.mergeSlope), .5)), Nn = (e, t, n) => q(t.x).mul(q(73856093)).bitXor(q(t.y).mul(q(19349663))).bitXor(q(t.z).mul(q(83492791))).bitXor(q(e).mul(q(2654435761))).bitAnd(n), Pn = (e, t) => {
374
- let n = jn(e, qt(e, t)).toVar();
375
- return {
376
- shell: n,
377
- cell: rt(tt(t.div(Mn(e, n)))).toVar()
378
- };
379
- };
380
- function Fn({ head: e, hashSize: t }) {
381
- return I(() => {
382
- L(U.lessThan(q(t)), () => {
383
- Xe(e.element(U), q(On));
384
- });
385
- })().compute(Math.ceil(t / 256) * 256, [256]);
386
- }
387
- function In({ hitBufferRW: e, head: t, bidirectional: n }) {
388
- let { lightPaths: i, slotsPerPath: a, lightTag: o, hashMask: s } = n;
389
- return I(() => {
390
- let c = U.toVar();
391
- L(c.greaterThanEqual(i.mul(a)), () => {
392
- R();
393
- });
394
- let l = c.mod(a).toVar();
395
- L(l.greaterThanEqual(fe(e, le(c.sub(l)), o)), () => {
396
- R();
397
- });
398
- let u = le(c), { shell: d, cell: f } = Pn(n, r(e, u)), p = Nn(d, f, s);
399
- h(e, u, Ye("atomicExchange", t.element(p), c));
400
- });
401
- }
402
- function Ln(e) {
403
- let { rayBufferRW: n, hitBufferRO: i, activeIndicesRO: a, counters: s, head: l, materialBuffer: u, bidirectional: d, maxBounceCount: p, globalIlluminationIntensity: m, fireflyThreshold: te, accumFrame: ne, diffuseTransmission: h = !0 } = e, { passTag: re, slotsPerPath: g, strategyView: ie, hashMask: se } = d;
404
- return I(() => {
405
- let e = U;
406
- L(e.greaterThanEqual(B(s.element(q(P.ENTERING_COUNT)))), () => {
407
- R();
408
- });
409
- let ce = a.element(e).toVar(), _ = ee(ce);
410
- L(c(i, _).notEqual(re), () => {
411
- R();
412
- });
413
- let v = o(i, _), ue = W(v.extra).toVar(), de = W(p).add(W(1)).sub(ue).toVar(), fe = ln(v.materialIndex, v.uv, v.N, u), y = Y(0).toVar(), b = qt(d, v.position).toVar(), pe = b.mul(b).toVar(), x = Jt(d, b).toVar(), S = x.mul(d.mergeTrust), C = H(1).div(G(S.mul(S), 1e-30)).toVar(), w = it(v.position.sub(d.cameraPosition)).toVar(), me = jn(d, G(d.mergeConst.add(d.mergeSlope.mul(G(w.sub(b), 0))), d.mergeMin)).toVar(), T = st(jn(d, d.mergeConst.add(d.mergeSlope.mul(w.add(b)))), me.add(W(1))).toVar();
414
- qe({
415
- start: W(0),
416
- end: W(16),
417
- type: "int",
418
- condition: "<"
419
- }, ({ i: e }) => {
420
- let n = me.add(e.shiftRight(W(3))).toVar();
421
- L(n.greaterThan(T), () => {
422
- Ke();
423
- });
424
- let a = Mn(d, n).toVar(), s = e.bitAnd(W(7)), c = rt(tt(v.position.div(a).sub(.5))).add(rt(s.bitAnd(W(1)), s.shiftRight(W(1)).bitAnd(W(1)), s.shiftRight(W(2)))).toVar(), u = B(l.element(Nn(n, c, se))).toVar(), f = W(0).toVar();
425
- qe(u.notEqual(q(On)).and(f.lessThan(W(kn))), () => {
426
- let e = le(u), a = r(i, e).toVar(), s = a.sub(v.position), l = W(u.mod(g)).add(W(1)).toVar();
427
- L(V(s, s).lessThan(pe).and(l.lessThanEqual(de)), () => {
428
- let t = Pn(d, a);
429
- L(t.shell.equal(n).and(t.cell.x.equal(c.x)).and(t.cell.y.equal(c.y)).and(t.cell.z.equal(c.z)), () => {
430
- let t = o(i, e), n = V(t.V, v.N).toVar(), r = V(t.V, v.facetN).toVar(), a = n.greaterThan(0).and(r.greaterThan(0)), s = fe.diffuseTransmission.greaterThan(0).and(n.lessThan(0)).and(r.lessThan(0));
431
- L(h ? a.or(s) : a, () => {
432
- let e = ke(v.V, t.V, v.N, fe), i = Xt(t, F(v.V, t.V, v.N, fe), C), a = h ? un(v.N, t.V, fe) : v.N, o = Xt(v, F(t.V, v.V, a, fe), C), s = ue.add(l), c = $t(ie, Qt.MERGE, Zt(i, o), H(1).div(H(s))), u = K(s.greaterThan(W(1)), m, H(1)), d = h ? z(n).div(G(z(r), 1e-4)) : n.div(G(r, 1e-4));
433
- y.addAssign(ze(v.throughput.mul(e).mul(t.throughput).mul(c.mul(d).div(x).mul(u)), H(s.sub(W(1))), te, W(ne)));
434
- });
435
- });
436
- }), u.assign(t(i, e)), f.addAssign(W(1));
437
- });
438
- }), L(ae(y).greaterThan(0), () => {
439
- let e = oe(n, ce).toVar();
440
- f(n, ce, _t(e.xyz.add(y), e.w));
441
- });
442
- });
443
- }
444
- function Rn(e) {
445
- let { hitBufferRO: t, splatBuffer: r, bvhBuffer: i, triangleBuffer: a, materialBuffer: c, lightPaths: l, slotsPerPath: u, lightTag: d, strategyView: f, cameraPosition: p, cameraForward: m, cameraViewMatrix: ee, cameraProjectionMatrix: te, pixelArea: ne, renderWidth: h, renderHeight: g, globalIlluminationIntensity: ie, fireflyThreshold: ae, accumFrame: oe, frame: se, mergeVm: ce = null, diffuseTransmission: _ = !0 } = e;
446
- return I(() => {
447
- let e = U.toVar();
448
- L(e.greaterThanEqual(l.mul(u)), () => {
449
- R();
450
- });
451
- let v = e.mod(u).toVar(), ue = fe(t, le(e.sub(v)), d);
452
- L(v.greaterThanEqual(ue), () => {
453
- R();
454
- });
455
- let de = o(t, le(e)), y = {
456
- ...de,
457
- vm: ce?.(de.position) ?? null
458
- }, b = p.sub(y.position).toVar(), pe = G(V(b, b), 1e-12).toVar(), x = b.div(ft(pe)).toVar(), S = V(x, y.facetN).toVar(), C = V(x, m).negate().toVar(), w = S.lessThan(0), me = _ ? K(w, y.extra.bitAnd(q(2)), y.extra.bitAnd(q(1))).notEqual(q(0)) : y.extra.notEqual(q(0));
459
- L((_ ? S.equal(0) : S.lessThanEqual(0)).or(C.lessThanEqual(1e-6)).or(me), () => {
460
- R();
461
- });
462
- let T = te.mul(ee.mul(_t(y.position, 1))).toVar();
463
- L(T.w.lessThanEqual(0), () => {
464
- R();
465
- });
466
- let ge = tt(T.x.div(T.w).mul(.5).add(.5).mul(H(h))).toVar(), _e = tt(H(.5).sub(T.y.div(T.w).mul(.5)).mul(H(g))).toVar();
467
- L(ge.lessThan(0).or(_e.lessThan(0)).or(ge.greaterThanEqual(H(h))).or(_e.greaterThanEqual(H(g))), () => {
468
- R();
469
- });
470
- let ve = ln(y.materialIndex, y.uv, y.N, c);
471
- _ && L(w.and(ve.diffuseTransmission.lessThanEqual(0)), () => {
472
- R();
473
- });
474
- let ye = _ ? un(y.N, x, ve) : y.N, be = ke(x, y.V, ye, ve).toVar(), xe = H(1).div(ne.mul(C).mul(C).mul(C)).div(pe).toVar(), E = Kt(xe.mul(_ ? z(S) : S).div(H(l)), y, F(x, y.V, ye, ve)), Se = v.add(q(1)), D = H(1).toVar();
475
- L(Se.greaterThan(q(1)), () => {
476
- D.assign(ie);
477
- });
478
- let Ce = ze(y.throughput.mul(be).mul(dn(y.V, y.N, y.facetN, x)).mul(xe.div(H(l)).mul($t(f, Qt.LIGHT_TRACE, Zt(E, H(0)))).mul(D)), H(v), ae, W(oe)).toVar(), we = s(y.position, _ ? K(w, y.facetN.negate(), y.facetN) : y.facetN).toVar(), k = p.sub(we).toVar(), A = it(k).toVar(), Te = O(we, k.div(A), A.mul(re), he, i, a, c);
479
- L(Te.greaterThan(0), () => {
480
- let t = st(n(Ce.mul(Te)), Y(zt)).mul(Rt).toVar(), i = H(Ae({ state: e.bitXor(q(se).mul(q(2654435769))) }).shiftRight(q(8))).mul(1 / 16777216).toVar(), a = q(_e).mul(q(h)).add(q(ge)).mul(q(3)).toVar();
481
- Je(r.element(a), q(tt(t.x.add(i)))), Je(r.element(a.add(q(1))), q(tt(t.y.add(i)))), Je(r.element(a.add(q(2))), q(tt(t.z.add(i))));
482
- });
483
- });
484
- }
485
- function zn(e) {
486
- let { rayBufferRW: t, splatBuffer: n, renderWidth: r, chunkRowBase: i, chunkRows: a } = e;
487
- return I(() => {
488
- let e = W(vt.x).mul(16).add(W(at.x)), o = W(vt.y).mul(16).add(W(at.y));
489
- L(e.lessThan(r).and(o.lessThan(a)), () => {
490
- let a = q(o.mul(r).add(e)), s = q(o.add(i).mul(r).add(e)).mul(q(3)).toVar(), c = B(n.element(s)).toVar(), l = B(n.element(s.add(q(1)))).toVar(), u = B(n.element(s.add(q(2)))).toVar();
491
- L(c.bitOr(l).bitOr(u).notEqual(q(0)), () => {
492
- Xe(n.element(s), q(0)), Xe(n.element(s.add(q(1))), q(0)), Xe(n.element(s.add(q(2))), q(0));
493
- let e = oe(t, a).toVar();
494
- f(t, a, _t(e.xyz.add(Y(H(c), H(l), H(u)).div(Rt)), e.w));
495
- });
496
- });
497
- });
498
- }
499
- //#endregion
500
- //#region src/integrators/BidirectionalIntegrator.js
501
- var { PASS_TAG_BIT: Bn, STRATEGY: Vn, STRATEGY_ALONE: Hn, SOURCE: $, mergeVmAt: Un } = It, Wn = {
502
- ...It,
503
- ...Tt,
504
- guidedDiscPdf: xn,
505
- recordEscape: Cn
506
- }, Gn = 256 * 1024 * 1024, Kn = .05, qn = .5, Jn = (1 << 24) - 1, Yn = 1, Xn = .75, Zn = .25, Qn = class {
507
- constructor(e) {
508
- this.pt = e, this.merging = !1, this._mergeRadiusPixels = Yn, this._mergeHeadAttr = null, this._lightCacheSlots = 0, this._splatAttr = null, this._lightTag = 0, this._passTag = 0, this._lightTraced = !1, this._lastLightBounceCounts = null, this._lastLightBounceEnergy = null, this._lastLightCurveKey = null, this._lightCurveKey = null, this.uniforms = {
509
- lib: Wn,
510
- lightPaths: J(0, "uint"),
511
- slotsPerPath: J(1, "uint"),
512
- lightTag: J(1, "uint"),
513
- passTag: J(0, "uint"),
514
- lightTrace: J(0, "uint"),
515
- strategyView: J(0, "uint"),
516
- pixelArea: J(1, "float"),
517
- cameraPosition: J(new St(), "vec3"),
518
- cameraForward: J(new St(0, 0, -1), "vec3"),
519
- sunPick: J(0, "float"),
520
- emitterPick: J(0, "float"),
521
- envPick: J(0, "float"),
522
- envTable: J(0, "uint"),
523
- sourceCdf: ht(new Float32Array($.LAMPS), "float"),
524
- sourceCount: $.LAMPS,
525
- sourceOffsets: [
526
- $.LAMPS,
527
- $.LAMPS,
528
- $.LAMPS,
529
- $.LAMPS
530
- ],
531
- sceneCenter: J(new St(), "vec3"),
532
- sceneRadius: J(1, "float"),
533
- guide: J(0, "uint"),
534
- guideLearning: J(1, "uint"),
535
- guideTexture: null,
536
- merging: !1,
537
- mergeConst: J(0, "float"),
538
- mergeSlope: J(0, "float"),
539
- mergeMin: J(1, "float"),
540
- mergeTrust: J(Zn, "float"),
541
- hashMask: J(0, "uint")
542
- }, this._lightGuiding = !0, this._guideTexture = null, this._guideBuildAttr = null, this._u32Views = /* @__PURE__ */ new WeakMap();
543
- }
544
- get name() {
545
- return this.merging ? "vcm" : "bidirectional";
546
- }
547
- select(e) {
548
- this.merging = e === "vcm", this.uniforms.merging = this.merging, this._lastLightCurveKey = null;
549
- }
550
- get hitStride() {
551
- return 7;
552
- }
553
- cacheBytes(e, t) {
554
- let n = Math.floor(Math.min(Gn, e * .45, t * .05) / 64) * 64;
555
- return this._lightCacheSlots = n / 64, n;
556
- }
557
- get lightVertices() {
558
- return this._lightCacheSlots;
559
- }
560
- beforeKernelBuild() {
561
- this._sizeSourceTable();
562
- }
563
- allocate(e) {
564
- (!this._splatAttr || this._splatAttr.count < e * 3) && (g(this.pt.renderer, this._splatAttr), this._splatAttr = ce(e * 3, 1, Uint32Array));
565
- let t = this.merging ? 2 ** Math.ceil(Math.log2(Math.max(this._lightCacheSlots, 1024))) : 0;
566
- this._mergeHeadAttr?.count !== t && (g(this.pt.renderer, this._mergeHeadAttr), this._mergeHeadAttr = t > 0 ? ce(t, 1, Uint32Array) : null), this.uniforms.hashMask.value = Math.max(t - 1, 0), this._guideTexture || (this._guideTexture = new yt(null, pn, 16, xt, bt), this._guideTexture.source.dataReady = !1, this._guideTexture.needsUpdate = !0, this._guideBuildAttr = ce(mn * 16, 1, Float32Array)), this.uniforms.guideTexture = mt(this._guideTexture), this.uniforms.guide.value = 0;
567
- }
568
- registerKernels(e) {
569
- let { km: t, qm: n, pb: r, counters: i, bounceCountsBuf: a, wfCurrentBounce: o, copyReadB: s, copyWriteA: c, maxRays: l, w: u, own: d, freshLight: f, freshTri: p, freshBvh: m, freshMat: ee, freshEnvTex: te, freshEnvCDF: ne, materialLayers: h } = e, re = h?.diffuseTransmission ?? !0, g = this.uniforms, ie = n.MAX_BOUNCE_SNAPSHOTS, ae = (e) => {
570
- let t = q(o).clamp(q(0), q(ie - 1));
571
- a.element(t.add(q(2 * ie))).assign(e), a.element(t.add(q(3 * ie))).assign(B(i.element(q(P.ACTIVE_ENERGY)))), Xe(i.element(q(P.ENTERING_COUNT)), e);
572
- };
573
- if (t.register("lightSnapshot", I(() => {
574
- ae(B(i.element(q(P.ACTIVE_RAY_COUNT))));
575
- })().compute([
576
- 1,
577
- 1,
578
- 1
579
- ], [
580
- 1,
581
- 1,
582
- 1
583
- ])), t.register("lightCopyback", I(() => {
584
- let e = U, t = B(i.element(q(P.ACTIVE_RAY_COUNT)));
585
- L(e.equal(q(0)), () => {
586
- ae(t);
587
- }), L(e.greaterThanEqual(t), () => {
588
- R();
589
- }), c.element(e).assign(s.element(e));
590
- })().compute([
591
- Math.ceil(l / 256),
592
- 1,
593
- 1
594
- ], [
595
- 256,
596
- 1,
597
- 1
598
- ])), t.register("guideClear", Tn({ counters: i })), t.register("guideBuild", wn({
599
- counters: i,
600
- out: pt(this._guideBuildAttr, "float")
601
- })), t.register("lightGenerate", d(En({
602
- rayBufferRW: r.rayBuffer.rw,
603
- hitBufferRW: r.hitBuffer.rw,
604
- activeIndicesRW: n.activeIndices.a,
605
- counters: i,
606
- lightBuffer: f,
607
- triangleBuffer: p,
608
- bvhBuffer: m,
609
- emissiveTriangleCount: this.pt.emissiveTriangleCount,
610
- emissiveVec4Offset: this.pt.emissiveVec4Offset,
611
- emissiveTotalPower: this.pt.emissiveTotalPower,
612
- emissiveBoost: this.pt.emissiveBoost,
613
- sunDirection: this.pt.sunDirection,
614
- sunRadiance: this.pt.sunRadiance,
615
- sunParams: this.pt.sunParams,
616
- environmentIntensity: this.pt.environmentIntensity,
617
- envTexture: te,
618
- envCDFTexture: ne,
619
- envMatrix: this.pt.environmentMatrix,
620
- envResolution: this.pt.envResolution,
621
- directionalLightsBuffer: this.pt.directionalLightsBufferNode,
622
- areaLightsBuffer: this.pt.areaLightsBufferNode,
623
- pointLightsBuffer: this.pt.pointLightsBufferNode,
624
- spotLightsBuffer: this.pt.spotLightsBufferNode,
625
- bidirectional: g,
626
- resolution: this.pt.resolution,
627
- frame: this.pt.seedFrame,
628
- transmissiveBounces: this.pt.transmissiveBounces
629
- })()).compute([
630
- Math.ceil(l / 256),
631
- 1,
632
- 1
633
- ], [
634
- 256,
635
- 1,
636
- 1
637
- ])), t.register("connect", d(Dn({
638
- rayBufferRW: r.rayBuffer.rw,
639
- hitBufferRO: r.hitBuffer.ro,
640
- activeIndicesRO: n.getActiveReadRO(),
641
- counters: i,
642
- bvhBuffer: m,
643
- triangleBuffer: p,
644
- materialBuffer: ee,
645
- resolution: this.pt.resolution,
646
- frame: this.pt.seedFrame,
647
- accumFrame: this.pt.frame,
648
- currentBounce: this.pt._wfCurrentBounce,
649
- chunkRowBase: this.pt._wfChunkRowBase,
650
- lightPaths: g.lightPaths,
651
- slotsPerPath: g.slotsPerPath,
652
- lightTag: g.lightTag,
653
- passTag: g.passTag,
654
- strategyView: g.strategyView,
655
- maxBounceCount: this.pt.maxBounces,
656
- globalIlluminationIntensity: this.pt.globalIlluminationIntensity,
657
- fireflyThreshold: this.pt.fireflyThreshold,
658
- mergeVm: g.merging ? (e) => Un(g, e) : null,
659
- diffuseTransmission: re
660
- })()).compute([
661
- Math.ceil(l / 256),
662
- 1,
663
- 1
664
- ], [
665
- 256,
666
- 1,
667
- 1
668
- ])), g.merging) {
669
- let e = pt(this._mergeHeadAttr, "uint").toAtomic();
670
- t.register("mergeClear", Fn({
671
- head: e,
672
- hashSize: this._mergeHeadAttr.count
673
- })), t.register("mergeInsert", In({
674
- hitBufferRW: r.hitBuffer.rw,
675
- head: e,
676
- bidirectional: g
677
- })().compute([
678
- Math.ceil(this._lightCacheSlots / 256),
679
- 1,
680
- 1
681
- ], [
682
- 256,
683
- 1,
684
- 1
685
- ])), t.register("merge", d(Ln({
686
- rayBufferRW: r.rayBuffer.rw,
687
- hitBufferRO: r.hitBuffer.ro,
688
- activeIndicesRO: n.getActiveReadRO(),
689
- counters: i,
690
- head: e,
691
- materialBuffer: ee,
692
- bidirectional: g,
693
- maxBounceCount: this.pt.maxBounces,
694
- globalIlluminationIntensity: this.pt.globalIlluminationIntensity,
695
- fireflyThreshold: this.pt.fireflyThreshold,
696
- accumFrame: this.pt.frame,
697
- diffuseTransmission: re
698
- })()).compute([
699
- Math.ceil(l / 256),
700
- 1,
701
- 1
702
- ], [
703
- 256,
704
- 1,
705
- 1
706
- ]));
707
- }
708
- let oe = pt(this._splatAttr, "uint").toAtomic();
709
- t.register("lightSplat", d(Rn({
710
- hitBufferRO: r.hitBuffer.ro,
711
- splatBuffer: oe,
712
- bvhBuffer: m,
713
- triangleBuffer: p,
714
- materialBuffer: ee,
715
- lightPaths: g.lightPaths,
716
- slotsPerPath: g.slotsPerPath,
717
- lightTag: g.lightTag,
718
- strategyView: g.strategyView,
719
- cameraPosition: g.cameraPosition,
720
- cameraForward: g.cameraForward,
721
- cameraViewMatrix: this.pt.cameraViewMatrix,
722
- cameraProjectionMatrix: this.pt.cameraProjectionMatrix,
723
- pixelArea: g.pixelArea,
724
- renderWidth: this.pt._wfRenderWidth,
725
- renderHeight: this.pt._wfRenderHeight,
726
- globalIlluminationIntensity: this.pt.globalIlluminationIntensity,
727
- fireflyThreshold: this.pt.fireflyThreshold,
728
- accumFrame: this.pt.frame,
729
- frame: this.pt.seedFrame,
730
- mergeVm: g.merging ? (e) => Un(g, e) : null,
731
- diffuseTransmission: re
732
- })()).compute([
733
- Math.ceil(this._lightCacheSlots / 256),
734
- 1,
735
- 1
736
- ], [
737
- 256,
738
- 1,
739
- 1
740
- ])), t.register("splatResolve", zn({
741
- rayBufferRW: r.rayBuffer.rw,
742
- splatBuffer: oe,
743
- renderWidth: this.pt._wfRenderWidth,
744
- chunkRowBase: this.pt._wfChunkRowBase,
745
- chunkRows: this.pt._wfChunkRows
746
- })().compute([
747
- Math.ceil(u / 16),
748
- Math.ceil(this.pt._chunkRows / 16),
749
- 1
750
- ], [
751
- 16,
752
- 16,
753
- 1
754
- ]));
755
- }
756
- beginFrame(e) {
757
- let t = this._updateBidirectionalUniforms();
758
- return this._lightTraced = t && this.uniforms.lightTrace.value > 0, t && (this._updateLightGuide(), this._traceLightPaths(e)), t;
759
- }
760
- beforeShade() {
761
- this.uniforms.passTag.value = this._nextPassTag();
762
- }
763
- afterShade(e) {
764
- e.dispatch("connect"), this.merging && e.dispatch("merge");
765
- }
766
- resolve(e) {
767
- this._lightTraced && e.dispatch("splatResolve");
768
- }
769
- get curveKey() {
770
- return this._lightCurveKey;
771
- }
772
- applyLightCurve(e, t, n) {
773
- this._lastLightBounceCounts = e, this._lastLightBounceEnergy = t, this._lastLightCurveKey = n;
774
- }
775
- describe() {
776
- return `${this.name}: ${this._lightCacheSlots.toLocaleString("en-US")} light vertex slots`;
777
- }
778
- gpuResources() {
779
- return this._splatAttr ? [this._splatAttr, this._mergeHeadAttr].filter(Boolean) : null;
780
- }
781
- dispose() {
782
- g(this.pt.renderer, this._splatAttr), this._splatAttr = null, g(this.pt.renderer, this._mergeHeadAttr), this._mergeHeadAttr = null, this._disposeLightGuide();
783
- }
784
- setBidirectionalStrategy(e = "all", { alone: t = !1 } = {}) {
785
- let n = {
786
- all: Vn.ALL,
787
- hit: Vn.HIT,
788
- nee: Vn.NEE,
789
- connect: Vn.CONNECT,
790
- lightTrace: Vn.LIGHT_TRACE,
791
- merge: Vn.MERGE
792
- }[e] ?? Vn.ALL;
793
- this.uniforms.strategyView.value = n === Vn.ALL ? n : n + (t ? Hn : 0);
794
- }
795
- setMergeRadius(e = Yn) {
796
- this._mergeRadiusPixels = Math.max(e, .001);
797
- }
798
- setMergeTrust(e = Zn) {
799
- this.uniforms.mergeTrust.value = Math.max(e, 1e-4);
800
- }
801
- _updateBidirectionalUniforms() {
802
- let e = this.uniforms, t = this.pt._wfRenderWidth.value, n = this.pt._wfRenderHeight.value, r = this.pt.maxBounces.value + 1, i = this._updateSourceTable() > 0 ? Math.min(Math.ceil(t * n * qn), this.pt._packedBuffers.capacity, Math.floor(this._lightCacheSlots / r)) : 0;
803
- if (e.lightPaths.value = i, e.slotsPerPath.value = r, this._lightCurveKey = `${i}:${r}:${this.pt._bounceLoopBound()}`, i === 0) return e.lightTrace.value = 0, !1;
804
- this._lightTag = this._lightTag % Jn + 1, e.lightTag.value = this._lightTag;
805
- let a = this.pt.cameraWorldMatrix.value.elements;
806
- e.cameraPosition.value.set(a[12], a[13], a[14]), e.cameraForward.value.set(-a[8], -a[9], -a[10]).normalize();
807
- let o = this.pt.cameraProjectionMatrix.value.elements;
808
- e.pixelArea.value = 4 / (o[0] * o[5] * t * n);
809
- let s = this.pt.cameraProjection.value === We.perspective && !this.pt.enableDOF.value;
810
- return e.lightTrace.value = +!!s, this.merging && this._updateMergeRadius(t, n), !0;
811
- }
812
- _updateMergeRadius(e, t) {
813
- let n = this.uniforms, r = this._mergeRadiusPixels * (this.pt.frameCount + 1) ** ((Xn - 1) / 2), i = this.pt.cameraProjection.value, a = this.pt.cameraProjectionMatrix.value.elements, o = 0, s = 0;
814
- i === We.orthographic ? s = r * 2 / (a[5] * t) : o = i === We.equirectangular ? r * 2 * Math.PI / e : r * Math.sqrt(n.pixelArea.value), n.mergeSlope.value = Math.min(o, .1), n.mergeConst.value = s, n.mergeMin.value = Math.max(s, o * .001 * n.sceneRadius.value, 1e-9);
815
- }
816
- _sizeSourceTable() {
817
- let e = this.uniforms, t = $.LAMPS;
818
- [
819
- "directional",
820
- "area",
821
- "point",
822
- "spot"
823
- ].forEach((n, r) => {
824
- e.sourceOffsets[r] = t, t += this.pt[`${n}LightsBufferNode`].array.length / A[n];
825
- }), e.sourceCount = t, e.sourceCdf.array.length !== t && (e.sourceCdf.array = new Float32Array(t));
826
- }
827
- _updateSourceTable() {
828
- let e = this.uniforms, t = e.sourceCdf.array, n = new Float64Array(t.length), r = (e, t) => Math.max(.2126 * e[t] + .7152 * e[t + 1] + .0722 * e[t + 2], 0), i = (e) => ({
829
- a: this.pt[`${e}LightsBufferNode`].array,
830
- n: this.pt[`num${e[0].toUpperCase()}${e.slice(1)}Lights`].value,
831
- f: A[e]
832
- }), a = i("directional"), o = this.pt.enableEnvironment.value > 0, s = this.pt.environment.exactTable;
833
- e.envTable.value = +!!s;
834
- let c = o && (this.pt.hasSun.value > 0 || s) || a.n > 0, l = c || this.merging ? this._sceneDisc() : 0, u = c ? l * Kn : 0;
835
- if (o && s && (n[$.ENVIRONMENT] = Math.max(s.radianceIntegral, 0) * this.pt.environmentIntensity.value * u), this.pt.emissiveTriangleCount.value > 0 && (n[$.EMITTERS] = Math.PI * this.pt.emissiveBoost.value * this.pt.emissiveTotalPower.value), o && this.pt.hasSun.value > 0) {
836
- let { x: e, y: t, z: r } = this.pt.sunRadiance.value;
837
- n[$.SUN] = Math.max(.2126 * e + .7152 * t + .0722 * r, 0) * this.pt.environmentIntensity.value * this.pt.sunParams.value.y * u;
838
- }
839
- for (let t = 0; t < a.n; t++) n[e.sourceOffsets[0] + t] = r(a.a, t * a.f + 3) * a.a[t * a.f + 6] * u;
840
- let d = i("area");
841
- for (let t = 0; t < d.n; t++) {
842
- let i = d.a, a = t * d.f, o = i[a + 4] * i[a + 8] - i[a + 5] * i[a + 7], s = i[a + 5] * i[a + 6] - i[a + 3] * i[a + 8], c = i[a + 3] * i[a + 7] - i[a + 4] * i[a + 6], l = 4 * Math.hypot(o, s, c) * (i[a + 15] > .5 ? Math.PI / 4 : 1);
843
- n[e.sourceOffsets[1] + t] = l > 0 ? r(i, a + 9) * Math.max(i[a + 12], 0) * (i[a + 13] > .5 ? 1 : l) : 0;
844
- }
845
- let f = i("point");
846
- for (let t = 0; t < f.n; t++) n[e.sourceOffsets[2] + t] = 4 * Math.PI * r(f.a, t * f.f + 3) * Math.max(f.a[t * f.f + 6], 0);
847
- let p = i("spot");
848
- for (let t = 0; t < p.n; t++) {
849
- let i = t * p.f;
850
- n[e.sourceOffsets[3] + t] = 2 * Math.PI * (1 - Math.cos(p.a[i + 10])) * r(p.a, i + 6) * Math.max(p.a[i + 9], 0);
851
- }
852
- let m = 0;
853
- for (let e = 0; e < n.length; e++) m += Number.isFinite(n[e]) ? n[e] : 0;
854
- let ee = 0;
855
- for (let e = 0; e < n.length; e++) ee += Number.isFinite(n[e]) ? n[e] : 0, t[e] = m > 0 ? ee / m : 0;
856
- m > 0 && (t[t.length - 1] = 1);
857
- let te = (e) => Math.fround(t[e] - (e > 0 ? t[e - 1] : 0));
858
- return e.sunPick.value = te($.SUN), e.emitterPick.value = te($.EMITTERS), e.envPick.value = te($.ENVIRONMENT), m;
859
- }
860
- _sceneDisc() {
861
- let e = this.uniforms, t = this._visibleSceneBounds();
862
- if (!t) return 0;
863
- let [n, r, i] = t.min, [a, o, s] = t.max, c = .5 * Math.hypot(a - n, o - r, s - i);
864
- return c > 0 && Number.isFinite(c) ? (e.sceneCenter.value.set((n + a) / 2, (r + o) / 2, (i + s) / 2), e.sceneRadius.value = c, Math.PI * c * c) : 0;
865
- }
866
- _visibleSceneBounds() {
867
- let e = this.pt._bvhRecords, t = e ? null : this.pt.bvhStorageAttr?.array;
868
- if (!e && !(t?.length >= 16)) return null;
869
- let n = (e) => {
870
- let t = this._u32Views.get(e);
871
- return t || this._u32Views.set(e, t = new Uint32Array(e.buffer, e.byteOffset, e.length)), t;
872
- }, r = (r) => {
873
- let i = e ? e.chunkFor(r) : t;
874
- return {
875
- f: i,
876
- u: n(i),
877
- o: e ? e.baseOf(r) : r * 16
878
- };
879
- }, i = r(0);
880
- if (i.u[i.o + 3] >= 1073741824) return null;
881
- let a = e ? e.recordCount : t.length / 16, o = [], s = [];
882
- for (let e = 0; e < 3; e++) for (let t of [1, -1]) {
883
- let n = (n, r) => t > 0 ? n.f[n.o + r * 8 + 4 + e] : -n.f[n.o + r * 8 + e], c = (e, t) => e.u[e.o + 3 + t * 4], l = -Infinity, u = [], d = (e) => {
884
- let t = n(e, 0), r = n(e, 1), i = t <= r ? 0 : 1;
885
- u.push(c(e, i), i === 0 ? t : r, c(e, 1 - i), i === 0 ? r : t);
886
- };
887
- d(i);
888
- let f = 0;
889
- for (; u.length;) {
890
- let e = u.pop(), t = u.pop();
891
- if (e <= l) continue;
892
- if (t >= a || ++f > a) return null;
893
- let n = r(t);
894
- n.u[n.o + 3] >= 1073741824 ? n.f[n.o + 2] !== 0 && (l = e) : d(n);
895
- }
896
- if (l === -Infinity) return null;
897
- (t > 0 ? s : o)[e] = t > 0 ? l : -l;
898
- }
899
- return {
900
- min: o,
901
- max: s
902
- };
903
- }
904
- setLightGuiding(e) {
905
- this._lightGuiding = e !== !1, this.uniforms.guide.value = 0, this.pt.reset();
906
- }
907
- _updateLightGuide() {
908
- let e = this.uniforms, t = this.pt._kernelManager;
909
- e.guideLearning.value = +!!this._lightGuiding;
910
- let n = this.pt.frameCount;
911
- if (n === 0) {
912
- t.dispatch("guideClear"), e.guide.value = 0;
913
- return;
914
- }
915
- if (!this._lightGuiding || !(n <= 32 ? !(n & n - 1) : n % 32 == 0)) return;
916
- t.dispatch("guideBuild");
917
- let r = this.pt.renderer.backend;
918
- this.pt.renderer.initTexture(this._guideTexture);
919
- let i = r.device.createCommandEncoder({ label: "LightGuide" });
920
- i.copyBufferToTexture({
921
- buffer: r.get(this._guideBuildAttr).buffer,
922
- bytesPerRow: mn * 4,
923
- rowsPerImage: 16
924
- }, { texture: r.get(this._guideTexture).texture }, [pn, 16]), r.device.queue.submit([i.finish()]), e.guide.value = 1;
925
- }
926
- _disposeLightGuide() {
927
- g(this.pt.renderer, this._guideBuildAttr), this._guideTexture?.dispose(), this._guideTexture = this._guideBuildAttr = null, this.uniforms.guideTexture = null;
928
- }
929
- _nextPassTag() {
930
- return this._passTag = this._passTag + 1 & 2147483647, (Bn | this._passTag) >>> 0;
931
- }
932
- _traceLightPaths(e) {
933
- let t = this.pt._kernelManager, n = this.uniforms.lightPaths.value;
934
- this.pt._wfChunkRowBase.value = 0, this.pt._wfMaxRayCount.value = n, t.setDispatchForCount("lightGenerate", n), t.dispatch("lightGenerate");
935
- let r = this.pt._useDynamicDispatch, i = this._lastLightCurveKey === this._lightCurveKey, a = i ? this._lastLightBounceCounts : null, o = i ? this._lastLightBounceEnergy : null, s = this.pt._bounceEarlyExitThreshold >= 0 ? this.pt._bounceEarlyExitThreshold * n * 64 : -1;
936
- for (let i = 0; i <= e; i++) {
937
- this.pt._wfCurrentBounce.value = i;
938
- let c = i > 0 ? a?.[i - 1] : void 0, l = r && c > 0 ? Math.min(n, Math.ceil(c * 1.5) + 1024) : n;
939
- for (let e of Be) t.setDispatchForCount(e, l);
940
- if (r || t.dispatch("enterFull"), t.dispatch("extend"), this.pt._sortMaterials && (t.dispatch("resetGlobalHist"), t.dispatch("globalHist"), t.dispatch("globalPrefix"), t.dispatch("globalScatter")), t.dispatch("shade"), t.dispatch("compact"), t.dispatch(r ? "lightCopyback" : "lightSnapshot"), s >= 0 && i < e && o?.[i] !== void 0 && o[i] <= s) break;
941
- }
942
- this.uniforms.lightTrace.value > 0 && (t.setDispatchForCount("lightSplat", n * this.uniforms.slotsPerPath.value), t.dispatch("lightSplat")), this.merging && (t.dispatch("mergeClear"), t.setDispatchForCount("mergeInsert", n * this.uniforms.slotsPerPath.value), t.dispatch("mergeInsert"));
943
- }
944
- };
945
- //#endregion
946
- export { wt as n, Qn as t };