@takram/three-clouds 0.2.2 → 0.4.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 (43) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +25 -17
  3. package/build/index.cjs +9 -9
  4. package/build/index.cjs.map +1 -1
  5. package/build/index.js +70 -77
  6. package/build/index.js.map +1 -1
  7. package/build/r3f.cjs +1 -1
  8. package/build/r3f.cjs.map +1 -1
  9. package/build/r3f.js +180 -186
  10. package/build/r3f.js.map +1 -1
  11. package/build/shared.cjs +102 -74
  12. package/build/shared.cjs.map +1 -1
  13. package/build/shared.js +443 -380
  14. package/build/shared.js.map +1 -1
  15. package/package.json +3 -3
  16. package/src/CloudLayers.ts +2 -2
  17. package/src/CloudsEffect.ts +52 -29
  18. package/src/CloudsMaterial.ts +53 -30
  19. package/src/CloudsPass.ts +5 -6
  20. package/src/PassBase.ts +1 -1
  21. package/src/Procedural3DTexture.ts +2 -4
  22. package/src/ProceduralTexture.ts +1 -3
  23. package/src/ShaderArrayPass.ts +5 -5
  24. package/src/ShadowMaterial.ts +4 -4
  25. package/src/ShadowPass.ts +5 -6
  26. package/src/constants.ts +1 -0
  27. package/src/helpers/setArrayRenderTargetLayers.ts +3 -6
  28. package/src/qualityPresets.ts +5 -5
  29. package/src/r3f/CloudLayer.tsx +65 -63
  30. package/src/r3f/Clouds.tsx +170 -188
  31. package/src/shaders/clouds.frag +64 -50
  32. package/src/shaders/clouds.glsl +1 -1
  33. package/src/shaders/clouds.vert +18 -5
  34. package/src/shaders/parameters.glsl +3 -2
  35. package/src/shaders/shadowResolve.frag +2 -2
  36. package/src/shaders/types.glsl +1 -1
  37. package/src/shaders/varianceClipping.glsl +2 -2
  38. package/src/uniforms.ts +3 -3
  39. package/types/CloudsEffect.d.ts +19 -9
  40. package/types/CloudsMaterial.d.ts +10 -5
  41. package/types/qualityPresets.d.ts +1 -1
  42. package/types/r3f/CloudLayer.d.ts +3 -1
  43. package/types/r3f/Clouds.d.ts +2 -1
package/build/shared.js CHANGED
@@ -1,10 +1,10 @@
1
- import { Pass as He, ShaderPass as Z, Resolution as q, Effect as Fe, EffectAttribute as ze } from "postprocessing";
2
- import { Vector3 as f, Vector2 as m, Matrix4 as v, Object3D as se, Box3 as We, Uniform as r, GLSL3 as W, Vector4 as x, RawShaderMaterial as X, Camera as xe, WebGLRenderTarget as Ge, HalfFloatType as we, LinearFilter as z, RedFormat as Be, WebGLArrayRenderTarget as Ve, EventDispatcher as ke, Texture as ce, Data3DTexture as le } from "three";
3
- import { AtmosphereMaterialBase as je, AtmosphereParameters as Ce, getAltitudeCorrectionOffset as Ye } from "@takram/three-atmosphere";
4
- import { lerp as Te, defineInt as O, defineExpression as De, define as C, defineFloat as J, unrollLoops as G, resolveIncludes as M, assertType as Ze, Geodetic as qe, definePropertyShorthand as he, defineUniformShorthand as ue } from "@takram/three-geospatial";
5
- import { functions as de, parameters as pe } from "@takram/three-atmosphere/shaders";
6
- import { vogelDisk as Ke, interleavedGradientNoise as $e, cascadedShadowMaps as Xe, raySphereIntersection as Ee, generators as Je, turbo as Ae, math as _e, depth as Qe } from "@takram/three-geospatial/shaders";
7
- class B {
1
+ import { Pass as ze, ShaderPass as Z, Resolution as K, Effect as Fe, EffectAttribute as We } from "postprocessing";
2
+ import { Vector3 as f, Vector2 as m, Matrix4 as v, Object3D as se, Box3 as Be, Uniform as r, GLSL3 as W, Vector4 as x, RawShaderMaterial as X, Camera as we, WebGLRenderTarget as Ge, HalfFloatType as Ce, LinearFilter as F, RedFormat as Ve, WebGLArrayRenderTarget as ke, EventDispatcher as je, Texture as ce, Data3DTexture as le } from "three";
3
+ import { AtmosphereMaterialBase as Ye, AtmosphereParameters as Te, getAltitudeCorrectionOffset as Ze } from "@takram/three-atmosphere";
4
+ import { lerp as De, defineInt as P, defineExpression as Ee, define as C, defineFloat as J, unrollLoops as B, resolveIncludes as U, assertType as Ke, Geodetic as qe, definePropertyShorthand as ue, defineUniformShorthand as he } from "@takram/three-geospatial";
5
+ import { runtime as de, definitions as pe, common as fe } from "@takram/three-atmosphere/shaders/bruneton";
6
+ import { vogelDisk as $e, interleavedGradientNoise as Xe, cascadedShadowMaps as Je, raySphereIntersection as Ae, generators as Qe, turbo as _e, math as Oe, depth as et } from "@takram/three-geospatial/shaders";
7
+ class G {
8
8
  constructor(e = 0, t = 0, n = 0, a = 0) {
9
9
  this.expTerm = e, this.exponent = t, this.linearTerm = n, this.constantTerm = a;
10
10
  }
@@ -12,7 +12,7 @@ class B {
12
12
  return this.expTerm = e, this.exponent = t, this.linearTerm = n, this.constantTerm = a, this;
13
13
  }
14
14
  clone() {
15
- return new B(
15
+ return new G(
16
16
  this.expTerm,
17
17
  this.exponent,
18
18
  this.linearTerm,
@@ -23,7 +23,7 @@ class B {
23
23
  return this.expTerm = e.expTerm, this.exponent = e.exponent, this.linearTerm = e.linearTerm, this.constantTerm = e.constantTerm, this;
24
24
  }
25
25
  }
26
- const et = [
26
+ const tt = [
27
27
  "channel",
28
28
  "altitude",
29
29
  "height",
@@ -36,19 +36,19 @@ const et = [
36
36
  "shadow",
37
37
  "densityProfile"
38
38
  ];
39
- function tt(o, e) {
39
+ function nt(o, e) {
40
40
  if (e != null)
41
- for (const t of et) {
41
+ for (const t of tt) {
42
42
  const n = e[t];
43
- n != null && (o[t] instanceof B ? o[t].copy(n) : o[t] = n);
43
+ n != null && (o[t] instanceof G ? o[t].copy(n) : o[t] = n);
44
44
  }
45
45
  }
46
46
  const N = class N {
47
47
  constructor(e) {
48
- this.channel = "r", this.altitude = 0, this.height = 0, this.densityScale = 0.2, this.shapeAmount = 1, this.shapeDetailAmount = 1, this.weatherExponent = 1, this.shapeAlteringBias = 0.35, this.coverageFilterWidth = 0.6, this.densityProfile = new B(0, 0, 0.75, 0.25), this.shadow = !1, this.set(e);
48
+ this.channel = "r", this.altitude = 0, this.height = 0, this.densityScale = 0.2, this.shapeAmount = 1, this.shapeDetailAmount = 1, this.weatherExponent = 1, this.shapeAlteringBias = 0.35, this.coverageFilterWidth = 0.6, this.densityProfile = new G(0, 0, 0.75, 0.25), this.shadow = !1, this.set(e);
49
49
  }
50
50
  set(e) {
51
- return tt(this, e), this;
51
+ return nt(this, e), this;
52
52
  }
53
53
  clone() {
54
54
  return new N(this);
@@ -59,17 +59,17 @@ const N = class N {
59
59
  };
60
60
  N.DEFAULT = /* @__PURE__ */ new N();
61
61
  let T = N;
62
- const P = /* @__PURE__ */ Array.from(
62
+ const O = /* @__PURE__ */ Array.from(
63
63
  { length: 8 },
64
64
  () => ({ value: 0, flag: 0 })
65
65
  ), L = /* @__PURE__ */ Array.from(
66
66
  { length: 3 },
67
67
  () => ({ min: 0, max: 0 })
68
68
  );
69
- function nt(o, e) {
69
+ function at(o, e) {
70
70
  return o.value !== e.value ? o.value - e.value : o.flag - e.flag;
71
71
  }
72
- const b = class b extends Array {
72
+ const M = class M extends Array {
73
73
  constructor(e) {
74
74
  super(
75
75
  new T(e == null ? void 0 : e[0]),
@@ -85,7 +85,7 @@ const b = class b extends Array {
85
85
  return this[0].copy(T.DEFAULT), this[1].copy(T.DEFAULT), this[2].copy(T.DEFAULT), this[3].copy(T.DEFAULT), this;
86
86
  }
87
87
  clone() {
88
- return new b(this);
88
+ return new M(this);
89
89
  }
90
90
  copy(e) {
91
91
  return this[0].copy(e[0]), this[1].copy(e[1]), this[2].copy(e[2]), this[3].copy(e[3]), this;
@@ -115,19 +115,19 @@ const b = class b extends Array {
115
115
  // Redundant, but need to avoid creating garbage here as this runs every frame.
116
116
  packIntervalHeights(e, t) {
117
117
  for (let s = 0; s < 4; ++s) {
118
- const c = this[s];
119
- let h = P[s];
120
- h.value = c.altitude, h.flag = 0, h = P[s + 4], h.value = c.altitude + c.height, h.flag = 1;
118
+ const l = this[s];
119
+ let u = O[s];
120
+ u.value = l.altitude, u.flag = 0, u = O[s + 4], u.value = l.altitude + l.height, u.flag = 1;
121
121
  }
122
- P.sort(nt);
122
+ O.sort(at);
123
123
  let n = 0, a = 0;
124
- for (let s = 0; s < P.length; ++s) {
125
- const { value: c, flag: h } = P[s];
124
+ for (let s = 0; s < O.length; ++s) {
125
+ const { value: l, flag: u } = O[s];
126
126
  if (a === 0 && s > 0) {
127
- const u = L[n++];
128
- u.min = P[s - 1].value, u.max = c;
127
+ const h = L[n++];
128
+ h.min = O[s - 1].value, h.max = l;
129
129
  }
130
- a += h === 0 ? 1 : -1;
130
+ a += u === 0 ? 1 : -1;
131
131
  }
132
132
  for (; n < 3; ++n) {
133
133
  const s = L[n];
@@ -137,7 +137,7 @@ const b = class b extends Array {
137
137
  e.x = i.min, t.x = i.max, i = L[1], e.y = i.min, t.y = i.max, i = L[2], e.z = i.min, t.z = i.max;
138
138
  }
139
139
  };
140
- b.DEFAULT = /* @__PURE__ */ new b([
140
+ M.DEFAULT = /* @__PURE__ */ new M([
141
141
  {
142
142
  channel: "r",
143
143
  altitude: 750,
@@ -175,22 +175,22 @@ b.DEFAULT = /* @__PURE__ */ new b([
175
175
  },
176
176
  { channel: "a" }
177
177
  ]);
178
- let K = b;
179
- var at = "production" === "production", fe = "Invariant failed";
178
+ let q = M;
179
+ var it = "production" === "production", me = "Invariant failed";
180
180
  function A(o, e) {
181
181
  if (!o) {
182
- if (at)
183
- throw new Error(fe);
184
- var t = fe;
182
+ if (it)
183
+ throw new Error(me);
184
+ var t = me;
185
185
  throw new Error(t);
186
186
  }
187
187
  }
188
- class U {
188
+ class b {
189
189
  constructor(e, t) {
190
190
  this.near = [new f(), new f(), new f(), new f()], this.far = [new f(), new f(), new f(), new f()], e != null && t != null && this.setFromCamera(e, t);
191
191
  }
192
192
  clone() {
193
- return new U().copy(this);
193
+ return new b().copy(this);
194
194
  }
195
195
  copy(e) {
196
196
  for (let t = 0; t < 4; ++t)
@@ -206,14 +206,14 @@ class U {
206
206
  for (let i = 0; i < 4; ++i) {
207
207
  const s = this.far[i];
208
208
  s.applyMatrix4(a);
209
- const c = Math.abs(s.z);
210
- n ? s.z *= Math.min(t / c, 1) : s.multiplyScalar(Math.min(t / c, 1));
209
+ const l = Math.abs(s.z);
210
+ n ? s.z *= Math.min(t / l, 1) : s.multiplyScalar(Math.min(t / l, 1));
211
211
  }
212
212
  return this;
213
213
  }
214
214
  split(e, t = []) {
215
215
  for (let n = 0; n < e.length; ++n) {
216
- const a = t[n] ?? (t[n] = new U());
216
+ const a = t[n] ?? (t[n] = new b());
217
217
  if (n === 0)
218
218
  for (let i = 0; i < 4; ++i)
219
219
  a.near[i].copy(this.near[i]);
@@ -243,7 +243,7 @@ class U {
243
243
  return this;
244
244
  }
245
245
  }
246
- const it = {
246
+ const rt = {
247
247
  uniform: (o, e, t, n, a = []) => {
248
248
  for (let i = 0; i < o; ++i)
249
249
  a[i] = (e + (t - e) * (i + 1) / o) / t;
@@ -256,16 +256,16 @@ const it = {
256
256
  },
257
257
  practical: (o, e, t, n = 0.5, a = []) => {
258
258
  for (let i = 0; i < o; ++i) {
259
- const s = (e + (t - e) * (i + 1) / o) / t, c = e * (t / e) ** ((i + 1) / o) / t;
260
- a[i] = Te(s, c, n);
259
+ const s = (e + (t - e) * (i + 1) / o) / t, l = e * (t / e) ** ((i + 1) / o) / t;
260
+ a[i] = De(s, l, n);
261
261
  }
262
262
  return a.length = o, a;
263
263
  }
264
264
  };
265
- function rt(o, e, t, n, a, i = []) {
266
- return it[o](e, t, n, a, i);
265
+ function ot(o, e, t, n, a, i = []) {
266
+ return rt[o](e, t, n, a, i);
267
267
  }
268
- const me = /* @__PURE__ */ new f(), ve = /* @__PURE__ */ new f(), ot = /* @__PURE__ */ new v(), ge = /* @__PURE__ */ new v(), st = /* @__PURE__ */ new U(), ct = /* @__PURE__ */ new We(), lt = {
268
+ const ve = /* @__PURE__ */ new f(), ge = /* @__PURE__ */ new f(), st = /* @__PURE__ */ new v(), Se = /* @__PURE__ */ new v(), ct = /* @__PURE__ */ new b(), lt = /* @__PURE__ */ new Be(), ut = {
269
269
  maxFar: null,
270
270
  farScale: 1,
271
271
  splitMode: "practical",
@@ -275,21 +275,21 @@ const me = /* @__PURE__ */ new f(), ve = /* @__PURE__ */ new f(), ot = /* @__PUR
275
275
  };
276
276
  class ht {
277
277
  constructor(e) {
278
- this.cascades = [], this.mapSize = new m(), this.cameraFrustum = new U(), this.frusta = [], this.splits = [], this._far = 0;
278
+ this.cascades = [], this.mapSize = new m(), this.cameraFrustum = new b(), this.frusta = [], this.splits = [], this._far = 0;
279
279
  const {
280
280
  cascadeCount: t,
281
281
  mapSize: n,
282
282
  maxFar: a,
283
283
  farScale: i,
284
284
  splitMode: s,
285
- splitLambda: c,
286
- margin: h,
287
- fade: u
285
+ splitLambda: l,
286
+ margin: u,
287
+ fade: h
288
288
  } = {
289
- ...lt,
289
+ ...ut,
290
290
  ...e
291
291
  };
292
- this.cascadeCount = t, this.mapSize.copy(n), this.maxFar = a, this.farScale = i, this.splitMode = s, this.splitLambda = c, this.margin = h, this.fade = u;
292
+ this.cascadeCount = t, this.mapSize.copy(n), this.maxFar = a, this.farScale = i, this.splitMode = s, this.splitLambda = l, this.margin = u, this.fade = h;
293
293
  }
294
294
  get cascadeCount() {
295
295
  return this.cascades.length;
@@ -315,7 +315,7 @@ class ht {
315
315
  }
316
316
  updateIntervals(e) {
317
317
  const t = this.cascadeCount, n = this.splits, a = this.far;
318
- rt(
318
+ ot(
319
319
  this.splitMode,
320
320
  t,
321
321
  e.near,
@@ -334,24 +334,24 @@ class ht {
334
334
  a[0].distanceTo(n[2])
335
335
  );
336
336
  if (this.fade) {
337
- const s = e.near, c = this.far, h = a[0].z / (c - s);
338
- i += 0.25 * h ** 2 * (c - s);
337
+ const s = e.near, l = this.far, u = a[0].z / (l - s);
338
+ i += 0.25 * u ** 2 * (l - s);
339
339
  }
340
340
  return i * 0.5;
341
341
  }
342
342
  updateMatrices(e, t, n = 1) {
343
- const a = ot.lookAt(
344
- me.setScalar(0),
345
- ve.copy(t).multiplyScalar(-1),
343
+ const a = st.lookAt(
344
+ ve.setScalar(0),
345
+ ge.copy(t).multiplyScalar(-1),
346
346
  se.DEFAULT_UP
347
- ), i = ge.multiplyMatrices(
348
- ge.copy(a).invert(),
347
+ ), i = Se.multiplyMatrices(
348
+ Se.copy(a).invert(),
349
349
  e.matrixWorld
350
- ), s = this.frusta, c = this.cascades;
351
- A(s.length === c.length);
352
- const h = this.margin, u = this.mapSize;
350
+ ), s = this.frusta, l = this.cascades;
351
+ A(s.length === l.length);
352
+ const u = this.margin, h = this.mapSize;
353
353
  for (let d = 0; d < s.length; ++d) {
354
- const p = s[d], g = c[d], S = this.getFrustumRadius(e, s[d]), ee = -S, te = S, ne = S, ae = -S;
354
+ const p = s[d], g = l[d], S = this.getFrustumRadius(e, s[d]), ee = -S, te = S, ne = S, ae = -S;
355
355
  g.projectionMatrix.makeOrthographic(
356
356
  ee,
357
357
  te,
@@ -362,14 +362,14 @@ class ht {
362
362
  S * 2 + this.margin
363
363
  // far
364
364
  );
365
- const { near: Me, far: Ue } = st.copy(p).applyMatrix4(i), H = ct.makeEmpty();
366
- for (let F = 0; F < 4; F++)
367
- H.expandByPoint(Me[F]), H.expandByPoint(Ue[F]);
368
- const E = H.getCenter(me);
369
- E.z = H.max.z + h;
370
- const ie = (te - ee) / u.width, re = (ne - ae) / u.height;
365
+ const { near: be, far: He } = ct.copy(p).applyMatrix4(i), H = lt.makeEmpty();
366
+ for (let z = 0; z < 4; z++)
367
+ H.expandByPoint(be[z]), H.expandByPoint(He[z]);
368
+ const E = H.getCenter(ve);
369
+ E.z = H.max.z + u;
370
+ const ie = (te - ee) / h.width, re = (ne - ae) / h.height;
371
371
  E.x = Math.round(E.x / ie) * ie, E.y = Math.round(E.y / re) * re, E.applyMatrix4(a);
372
- const oe = ve.copy(t).multiplyScalar(n).add(E);
372
+ const oe = ge.copy(t).multiplyScalar(n).add(E);
373
373
  g.inverseViewMatrix.lookAt(E, oe, se.DEFAULT_UP).setPosition(oe);
374
374
  }
375
375
  }
@@ -378,18 +378,18 @@ class ht {
378
378
  const a = this.cascades, i = this.cascadeCount;
379
379
  for (let s = 0; s < i; ++s) {
380
380
  const {
381
- matrix: c,
382
- inverseMatrix: h,
383
- projectionMatrix: u,
381
+ matrix: l,
382
+ inverseMatrix: u,
383
+ projectionMatrix: h,
384
384
  inverseProjectionMatrix: d,
385
385
  viewMatrix: p,
386
386
  inverseViewMatrix: g
387
387
  } = a[s];
388
- d.copy(u).invert(), p.copy(g).invert(), c.copy(u).multiply(p), h.copy(g).multiply(d);
388
+ d.copy(h).invert(), p.copy(g).invert(), l.copy(h).multiply(p), u.copy(g).multiply(d);
389
389
  }
390
390
  }
391
391
  }
392
- const Se = [
392
+ const ye = [
393
393
  0,
394
394
  8,
395
395
  2,
@@ -406,18 +406,18 @@ const Se = [
406
406
  7,
407
407
  13,
408
408
  5
409
- ], Pe = /* @__PURE__ */ Se.reduce(
409
+ ], Pe = /* @__PURE__ */ ye.reduce(
410
410
  (o, e, t) => {
411
411
  const n = new m();
412
412
  for (let a = 0; a < 16; ++a)
413
- if (Se[a] === t) {
413
+ if (ye[a] === t) {
414
414
  n.set((a % 4 + 0.5) / 4, (Math.floor(a / 4) + 0.5) / 4);
415
415
  break;
416
416
  }
417
417
  return [...o, n];
418
418
  },
419
419
  []
420
- ), ut = {
420
+ ), dt = {
421
421
  resolutionScale: 1,
422
422
  lightShafts: !0,
423
423
  shapeDetail: !0,
@@ -425,7 +425,7 @@ const Se = [
425
425
  haze: !0,
426
426
  clouds: {
427
427
  multiScatteringOctaves: 8,
428
- accurateSunSkyIrradiance: !0,
428
+ accurateSunSkyLight: !0,
429
429
  accuratePhaseFunction: !1,
430
430
  // Primary raymarch
431
431
  maxIterationCount: 500,
@@ -457,12 +457,12 @@ const Se = [
457
457
  minExtinction: 1e-5,
458
458
  minTransmittance: 1e-4
459
459
  }
460
- }, l = ut, dt = {
460
+ }, c = dt, pt = {
461
461
  // TODO: We cloud decrease multi-scattering octaves for lower quality presets,
462
462
  // but it leads to a loss of higher frequency scattering, making it darker
463
463
  // overall, which suggests the need for a fudge factor to scale the radiance.
464
464
  low: {
465
- ...l,
465
+ ...c,
466
466
  lightShafts: !1,
467
467
  // Expensive
468
468
  shapeDetail: !1,
@@ -470,8 +470,8 @@ const Se = [
470
470
  turbulence: !1,
471
471
  // Expensive
472
472
  clouds: {
473
- ...l.clouds,
474
- accurateSunSkyIrradiance: !1,
473
+ ...c.clouds,
474
+ accurateSunSkyLight: !1,
475
475
  // Greatly reduces texel reads.
476
476
  maxIterationCount: 200,
477
477
  minStepSize: 100,
@@ -486,7 +486,7 @@ const Se = [
486
486
  // Only 1 march makes big difference
487
487
  },
488
488
  shadow: {
489
- ...l.shadow,
489
+ ...c.shadow,
490
490
  maxIterationCount: 25,
491
491
  minDensity: 1e-4,
492
492
  minExtinction: 1e-4,
@@ -499,40 +499,40 @@ const Se = [
499
499
  }
500
500
  },
501
501
  medium: {
502
- ...l,
502
+ ...c,
503
503
  lightShafts: !1,
504
504
  // Expensive
505
505
  turbulence: !1,
506
506
  // Expensive
507
507
  clouds: {
508
- ...l.clouds,
508
+ ...c.clouds,
509
509
  minDensity: 1e-4,
510
510
  minExtinction: 1e-4,
511
- accurateSunSkyIrradiance: !1,
511
+ accurateSunSkyLight: !1,
512
512
  maxIterationCountToSun: 2,
513
513
  maxIterationCountToGround: 1
514
514
  },
515
515
  shadow: {
516
- ...l.shadow,
516
+ ...c.shadow,
517
517
  minDensity: 1e-4,
518
518
  minExtinction: 1e-4,
519
519
  mapSize: /* @__PURE__ */ new m(256, 256)
520
520
  }
521
521
  },
522
- high: l,
522
+ high: c,
523
523
  // Consider high quality preset as default.
524
524
  ultra: {
525
- ...l,
525
+ ...c,
526
526
  clouds: {
527
- ...l.clouds,
527
+ ...c.clouds,
528
528
  minStepSize: 10
529
529
  },
530
530
  shadow: {
531
- ...l.shadow,
531
+ ...c.shadow,
532
532
  mapSize: /* @__PURE__ */ new m(1024, 1024)
533
533
  }
534
534
  }
535
- }, pt = `precision highp float;
535
+ }, ft = `precision highp float;
536
536
  precision highp sampler3D;
537
537
  precision highp sampler2DArray;
538
538
 
@@ -547,14 +547,28 @@ precision highp sampler2DArray;
547
547
  #include "core/cascadedShadowMaps"
548
548
  #include "core/interleavedGradientNoise"
549
549
  #include "core/vogelDisk"
550
- #include "atmosphere/parameters"
551
- #include "atmosphere/functions"
550
+
551
+ #include "atmosphere/bruneton/definitions"
552
+
553
+ uniform AtmosphereParameters ATMOSPHERE;
554
+ uniform vec3 SUN_SPECTRAL_RADIANCE_TO_LUMINANCE;
555
+ uniform vec3 SKY_SPECTRAL_RADIANCE_TO_LUMINANCE;
556
+
557
+ uniform sampler2D transmittance_texture;
558
+ uniform sampler3D scattering_texture;
559
+ uniform sampler2D irradiance_texture;
560
+ uniform sampler3D single_mie_scattering_texture;
561
+ uniform sampler3D higher_order_scattering_texture;
562
+
563
+ #include "atmosphere/bruneton/common"
564
+ #include "atmosphere/bruneton/runtime"
565
+
552
566
  #include "types"
553
567
  #include "parameters"
554
568
  #include "clouds"
555
569
 
556
570
  #if !defined(RECIPROCAL_PI4)
557
- #define RECIPROCAL_PI4 (0.07957747154594767)
571
+ #define RECIPROCAL_PI4 0.07957747154594767
558
572
  #endif // !defined(RECIPROCAL_PI4)
559
573
 
560
574
  uniform sampler2D depthBuffer;
@@ -570,8 +584,8 @@ uniform float mipLevelScale;
570
584
  // Scattering
571
585
  const vec2 scatterAnisotropy = vec2(SCATTER_ANISOTROPY_1, SCATTER_ANISOTROPY_2);
572
586
  const float scatterAnisotropyMix = SCATTER_ANISOTROPY_MIX;
573
- uniform float skyIrradianceScale;
574
- uniform float groundIrradianceScale;
587
+ uniform float skyLightScale;
588
+ uniform float groundBounceScale;
575
589
  uniform float powderScale;
576
590
  uniform float powderExponent;
577
591
 
@@ -800,7 +814,7 @@ vec4 getCascadedShadowMaps(vec2 uv) {
800
814
  }
801
815
 
802
816
  #if !defined(DEBUG_SHOW_SHADOW_MAP_TYPE)
803
- #define DEBUG_SHOW_SHADOW_MAP_TYPE (0)
817
+ #define DEBUG_SHOW_SHADOW_MAP_TYPE 0
804
818
  #endif // !defined(DEBUG_SHOW_SHADOW_MAP_TYPE
805
819
 
806
820
  const float frontDepthScale = 1e-5;
@@ -949,30 +963,31 @@ vec3 getGroundSunSkyIrradiance(
949
963
  const float height,
950
964
  out vec3 skyIrradiance
951
965
  ) {
952
- #ifdef ACCURATE_SUN_SKY_IRRADIANCE
966
+ #ifdef ACCURATE_SUN_SKY_LIGHT
953
967
  return GetSunAndSkyIrradiance(
954
968
  (position - surfaceNormal * height) * METER_TO_LENGTH_UNIT,
969
+ surfaceNormal,
955
970
  sunDirection,
956
971
  skyIrradiance
957
972
  );
958
- #else // ACCURATE_SUN_SKY_IRRADIANCE
973
+ #else // ACCURATE_SUN_SKY_LIGHT
959
974
  skyIrradiance = vGroundIrradiance.sky;
960
975
  return vGroundIrradiance.sun;
961
- #endif // ACCURATE_SUN_SKY_IRRADIANCE
976
+ #endif // ACCURATE_SUN_SKY_LIGHT
962
977
  }
963
978
 
964
979
  vec3 getCloudsSunSkyIrradiance(const vec3 position, const float height, out vec3 skyIrradiance) {
965
- #ifdef ACCURATE_SUN_SKY_IRRADIANCE
966
- return GetSunAndSkyIrradiance(position * METER_TO_LENGTH_UNIT, sunDirection, skyIrradiance);
967
- #else // ACCURATE_SUN_SKY_IRRADIANCE
980
+ #ifdef ACCURATE_SUN_SKY_LIGHT
981
+ return GetSunAndSkyScalarIrradiance(position * METER_TO_LENGTH_UNIT, sunDirection, skyIrradiance);
982
+ #else // ACCURATE_SUN_SKY_LIGHT
968
983
  float alpha = remapClamped(height, minHeight, maxHeight);
969
984
  skyIrradiance = mix(vCloudsIrradiance.minSky, vCloudsIrradiance.maxSky, alpha);
970
985
  return mix(vCloudsIrradiance.minSun, vCloudsIrradiance.maxSun, alpha);
971
- #endif // ACCURATE_SUN_SKY_IRRADIANCE
986
+ #endif // ACCURATE_SUN_SKY_LIGHT
972
987
  }
973
988
 
974
- #ifdef GROUND_IRRADIANCE
975
- vec3 approximateIrradianceFromGround(
989
+ #ifdef GROUND_BOUNCE
990
+ vec3 approximateRadianceFromGround(
976
991
  const vec3 position,
977
992
  const vec3 surfaceNormal,
978
993
  const float height,
@@ -989,12 +1004,11 @@ vec3 approximateIrradianceFromGround(
989
1004
  vec3 skyIrradiance;
990
1005
  vec3 sunIrradiance = getGroundSunSkyIrradiance(position, surfaceNormal, height, skyIrradiance);
991
1006
  const float groundAlbedo = 0.3;
992
- vec3 groundIrradiance = skyIrradiance + (1.0 - coverage) * sunIrradiance * RECIPROCAL_PI2;
993
- vec3 bouncedLight = groundAlbedo * RECIPROCAL_PI * groundIrradiance;
994
- vec3 bouncedIrradiance = bouncedLight * exp(-opticalDepthToGround);
995
- return albedo * bouncedIrradiance * RECIPROCAL_PI4 * groundIrradianceScale;
1007
+ vec3 groundIrradiance = skyIrradiance + (1.0 - coverage) * sunIrradiance;
1008
+ vec3 bouncedRadiance = groundAlbedo * RECIPROCAL_PI * groundIrradiance;
1009
+ return bouncedRadiance * exp(-opticalDepthToGround);
996
1010
  }
997
- #endif // GROUND_IRRADIANCE
1011
+ #endif // GROUND_BOUNCE
998
1012
 
999
1013
  vec4 marchClouds(
1000
1014
  const vec3 rayOrigin,
@@ -1082,28 +1096,28 @@ vec4 marchClouds(
1082
1096
  );
1083
1097
  }
1084
1098
 
1085
- float scattering = approximateMultipleScattering(opticalDepth, cosTheta);
1086
- vec3 radiance = albedo * sunIrradiance * scattering;
1099
+ vec3 radiance = sunIrradiance * approximateMultipleScattering(opticalDepth, cosTheta);
1087
1100
 
1088
- #ifdef GROUND_IRRADIANCE
1101
+ #ifdef GROUND_BOUNCE
1089
1102
  // Fudge factor for the irradiance from ground.
1090
1103
  if (height < shadowTopHeight && mipLevel < 0.5) {
1091
- radiance += approximateIrradianceFromGround(
1104
+ vec3 groundRadiance = approximateRadianceFromGround(
1092
1105
  position,
1093
1106
  surfaceNormal,
1094
1107
  height,
1095
1108
  mipLevel,
1096
1109
  jitter
1097
1110
  );
1111
+ radiance += groundRadiance * RECIPROCAL_PI4 * groundBounceScale;
1098
1112
  }
1099
- #endif // GROUND_IRRADIANCE
1113
+ #endif // GROUND_BOUNCE
1100
1114
 
1101
1115
  // Crude approximation of sky gradient. Better than none in the shadows.
1102
- float skyGradient = dot(0.5 + weather.heightFraction, media.weight);
1103
- radiance += albedo * skyIrradiance * RECIPROCAL_PI4 * skyGradient * skyIrradianceScale;
1116
+ float skyGradient = dot(weather.heightFraction * 0.5 + 0.5, media.weight);
1117
+ radiance += skyIrradiance * RECIPROCAL_PI4 * skyGradient * skyLightScale;
1104
1118
 
1105
- // Finally multiply by extinction (redundant but kept for clarity).
1106
- radiance *= media.extinction;
1119
+ // Finally multiply by scattering.
1120
+ radiance *= media.scattering;
1107
1121
 
1108
1122
  #ifdef POWDER
1109
1123
  radiance *= 1.0 - powderScale * exp(-media.extinction * powderExponent);
@@ -1156,7 +1170,7 @@ float marchShadowLength(
1156
1170
  float maxRayDistance = rayNearFar.y - rayNearFar.x;
1157
1171
  float stepSize = minShadowLengthStepSize;
1158
1172
  float rayDistance = stepSize * jitter;
1159
- const float attenuationFactor = 1.0 - 1e-3;
1173
+ const float attenuationFactor = 1.0 - 5e-4;
1160
1174
  float attenuation = 1.0;
1161
1175
 
1162
1176
  // TODO: This march is closed, and sample resolution can be much lower.
@@ -1168,14 +1182,6 @@ float marchShadowLength(
1168
1182
  vec3 position = rayDistance * rayDirection + rayOrigin;
1169
1183
  float opticalDepth = sampleShadowOpticalDepth(position, 0.0, 0.0, jitter);
1170
1184
  shadowLength += (1.0 - exp(-opticalDepth)) * stepSize * attenuation;
1171
-
1172
- // Hack to prevent over-integration of shadow length. The shadow should be
1173
- // attenuated by the inscatter as the ray travels further.
1174
- attenuation *= attenuationFactor;
1175
- if (attenuation < 1e-5) {
1176
- break;
1177
- }
1178
-
1179
1185
  stepSize *= perspectiveStepScale;
1180
1186
  rayDistance += stepSize;
1181
1187
  }
@@ -1202,25 +1208,33 @@ vec4 approximateHaze(
1202
1208
  return vec4(0.0); // Prevent artifact in views from space
1203
1209
  }
1204
1210
 
1211
+ // Blend two normals by the difference in angle so that normal near the
1212
+ // ground becomes that of the origin, and in the sky that of the horizon.
1213
+ vec3 normalAtOrigin = normalize(rayOrigin);
1214
+ vec3 normalAtHorizon = (rayOrigin - dot(rayOrigin, rayDirection) * rayDirection) / bottomRadius;
1215
+ float alpha = remapClamped(dot(normalAtOrigin, normalAtHorizon), 0.9, 1.0);
1216
+ vec3 normal = mix(normalAtOrigin, normalAtHorizon, alpha);
1217
+
1205
1218
  // Analytical optical depth where density exponentially decreases with height.
1206
1219
  // Based on: https://iquilezles.org/articles/fog/
1207
- float angle = max(dot(normalize(rayOrigin), rayDirection), 1e-5);
1220
+ float angle = max(dot(normal, rayDirection), 1e-5);
1208
1221
  float exponent = angle * hazeExponent;
1222
+ float linearTerm = density / hazeExponent / angle;
1223
+
1209
1224
  // Derive the optical depths separately for with and without shadow length.
1210
1225
  float expTerm = 1.0 - exp(-maxRayDistance * exponent);
1211
1226
  float shadowExpTerm = 1.0 - exp(-min(maxRayDistance, shadowLength) * exponent);
1212
- float linearTerm = density / hazeExponent / angle;
1213
1227
  float opticalDepth = expTerm * linearTerm;
1214
- float effectiveOpticalDepth = max((expTerm - shadowExpTerm) * linearTerm, 0.0);
1228
+ float shadowOpticalDepth = max((expTerm - shadowExpTerm) * linearTerm, 0.0);
1229
+ float transmittance = saturate(1.0 - exp(-opticalDepth));
1230
+ float shadowTransmittance = saturate(1.0 - exp(-shadowOpticalDepth));
1215
1231
 
1216
1232
  vec3 skyIrradiance = vGroundIrradiance.sky;
1217
1233
  vec3 sunIrradiance = vGroundIrradiance.sun;
1218
- vec3 irradiance = sunIrradiance * phaseFunction(cosTheta);
1219
- irradiance += skyIrradiance * RECIPROCAL_PI4 * skyIrradianceScale;
1220
- vec3 inscatter = albedo * irradiance * saturate(1.0 - exp(-effectiveOpticalDepth));
1221
-
1222
- // Inscatter is attenuated by shadow length, but transmittance is not.
1223
- return vec4(inscatter, saturate(1.0 - exp(-opticalDepth)));
1234
+ vec3 inscatter = sunIrradiance * phaseFunction(cosTheta) * shadowTransmittance;
1235
+ inscatter += skyIrradiance * RECIPROCAL_PI4 * skyLightScale * transmittance;
1236
+ inscatter *= hazeScatteringCoefficient / (hazeAbsorptionCoefficient + hazeScatteringCoefficient);
1237
+ return vec4(inscatter, transmittance);
1224
1238
  }
1225
1239
 
1226
1240
  #endif // HAZE
@@ -1239,8 +1253,7 @@ void applyAerialPerspective(
1239
1253
  sunDirection,
1240
1254
  transmittance
1241
1255
  );
1242
- float clampedAlpha = max(color.a, 1e-7);
1243
- color.rgb = mix(vec3(0.0), color.rgb * transmittance / clampedAlpha + inscatter, color.a);
1256
+ color.rgb = color.rgb * transmittance + inscatter * color.a;
1244
1257
  }
1245
1258
 
1246
1259
  bool rayIntersectsGround(const vec3 cameraPosition, const vec3 rayDirection) {
@@ -1519,7 +1532,8 @@ void main() {
1519
1532
  cosTheta,
1520
1533
  shadowLength
1521
1534
  );
1522
- color = color * (1.0 - haze.a) + haze;
1535
+ color.rgb = mix(color.rgb, haze.rgb, haze.a);
1536
+ color.a = color.a * (1.0 - haze.a) + haze.a;
1523
1537
  #endif // HAZE
1524
1538
 
1525
1539
  outputColor = color;
@@ -1528,7 +1542,7 @@ void main() {
1528
1542
  outputShadowLength = shadowLength * METER_TO_LENGTH_UNIT;
1529
1543
  #endif // SHADOW_LENGTH
1530
1544
  }
1531
- `, Oe = `float getSTBN() {
1545
+ `, Re = `float getSTBN() {
1532
1546
  ivec3 size = textureSize(stbnTexture, 0);
1533
1547
  vec3 scale = 1.0 / vec3(size);
1534
1548
  return texture(stbnTexture, vec3(gl_FragCoord.xy, float(frame % size.z)) * scale).r;
@@ -1697,7 +1711,7 @@ MediaSample sampleMedia(
1697
1711
  }
1698
1712
  #endif // SHAPE_DETAIL
1699
1713
 
1700
- // Nicely decrease the density at the bottom.
1714
+ // Apply the density profiles.
1701
1715
  density = saturate(density * densityScales * getLayerDensity(weather.heightFraction));
1702
1716
 
1703
1717
  MediaSample media;
@@ -1718,11 +1732,24 @@ MediaSample sampleMedia(
1718
1732
  ivec3 sampleCount;
1719
1733
  return sampleMedia(weather, position, uv, mipLevel, jitter, sampleCount);
1720
1734
  }
1721
- `, ft = `precision highp float;
1735
+ `, mt = `precision highp float;
1722
1736
  precision highp sampler3D;
1723
1737
 
1724
- #include "atmosphere/parameters"
1725
- #include "atmosphere/functions"
1738
+ #include "atmosphere/bruneton/definitions"
1739
+
1740
+ uniform AtmosphereParameters ATMOSPHERE;
1741
+ uniform vec3 SUN_SPECTRAL_RADIANCE_TO_LUMINANCE;
1742
+ uniform vec3 SKY_SPECTRAL_RADIANCE_TO_LUMINANCE;
1743
+
1744
+ uniform sampler2D transmittance_texture;
1745
+ uniform sampler3D scattering_texture;
1746
+ uniform sampler2D irradiance_texture;
1747
+ uniform sampler3D single_mie_scattering_texture;
1748
+ uniform sampler3D higher_order_scattering_texture;
1749
+
1750
+ #include "atmosphere/bruneton/common"
1751
+ #include "atmosphere/bruneton/runtime"
1752
+
1726
1753
  #include "types"
1727
1754
 
1728
1755
  uniform mat4 inverseProjectionMatrix;
@@ -1752,7 +1779,7 @@ out GroundIrradiance vGroundIrradiance;
1752
1779
  out CloudsIrradiance vCloudsIrradiance;
1753
1780
 
1754
1781
  void sampleSunSkyIrradiance(const vec3 positionECEF) {
1755
- vGroundIrradiance.sun = GetSunAndSkyIrradiance(
1782
+ vGroundIrradiance.sun = GetSunAndSkyScalarIrradiance(
1756
1783
  positionECEF * METER_TO_LENGTH_UNIT,
1757
1784
  sunDirection,
1758
1785
  vGroundIrradiance.sky
@@ -1760,12 +1787,12 @@ void sampleSunSkyIrradiance(const vec3 positionECEF) {
1760
1787
 
1761
1788
  vec3 surfaceNormal = normalize(positionECEF);
1762
1789
  vec2 radii = (bottomRadius + vec2(minHeight, maxHeight)) * METER_TO_LENGTH_UNIT;
1763
- vCloudsIrradiance.minSun = GetSunAndSkyIrradiance(
1790
+ vCloudsIrradiance.minSun = GetSunAndSkyScalarIrradiance(
1764
1791
  surfaceNormal * radii.x,
1765
1792
  sunDirection,
1766
1793
  vCloudsIrradiance.minSky
1767
1794
  );
1768
- vCloudsIrradiance.maxSun = GetSunAndSkyIrradiance(
1795
+ vCloudsIrradiance.maxSun = GetSunAndSkyScalarIrradiance(
1769
1796
  surfaceNormal * radii.y,
1770
1797
  sunDirection,
1771
1798
  vCloudsIrradiance.maxSky
@@ -1787,7 +1814,7 @@ void main() {
1787
1814
 
1788
1815
  gl_Position = vec4(position.xy, 1.0, 1.0);
1789
1816
  }
1790
- `, Re = `uniform vec2 resolution;
1817
+ `, Le = `uniform vec2 resolution;
1791
1818
  uniform int frame;
1792
1819
  uniform sampler3D stbnTexture;
1793
1820
 
@@ -1800,7 +1827,6 @@ uniform vec3 sunDirection;
1800
1827
  // Participating medium
1801
1828
  uniform float scatteringCoefficient;
1802
1829
  uniform float absorptionCoefficient;
1803
- uniform vec3 albedo;
1804
1830
 
1805
1831
  // Primary raymarch
1806
1832
  uniform float minDensity;
@@ -1832,6 +1858,8 @@ uniform float turbulenceDisplacement;
1832
1858
  #ifdef HAZE
1833
1859
  uniform float hazeDensityScale;
1834
1860
  uniform float hazeExponent;
1861
+ uniform float hazeScatteringCoefficient;
1862
+ uniform float hazeAbsorptionCoefficient;
1835
1863
  #endif // HAZE
1836
1864
 
1837
1865
  // Cloud layers
@@ -1850,7 +1878,7 @@ uniform float maxHeight;
1850
1878
  uniform float shadowTopHeight;
1851
1879
  uniform float shadowBottomHeight;
1852
1880
  uniform vec4 shadowLayerMask;
1853
- uniform DensityProfile densityProfile;
1881
+ uniform CloudDensityProfile densityProfile;
1854
1882
  `, $ = `struct GroundIrradiance {
1855
1883
  vec3 sun;
1856
1884
  vec3 sky;
@@ -1863,55 +1891,61 @@ struct CloudsIrradiance {
1863
1891
  vec3 maxSky;
1864
1892
  };
1865
1893
 
1866
- struct DensityProfile {
1894
+ struct CloudDensityProfile {
1867
1895
  vec4 expTerms;
1868
1896
  vec4 exponents;
1869
1897
  vec4 linearTerms;
1870
1898
  vec4 constantTerms;
1871
1899
  };
1872
1900
  `;
1873
- var mt = Object.defineProperty, w = (o, e, t, n) => {
1901
+ var vt = Object.defineProperty, w = (o, e, t, n) => {
1874
1902
  for (var a = void 0, i = o.length - 1, s; i >= 0; i--)
1875
1903
  (s = o[i]) && (a = s(e, t, a) || a);
1876
- return a && mt(e, t, a), a;
1904
+ return a && vt(e, t, a), a;
1877
1905
  };
1878
- const vt = /* @__PURE__ */ new f(), gt = /* @__PURE__ */ new qe();
1879
- class y extends je {
1906
+ const gt = /* @__PURE__ */ new f(), St = /* @__PURE__ */ new qe();
1907
+ class y extends Ye {
1880
1908
  constructor({
1881
1909
  parameterUniforms: e,
1882
1910
  layerUniforms: t,
1883
1911
  atmosphereUniforms: n
1884
- }, a = Ce.DEFAULT) {
1912
+ }, a = Te.DEFAULT) {
1885
1913
  super(
1886
1914
  {
1887
1915
  name: "CloudsMaterial",
1888
1916
  glslVersion: W,
1889
- vertexShader: M(ft, {
1917
+ vertexShader: U(mt, {
1890
1918
  atmosphere: {
1891
- parameters: pe,
1892
- functions: de
1919
+ bruneton: {
1920
+ common: fe,
1921
+ definitions: pe,
1922
+ runtime: de
1923
+ }
1893
1924
  },
1894
1925
  types: $
1895
1926
  }),
1896
- fragmentShader: G(
1897
- M(pt, {
1927
+ fragmentShader: B(
1928
+ U(ft, {
1898
1929
  core: {
1899
- depth: Qe,
1900
- math: _e,
1901
- turbo: Ae,
1902
- generators: Je,
1903
- raySphereIntersection: Ee,
1904
- cascadedShadowMaps: Xe,
1905
- interleavedGradientNoise: $e,
1906
- vogelDisk: Ke
1930
+ depth: et,
1931
+ math: Oe,
1932
+ turbo: _e,
1933
+ generators: Qe,
1934
+ raySphereIntersection: Ae,
1935
+ cascadedShadowMaps: Je,
1936
+ interleavedGradientNoise: Xe,
1937
+ vogelDisk: $e
1907
1938
  },
1908
1939
  atmosphere: {
1909
- parameters: pe,
1910
- functions: de
1940
+ bruneton: {
1941
+ common: fe,
1942
+ definitions: pe,
1943
+ runtime: de
1944
+ }
1911
1945
  },
1912
1946
  types: $,
1913
- parameters: Re,
1914
- clouds: Oe
1947
+ parameters: Le,
1948
+ clouds: Re
1915
1949
  })
1916
1950
  ),
1917
1951
  // prettier-ignore
@@ -1934,25 +1968,24 @@ class y extends je {
1934
1968
  mipLevelScale: new r(1),
1935
1969
  stbnTexture: new r(null),
1936
1970
  // Scattering
1937
- albedo: new r(new f()),
1938
- skyIrradianceScale: new r(2.5),
1939
- groundIrradianceScale: new r(3),
1971
+ skyLightScale: new r(1),
1972
+ groundBounceScale: new r(1),
1940
1973
  powderScale: new r(0.8),
1941
1974
  powderExponent: new r(150),
1942
1975
  // Primary raymarch
1943
- maxIterationCount: new r(l.clouds.maxIterationCount),
1944
- minStepSize: new r(l.clouds.minStepSize),
1945
- maxStepSize: new r(l.clouds.maxStepSize),
1946
- maxRayDistance: new r(l.clouds.maxRayDistance),
1947
- perspectiveStepScale: new r(l.clouds.perspectiveStepScale),
1948
- minDensity: new r(l.clouds.minDensity),
1949
- minExtinction: new r(l.clouds.minExtinction),
1950
- minTransmittance: new r(l.clouds.minTransmittance),
1976
+ maxIterationCount: new r(c.clouds.maxIterationCount),
1977
+ minStepSize: new r(c.clouds.minStepSize),
1978
+ maxStepSize: new r(c.clouds.maxStepSize),
1979
+ maxRayDistance: new r(c.clouds.maxRayDistance),
1980
+ perspectiveStepScale: new r(c.clouds.perspectiveStepScale),
1981
+ minDensity: new r(c.clouds.minDensity),
1982
+ minExtinction: new r(c.clouds.minExtinction),
1983
+ minTransmittance: new r(c.clouds.minTransmittance),
1951
1984
  // Secondary raymarch
1952
- maxIterationCountToSun: new r(l.clouds.maxIterationCountToSun),
1953
- maxIterationCountToGround: new r(l.clouds.maxIterationCountToGround),
1954
- minSecondaryStepSize: new r(l.clouds.minSecondaryStepSize),
1955
- secondaryStepScale: new r(l.clouds.secondaryStepScale),
1985
+ maxIterationCountToSun: new r(c.clouds.maxIterationCountToSun),
1986
+ maxIterationCountToGround: new r(c.clouds.maxIterationCountToGround),
1987
+ minSecondaryStepSize: new r(c.clouds.minSecondaryStepSize),
1988
+ secondaryStepScale: new r(c.clouds.secondaryStepScale),
1956
1989
  // Beer shadow map
1957
1990
  shadowBuffer: new r(null),
1958
1991
  shadowTexelSize: new r(new m()),
@@ -1969,26 +2002,26 @@ class y extends je {
1969
2002
  shadowLayerMask: new r(new x().setScalar(1)),
1970
2003
  // Disable mask
1971
2004
  // Shadow length
1972
- maxShadowLengthIterationCount: new r(l.clouds.maxShadowLengthIterationCount),
1973
- minShadowLengthStepSize: new r(l.clouds.minShadowLengthStepSize),
1974
- maxShadowLengthRayDistance: new r(l.clouds.maxShadowLengthRayDistance),
2005
+ maxShadowLengthIterationCount: new r(c.clouds.maxShadowLengthIterationCount),
2006
+ minShadowLengthStepSize: new r(c.clouds.minShadowLengthStepSize),
2007
+ maxShadowLengthRayDistance: new r(c.clouds.maxShadowLengthRayDistance),
1975
2008
  // Haze
1976
2009
  hazeDensityScale: new r(3e-5),
1977
- hazeExponent: new r(1e-3)
2010
+ hazeExponent: new r(1e-3),
2011
+ hazeScatteringCoefficient: new r(0.9),
2012
+ hazeAbsorptionCoefficient: new r(0.5)
1978
2013
  }
1979
2014
  },
1980
2015
  a
1981
- ), this.temporalUpscale = !0, this.depthPacking = 0, this.localWeatherChannels = "rgba", this.shapeDetail = l.shapeDetail, this.turbulence = l.turbulence, this.shadowLength = l.lightShafts, this.haze = l.haze, this.multiScatteringOctaves = l.clouds.multiScatteringOctaves, this.accurateSunSkyIrradiance = l.clouds.accurateSunSkyIrradiance, this.accuratePhaseFunction = l.clouds.accuratePhaseFunction, this.shadowCascadeCount = l.shadow.cascadeCount, this.shadowSampleCount = 8, this.scatterAnisotropy1 = 0.7, this.scatterAnisotropy2 = -0.2, this.scatterAnisotropyMix = 0.5;
2016
+ ), this.temporalUpscale = !0, this.depthPacking = 0, this.localWeatherChannels = "rgba", this.shapeDetail = c.shapeDetail, this.turbulence = c.turbulence, this.shadowLength = c.lightShafts, this.haze = c.haze, this.multiScatteringOctaves = c.clouds.multiScatteringOctaves, this.accurateSunSkyLight = c.clouds.accurateSunSkyLight, this.accuratePhaseFunction = c.clouds.accuratePhaseFunction, this.shadowCascadeCount = c.shadow.cascadeCount, this.shadowSampleCount = 8, this.scatterAnisotropy1 = 0.7, this.scatterAnisotropy2 = -0.2, this.scatterAnisotropyMix = 0.5;
1982
2017
  }
1983
2018
  onBeforeRender(e, t, n, a, i, s) {
1984
- const c = this.uniforms;
1985
- c.albedo.value.setScalar(
1986
- c.scatteringCoefficient.value / (c.absorptionCoefficient.value + c.scatteringCoefficient.value)
1987
- );
1988
- const h = this.defines.POWDER != null, u = this.uniforms.powderScale.value > 0;
1989
- u !== h && (u ? this.defines.POWDER = "1" : delete this.defines.POWDER, this.needsUpdate = !0);
1990
- const d = this.defines.GROUND_IRRADIANCE != null;
1991
- (this.uniforms.groundIrradianceScale.value > 0 && this.uniforms.maxIterationCountToGround.value > 0) !== d && (u ? this.defines.GROUND_IRRADIANCE = "1" : delete this.defines.GROUND_IRRADIANCE, this.needsUpdate = !0);
2019
+ const l = this.defines.USE_LOGDEPTHBUF != null, u = e.capabilities.logarithmicDepthBuffer;
2020
+ u !== l && (u ? this.defines.USE_LOGDEPTHBUF = "1" : delete this.defines.USE_LOGDEPTHBUF);
2021
+ const h = this.defines.POWDER != null, d = this.uniforms.powderScale.value > 0;
2022
+ d !== h && (d ? this.defines.POWDER = "1" : delete this.defines.POWDER, this.needsUpdate = !0);
2023
+ const p = this.defines.GROUND_BOUNCE != null;
2024
+ (this.uniforms.groundBounceScale.value > 0 && this.uniforms.maxIterationCountToGround.value > 0) !== p && (d ? this.defines.GROUND_BOUNCE = "1" : delete this.defines.GROUND_BOUNCE, this.needsUpdate = !0);
1992
2025
  }
1993
2026
  copyCameraSettings(e) {
1994
2027
  e.isPerspectiveCamera === !0 ? this.defines.PERSPECTIVE_CAMERA !== "1" && (this.defines.PERSPECTIVE_CAMERA = "1", this.needsUpdate = !0) : this.defines.PERSPECTIVE_CAMERA != null && (delete this.defines.PERSPECTIVE_CAMERA, this.needsUpdate = !0);
@@ -1996,16 +2029,16 @@ class y extends je {
1996
2029
  t.viewMatrix.value.copy(e.matrixWorldInverse), t.inverseViewMatrix.value.copy(e.matrixWorld);
1997
2030
  const n = this.previousProjectionMatrix ?? e.projectionMatrix, a = this.previousViewMatrix ?? e.matrixWorldInverse, i = t.inverseProjectionMatrix.value, s = t.reprojectionMatrix.value;
1998
2031
  if (this.temporalUpscale) {
1999
- const u = t.frame.value % 16, d = t.resolution.value, p = Pe[u], g = (p.x - 0.5) / d.x * 4, S = (p.y - 0.5) / d.y * 4;
2032
+ const h = t.frame.value % 16, d = t.resolution.value, p = Pe[h], g = (p.x - 0.5) / d.x * 4, S = (p.y - 0.5) / d.y * 4;
2000
2033
  t.temporalJitter.value.set(g, S), t.mipLevelScale.value = 0.25, i.copy(e.projectionMatrix), i.elements[8] += g * 2, i.elements[9] += S * 2, i.invert(), s.copy(n), s.elements[8] += g * 2, s.elements[9] += S * 2, s.multiply(a);
2001
2034
  } else
2002
2035
  t.temporalJitter.value.setScalar(0), t.mipLevelScale.value = 1, i.copy(e.projectionMatrixInverse), s.copy(n).multiply(a);
2003
- Ze(e), t.cameraNear.value = e.near, t.cameraFar.value = e.far;
2004
- const c = e.getWorldPosition(
2036
+ Ke(e), t.cameraNear.value = e.near, t.cameraFar.value = e.far;
2037
+ const l = e.getWorldPosition(
2005
2038
  t.cameraPosition.value
2006
- ), h = vt.copy(c).applyMatrix4(t.inverseEllipsoidMatrix.value).sub(t.ellipsoidCenter.value);
2039
+ ), u = gt.copy(l).applyMatrix4(t.inverseEllipsoidMatrix.value).sub(t.ellipsoidCenter.value);
2007
2040
  try {
2008
- t.cameraHeight.value = gt.setFromECEF(h).height;
2041
+ t.cameraHeight.value = St.setFromECEF(u).height;
2009
2042
  } catch {
2010
2043
  }
2011
2044
  }
@@ -2029,12 +2062,20 @@ class y extends je {
2029
2062
  set depthBuffer(e) {
2030
2063
  this.uniforms.depthBuffer.value = e;
2031
2064
  }
2065
+ /** @deprecated Use accurateSunSkyLight instead. */
2066
+ get accurateSunSkyIrradiance() {
2067
+ return this.accurateSunSkyLight;
2068
+ }
2069
+ /** @deprecated Use accurateSunSkyLight instead. */
2070
+ set accurateSunSkyIrradiance(e) {
2071
+ this.accurateSunSkyLight = e;
2072
+ }
2032
2073
  }
2033
2074
  w([
2034
- O("DEPTH_PACKING")
2075
+ P("DEPTH_PACKING")
2035
2076
  ], y.prototype, "depthPacking");
2036
2077
  w([
2037
- De("LOCAL_WEATHER_CHANNELS", {
2078
+ Ee("LOCAL_WEATHER_CHANNELS", {
2038
2079
  validate: (o) => /^[rgba]{4}$/.test(o)
2039
2080
  })
2040
2081
  ], y.prototype, "localWeatherChannels");
@@ -2051,19 +2092,19 @@ w([
2051
2092
  C("HAZE")
2052
2093
  ], y.prototype, "haze");
2053
2094
  w([
2054
- O("MULTI_SCATTERING_OCTAVES", { min: 1, max: 12 })
2095
+ P("MULTI_SCATTERING_OCTAVES", { min: 1, max: 12 })
2055
2096
  ], y.prototype, "multiScatteringOctaves");
2056
2097
  w([
2057
- C("ACCURATE_SUN_SKY_IRRADIANCE")
2058
- ], y.prototype, "accurateSunSkyIrradiance");
2098
+ C("ACCURATE_SUN_SKY_LIGHT")
2099
+ ], y.prototype, "accurateSunSkyLight");
2059
2100
  w([
2060
2101
  C("ACCURATE_PHASE_FUNCTION")
2061
2102
  ], y.prototype, "accuratePhaseFunction");
2062
2103
  w([
2063
- O("SHADOW_CASCADE_COUNT", { min: 1, max: 4 })
2104
+ P("SHADOW_CASCADE_COUNT", { min: 1, max: 4 })
2064
2105
  ], y.prototype, "shadowCascadeCount");
2065
2106
  w([
2066
- O("SHADOW_SAMPLE_COUNT", { min: 1, max: 16 })
2107
+ P("SHADOW_SAMPLE_COUNT", { min: 1, max: 16 })
2067
2108
  ], y.prototype, "shadowSampleCount");
2068
2109
  w([
2069
2110
  J("SCATTER_ANISOTROPY_1")
@@ -2074,7 +2115,7 @@ w([
2074
2115
  w([
2075
2116
  J("SCATTER_ANISOTROPY_MIX")
2076
2117
  ], y.prototype, "scatterAnisotropyMix");
2077
- const St = `// Taken from https://gist.github.com/TheRealMJP/c83b8c0f46b63f3a88a5986f4fa982b1
2118
+ const yt = `// Taken from https://gist.github.com/TheRealMJP/c83b8c0f46b63f3a88a5986f4fa982b1
2078
2119
  // TODO: Use 5-taps version: https://www.shadertoy.com/view/MtVGWz
2079
2120
  // Or even 4 taps (requires preprocessing in the input buffer):
2080
2121
  // https://www.shadertoy.com/view/4tyGDD
@@ -2187,7 +2228,7 @@ vec4 textureCatmullRom(sampler2DArray tex, vec3 uv) {
2187
2228
  result += texture(tex, vec3(texPos3.x, texPos3.y, uv.z)) * w3.x * w3.y;
2188
2229
  return result;
2189
2230
  }
2190
- `, yt = `precision highp float;
2231
+ `, xt = `precision highp float;
2191
2232
  precision highp sampler2DArray;
2192
2233
 
2193
2234
  #include "core/turbo"
@@ -2389,7 +2430,7 @@ void main() {
2389
2430
  outputColor = vec4(turbo(outputShadowLength * 0.05), 1.0);
2390
2431
  #endif // defined(SHADOW_LENGTH) && defined(DEBUG_SHOW_SHADOW_LENGTH)
2391
2432
  }
2392
- `, xt = `precision highp float;
2433
+ `, wt = `precision highp float;
2393
2434
 
2394
2435
  layout(location = 0) in vec3 position;
2395
2436
 
@@ -2399,8 +2440,8 @@ void main() {
2399
2440
  vUv = position.xy * 0.5 + 0.5;
2400
2441
  gl_Position = vec4(position.xy, 1.0, 1.0);
2401
2442
  }
2402
- `, Le = `#ifdef VARIANCE_9_SAMPLES
2403
- #define VARIANCE_OFFSET_COUNT (8)
2443
+ `, Ie = `#ifdef VARIANCE_9_SAMPLES
2444
+ #define VARIANCE_OFFSET_COUNT 8
2404
2445
  const ivec2 varianceOffsets[8] = ivec2[8](
2405
2446
  ivec2(-1, -1),
2406
2447
  ivec2(-1, 1),
@@ -2412,7 +2453,7 @@ const ivec2 varianceOffsets[8] = ivec2[8](
2412
2453
  ivec2(-1, 0)
2413
2454
  );
2414
2455
  #else // VARIANCE_9_SAMPLES
2415
- #define VARIANCE_OFFSET_COUNT (4)
2456
+ #define VARIANCE_OFFSET_COUNT 4
2416
2457
  const ivec2 varianceOffsets[4] = ivec2[4](ivec2(1, 0), ivec2(0, -1), ivec2(0, 1), ivec2(-1, 0));
2417
2458
  #endif // VARIANCE_9_SAMPLES
2418
2459
 
@@ -2514,10 +2555,10 @@ vec4 varianceClipping(
2514
2555
  return varianceClipping(inputBuffer, coord, current, history, 1.0);
2515
2556
  }
2516
2557
  `;
2517
- var wt = Object.defineProperty, Ie = (o, e, t, n) => {
2558
+ var Ct = Object.defineProperty, Ne = (o, e, t, n) => {
2518
2559
  for (var a = void 0, i = o.length - 1, s; i >= 0; i--)
2519
2560
  (s = o[i]) && (a = s(e, t, a) || a);
2520
- return a && wt(e, t, a), a;
2561
+ return a && Ct(e, t, a), a;
2521
2562
  };
2522
2563
  class Q extends X {
2523
2564
  constructor({
@@ -2530,12 +2571,12 @@ class Q extends X {
2530
2571
  super({
2531
2572
  name: "CloudsResolveMaterial",
2532
2573
  glslVersion: W,
2533
- vertexShader: xt,
2534
- fragmentShader: G(
2535
- M(yt, {
2536
- core: { turbo: Ae },
2537
- catmullRomSampling: St,
2538
- varianceClipping: Le
2574
+ vertexShader: wt,
2575
+ fragmentShader: B(
2576
+ U(xt, {
2577
+ core: { turbo: _e },
2578
+ catmullRomSampling: yt,
2579
+ varianceClipping: Ie
2539
2580
  })
2540
2581
  ),
2541
2582
  uniforms: {
@@ -2556,19 +2597,19 @@ class Q extends X {
2556
2597
  this.uniforms.texelSize.value.set(1 / e, 1 / t);
2557
2598
  }
2558
2599
  onBeforeRender(e, t, n, a, i, s) {
2559
- const h = this.uniforms.frame.value % 16, u = Pe[h], d = (u.x - 0.5) * 4, p = (u.y - 0.5) * 4;
2600
+ const u = this.uniforms.frame.value % 16, h = Pe[u], d = (h.x - 0.5) * 4, p = (h.y - 0.5) * 4;
2560
2601
  this.uniforms.jitterOffset.value.set(d, p);
2561
2602
  }
2562
2603
  }
2563
- Ie([
2604
+ Ne([
2564
2605
  C("TEMPORAL_UPSCALE")
2565
2606
  ], Q.prototype, "temporalUpscale");
2566
- Ie([
2607
+ Ne([
2567
2608
  C("SHADOW_LENGTH")
2568
2609
  ], Q.prototype, "shadowLength");
2569
- class Ne extends He {
2610
+ class Me extends ze {
2570
2611
  constructor(e, t) {
2571
- super(e), this._mainCamera = new xe();
2612
+ super(e), this._mainCamera = new we();
2572
2613
  const { shadow: n } = t;
2573
2614
  this.shadow = n;
2574
2615
  }
@@ -2582,19 +2623,18 @@ class Ne extends He {
2582
2623
  function k(o, { depthVelocity: e, shadowLength: t }) {
2583
2624
  const n = new Ge(1, 1, {
2584
2625
  depthBuffer: !1,
2585
- stencilBuffer: !1,
2586
- type: we
2626
+ type: Ce
2587
2627
  });
2588
- n.texture.minFilter = z, n.texture.magFilter = z, n.texture.name = o;
2628
+ n.texture.minFilter = F, n.texture.magFilter = F, n.texture.name = o;
2589
2629
  let a;
2590
2630
  e && (a = n.texture.clone(), a.isRenderTargetTexture = !0, n.depthVelocity = a, n.textures.push(a));
2591
2631
  let i;
2592
- return t && (i = n.texture.clone(), i.isRenderTargetTexture = !0, i.format = Be, n.shadowLength = i, n.textures.push(i)), Object.assign(n, {
2632
+ return t && (i = n.texture.clone(), i.isRenderTargetTexture = !0, i.format = Ve, n.shadowLength = i, n.textures.push(i)), Object.assign(n, {
2593
2633
  depthVelocity: a ?? null,
2594
2634
  shadowLength: i ?? null
2595
2635
  });
2596
2636
  }
2597
- class Ct extends Ne {
2637
+ class Tt extends Me {
2598
2638
  constructor({
2599
2639
  parameterUniforms: e,
2600
2640
  layerUniforms: t,
@@ -2610,7 +2650,7 @@ class Ct extends Ne {
2610
2650
  i
2611
2651
  ), this.currentPass = new Z(this.currentMaterial), this.resolveMaterial = new Q(), this.resolvePass = new Z(this.resolveMaterial), this.initRenderTargets({
2612
2652
  depthVelocity: !0,
2613
- shadowLength: l.lightShafts
2653
+ shadowLength: c.lightShafts
2614
2654
  });
2615
2655
  }
2616
2656
  copyCameraSettings(e) {
@@ -2620,8 +2660,8 @@ class Ct extends Ne {
2620
2660
  this.currentPass.initialize(e, t, n), this.resolvePass.initialize(e, t, n);
2621
2661
  }
2622
2662
  initRenderTargets(e) {
2623
- var s, c, h;
2624
- (s = this.currentRenderTarget) == null || s.dispose(), (c = this.resolveRenderTarget) == null || c.dispose(), (h = this.historyRenderTarget) == null || h.dispose();
2663
+ var s, l, u;
2664
+ (s = this.currentRenderTarget) == null || s.dispose(), (l = this.resolveRenderTarget) == null || l.dispose(), (u = this.historyRenderTarget) == null || u.dispose();
2625
2665
  const t = k("Clouds", e), n = k("Clouds.A", {
2626
2666
  ...e,
2627
2667
  depthVelocity: !1
@@ -2700,28 +2740,28 @@ class Ct extends Ne {
2700
2740
  }), this.setSize(this.width, this.height));
2701
2741
  }
2702
2742
  }
2703
- function Tt(o, e) {
2704
- const t = o.properties.get(e.texture).__webglTexture, n = o.getContext();
2705
- A(n instanceof WebGL2RenderingContext), o.setRenderTarget(e);
2706
- const a = [];
2707
- if (t != null)
2708
- for (let i = 0; i < e.depth; ++i)
2709
- n.framebufferTextureLayer(
2710
- n.FRAMEBUFFER,
2711
- n.COLOR_ATTACHMENT0 + i,
2712
- t,
2743
+ function Dt(o, e) {
2744
+ const n = o.properties.get(e.texture).__webglTexture, a = o.getContext();
2745
+ A(a instanceof WebGL2RenderingContext), o.setRenderTarget(e);
2746
+ const i = [];
2747
+ if (n != null)
2748
+ for (let s = 0; s < e.depth; ++s)
2749
+ a.framebufferTextureLayer(
2750
+ a.FRAMEBUFFER,
2751
+ a.COLOR_ATTACHMENT0 + s,
2752
+ n,
2713
2753
  0,
2714
- i
2715
- ), a.push(n.COLOR_ATTACHMENT0 + i);
2716
- n.drawBuffers(a);
2754
+ s
2755
+ ), i.push(a.COLOR_ATTACHMENT0 + s);
2756
+ a.drawBuffers(i);
2717
2757
  }
2718
- class ye extends Z {
2758
+ class xe extends Z {
2719
2759
  render(e, t, n, a, i) {
2720
2760
  const s = this.fullscreenMaterial.uniforms;
2721
- t !== null && (s == null ? void 0 : s[this.input]) != null && (s[this.input].value = t.texture), Tt(e, n), e.render(this.scene, this.camera);
2761
+ t !== null && (s == null ? void 0 : s[this.input]) != null && (s[this.input].value = t.texture), Dt(e, n), e.render(this.scene, this.camera);
2722
2762
  }
2723
2763
  }
2724
- const Dt = `precision highp float;
2764
+ const Et = `precision highp float;
2725
2765
  precision highp sampler3D;
2726
2766
 
2727
2767
  #include <common>
@@ -2918,7 +2958,7 @@ void main() {
2918
2958
  }
2919
2959
  #pragma unroll_loop_end
2920
2960
  }
2921
- `, Et = `precision highp float;
2961
+ `, At = `precision highp float;
2922
2962
 
2923
2963
  uniform vec3 ellipsoidCenter;
2924
2964
  uniform vec3 altitudeCorrection;
@@ -2934,7 +2974,7 @@ void main() {
2934
2974
 
2935
2975
  gl_Position = vec4(position.xy, 1.0, 1.0);
2936
2976
  }
2937
- `, At = `// Implements Structured Volume Sampling in fragment shader:
2977
+ `, _t = `// Implements Structured Volume Sampling in fragment shader:
2938
2978
  // https://github.com/huwb/volsample
2939
2979
  // Implementation reference:
2940
2980
  // https://www.shadertoy.com/view/ttVfDc
@@ -3036,10 +3076,10 @@ void intersectStructuredPlanes(
3036
3076
  }
3037
3077
  }
3038
3078
  `;
3039
- var _t = Object.defineProperty, R = (o, e, t, n) => {
3079
+ var Ot = Object.defineProperty, R = (o, e, t, n) => {
3040
3080
  for (var a = void 0, i = o.length - 1, s; i >= 0; i--)
3041
3081
  (s = o[i]) && (a = s(e, t, a) || a);
3042
- return a && _t(e, t, a), a;
3082
+ return a && Ot(e, t, a), a;
3043
3083
  };
3044
3084
  class _ extends X {
3045
3085
  constructor({
@@ -3050,17 +3090,17 @@ class _ extends X {
3050
3090
  super({
3051
3091
  name: "ShadowMaterial",
3052
3092
  glslVersion: W,
3053
- vertexShader: Et,
3054
- fragmentShader: G(
3055
- M(Dt, {
3093
+ vertexShader: At,
3094
+ fragmentShader: B(
3095
+ U(Et, {
3056
3096
  core: {
3057
- math: _e,
3058
- raySphereIntersection: Ee
3097
+ math: Oe,
3098
+ raySphereIntersection: Ae
3059
3099
  },
3060
3100
  types: $,
3061
- parameters: Re,
3062
- structuredSampling: At,
3063
- clouds: Oe
3101
+ parameters: Le,
3102
+ structuredSampling: _t,
3103
+ clouds: Re
3064
3104
  })
3065
3105
  ),
3066
3106
  uniforms: {
@@ -3079,12 +3119,12 @@ class _ extends X {
3079
3119
  frame: new r(0),
3080
3120
  stbnTexture: new r(null),
3081
3121
  // Primary raymarch
3082
- maxIterationCount: new r(l.shadow.maxIterationCount),
3083
- minStepSize: new r(l.shadow.minStepSize),
3084
- maxStepSize: new r(l.shadow.maxStepSize),
3085
- minDensity: new r(l.shadow.minDensity),
3086
- minExtinction: new r(l.shadow.minExtinction),
3087
- minTransmittance: new r(l.shadow.minTransmittance),
3122
+ maxIterationCount: new r(c.shadow.maxIterationCount),
3123
+ minStepSize: new r(c.shadow.minStepSize),
3124
+ maxStepSize: new r(c.shadow.maxStepSize),
3125
+ minDensity: new r(c.shadow.minDensity),
3126
+ minExtinction: new r(c.shadow.minExtinction),
3127
+ minTransmittance: new r(c.shadow.minTransmittance),
3088
3128
  opticalDepthTailScale: new r(2)
3089
3129
  },
3090
3130
  defines: {
@@ -3092,19 +3132,19 @@ class _ extends X {
3092
3132
  TEMPORAL_PASS: "1",
3093
3133
  TEMPORAL_JITTER: "1"
3094
3134
  }
3095
- }), this.localWeatherChannels = "rgba", this.cascadeCount = l.shadow.cascadeCount, this.temporalPass = !0, this.temporalJitter = !0, this.shapeDetail = l.shapeDetail, this.turbulence = l.turbulence, this.cascadeCount = l.shadow.cascadeCount;
3135
+ }), this.localWeatherChannels = "rgba", this.cascadeCount = c.shadow.cascadeCount, this.temporalPass = !0, this.temporalJitter = !0, this.shapeDetail = c.shapeDetail, this.turbulence = c.turbulence, this.cascadeCount = c.shadow.cascadeCount;
3096
3136
  }
3097
3137
  setSize(e, t) {
3098
3138
  this.uniforms.resolution.value.set(e, t);
3099
3139
  }
3100
3140
  }
3101
3141
  R([
3102
- De("LOCAL_WEATHER_CHANNELS", {
3142
+ Ee("LOCAL_WEATHER_CHANNELS", {
3103
3143
  validate: (o) => /^[rgba]{4}$/.test(o)
3104
3144
  })
3105
3145
  ], _.prototype, "localWeatherChannels");
3106
3146
  R([
3107
- O("CASCADE_COUNT", { min: 1, max: 4 })
3147
+ P("CASCADE_COUNT", { min: 1, max: 4 })
3108
3148
  ], _.prototype, "cascadeCount");
3109
3149
  R([
3110
3150
  C("TEMPORAL_PASS")
@@ -3121,8 +3161,8 @@ R([
3121
3161
  const Pt = `precision highp float;
3122
3162
  precision highp sampler2DArray;
3123
3163
 
3124
- #define VARIANCE_9_SAMPLES (1)
3125
- #define VARIANCE_SAMPLER_ARRAY (1)
3164
+ #define VARIANCE_9_SAMPLES 1
3165
+ #define VARIANCE_SAMPLER_ARRAY 1
3126
3166
 
3127
3167
  #include "varianceClipping"
3128
3168
 
@@ -3194,7 +3234,7 @@ void main() {
3194
3234
  }
3195
3235
  #pragma unroll_loop_end
3196
3236
  }
3197
- `, Ot = `precision highp float;
3237
+ `, Rt = `precision highp float;
3198
3238
 
3199
3239
  layout(location = 0) in vec3 position;
3200
3240
 
@@ -3205,12 +3245,12 @@ void main() {
3205
3245
  gl_Position = vec4(position.xy, 1.0, 1.0);
3206
3246
  }
3207
3247
  `;
3208
- var Rt = Object.defineProperty, Lt = (o, e, t, n) => {
3248
+ var Lt = Object.defineProperty, It = (o, e, t, n) => {
3209
3249
  for (var a = void 0, i = o.length - 1, s; i >= 0; i--)
3210
3250
  (s = o[i]) && (a = s(e, t, a) || a);
3211
- return a && Rt(e, t, a), a;
3251
+ return a && Lt(e, t, a), a;
3212
3252
  };
3213
- class be extends X {
3253
+ class Ue extends X {
3214
3254
  constructor({
3215
3255
  inputBuffer: e = null,
3216
3256
  historyBuffer: t = null
@@ -3218,10 +3258,10 @@ class be extends X {
3218
3258
  super({
3219
3259
  name: "ShadowResolveMaterial",
3220
3260
  glslVersion: W,
3221
- vertexShader: Ot,
3222
- fragmentShader: G(
3223
- M(Pt, {
3224
- varianceClipping: Le
3261
+ vertexShader: Rt,
3262
+ fragmentShader: B(
3263
+ U(Pt, {
3264
+ varianceClipping: Ie
3225
3265
  })
3226
3266
  ),
3227
3267
  uniforms: {
@@ -3236,23 +3276,22 @@ class be extends X {
3236
3276
  temporalAlpha: new r(0.01)
3237
3277
  },
3238
3278
  defines: {}
3239
- }), this.cascadeCount = l.shadow.cascadeCount;
3279
+ }), this.cascadeCount = c.shadow.cascadeCount;
3240
3280
  }
3241
3281
  setSize(e, t) {
3242
3282
  this.uniforms.texelSize.value.set(1 / e, 1 / t);
3243
3283
  }
3244
3284
  }
3245
- Lt([
3246
- O("CASCADE_COUNT", { min: 1, max: 4 })
3247
- ], be.prototype, "cascadeCount");
3285
+ It([
3286
+ P("CASCADE_COUNT", { min: 1, max: 4 })
3287
+ ], Ue.prototype, "cascadeCount");
3248
3288
  function j(o) {
3249
- const e = new Ve(1, 1, 1, {
3250
- depthBuffer: !1,
3251
- stencilBuffer: !1
3289
+ const e = new ke(1, 1, 1, {
3290
+ depthBuffer: !1
3252
3291
  });
3253
- return e.texture.type = we, e.texture.minFilter = z, e.texture.magFilter = z, e.texture.name = o, e;
3292
+ return e.texture.type = Ce, e.texture.minFilter = F, e.texture.magFilter = F, e.texture.name = o, e;
3254
3293
  }
3255
- class It extends Ne {
3294
+ class Nt extends Me {
3256
3295
  constructor({
3257
3296
  parameterUniforms: e,
3258
3297
  layerUniforms: t,
@@ -3263,14 +3302,14 @@ class It extends Ne {
3263
3302
  parameterUniforms: e,
3264
3303
  layerUniforms: t,
3265
3304
  atmosphereUniforms: n
3266
- }), this.currentPass = new ye(this.currentMaterial), this.resolveMaterial = new be(), this.resolvePass = new ye(this.resolveMaterial), this.initRenderTargets();
3305
+ }), this.currentPass = new xe(this.currentMaterial), this.resolveMaterial = new Ue(), this.resolvePass = new xe(this.resolveMaterial), this.initRenderTargets();
3267
3306
  }
3268
3307
  initialize(e, t, n) {
3269
3308
  this.currentPass.initialize(e, t, n), this.resolvePass.initialize(e, t, n);
3270
3309
  }
3271
3310
  initRenderTargets() {
3272
- var i, s, c;
3273
- (i = this.currentRenderTarget) == null || i.dispose(), (s = this.resolveRenderTarget) == null || s.dispose(), (c = this.historyRenderTarget) == null || c.dispose();
3311
+ var i, s, l;
3312
+ (i = this.currentRenderTarget) == null || i.dispose(), (s = this.resolveRenderTarget) == null || s.dispose(), (l = this.historyRenderTarget) == null || l.dispose();
3274
3313
  const e = j("Shadow"), t = this.temporalPass ? j("Shadow.A") : null, n = this.temporalPass ? j("Shadow.B") : null;
3275
3314
  this.currentRenderTarget = e, this.resolveRenderTarget = t, this.historyRenderTarget = n;
3276
3315
  const a = this.resolveMaterial.uniforms;
@@ -3317,7 +3356,7 @@ class It extends Ne {
3317
3356
  e !== this.temporalPass && (this.currentMaterial.temporalPass = e, this.initRenderTargets(), this.setSize(this.width, this.height));
3318
3357
  }
3319
3358
  }
3320
- function Nt(o) {
3359
+ function Mt(o) {
3321
3360
  return {
3322
3361
  // Participating medium
3323
3362
  scatteringCoefficient: new r(1),
@@ -3338,7 +3377,7 @@ function Nt(o) {
3338
3377
  turbulenceDisplacement: new r(350)
3339
3378
  };
3340
3379
  }
3341
- function bt() {
3380
+ function Ut() {
3342
3381
  return {
3343
3382
  minLayerHeights: new r(new x()),
3344
3383
  maxLayerHeights: new r(new x()),
@@ -3364,7 +3403,7 @@ function bt() {
3364
3403
  };
3365
3404
  }
3366
3405
  const Y = [0, 0, 0, 0];
3367
- function Mt(o, e) {
3406
+ function bt(o, e) {
3368
3407
  e.packValues("altitude", o.minLayerHeights.value), e.packSums("altitude", "height", o.maxLayerHeights.value), e.packIntervalHeights(
3369
3408
  o.minIntervalHeights.value,
3370
3409
  o.maxIntervalHeights.value
@@ -3373,13 +3412,13 @@ function Mt(o, e) {
3373
3412
  e.packDensityProfiles("expTerm", t.expTerms), e.packDensityProfiles("exponent", t.exponents), e.packDensityProfiles("linearTerm", t.linearTerms), e.packDensityProfiles("constantTerm", t.constantTerms);
3374
3413
  let n = 1 / 0, a = 0, i = 1 / 0, s = 0;
3375
3414
  Y.fill(0);
3376
- for (let c = 0; c < e.length; ++c) {
3377
- const { altitude: h, height: u, shadow: d } = e[c], p = h + u;
3378
- u > 0 && (h < n && (n = h), d && h < i && (i = h), p > a && (a = p), d && p > s && (s = p)), Y[c] = d ? 1 : 0;
3415
+ for (let l = 0; l < e.length; ++l) {
3416
+ const { altitude: u, height: h, shadow: d } = e[l], p = u + h;
3417
+ h > 0 && (u < n && (n = u), d && u < i && (i = u), p > a && (a = p), d && p > s && (s = p)), Y[l] = d ? 1 : 0;
3379
3418
  }
3380
3419
  n !== 1 / 0 ? (o.minHeight.value = n, o.maxHeight.value = a) : (A(a === 0), o.minHeight.value = 0), i !== 1 / 0 ? (o.shadowBottomHeight.value = i, o.shadowTopHeight.value = s) : (A(s === 0), o.shadowBottomHeight.value = 0), o.shadowLayerMask.value.fromArray(Y);
3381
3420
  }
3382
- function Ut(o, e) {
3421
+ function Ht(o, e) {
3383
3422
  return {
3384
3423
  bottomRadius: new r(o.bottomRadius),
3385
3424
  topRadius: new r(o.topRadius),
@@ -3390,7 +3429,7 @@ function Ut(o, e) {
3390
3429
  sunDirection: new r(e.sunDirection)
3391
3430
  };
3392
3431
  }
3393
- const Ht = `uniform sampler2D cloudsBuffer;
3432
+ const zt = `uniform sampler2D cloudsBuffer;
3394
3433
 
3395
3434
  void mainImage(const vec4 inputColor, const vec2 uv, out vec4 outputColor) {
3396
3435
  #ifdef SKIP_RENDERING
@@ -3402,12 +3441,12 @@ void mainImage(const vec4 inputColor, const vec2 uv, out vec4 outputColor) {
3402
3441
  #endif // SKIP_RENDERING
3403
3442
  }
3404
3443
  `;
3405
- var Ft = Object.defineProperty, zt = (o, e, t, n) => {
3444
+ var Ft = Object.defineProperty, Wt = (o, e, t, n) => {
3406
3445
  for (var a = void 0, i = o.length - 1, s; i >= 0; i--)
3407
3446
  (s = o[i]) && (a = s(e, t, a) || a);
3408
3447
  return a && Ft(e, t, a), a;
3409
3448
  };
3410
- const I = /* @__PURE__ */ new f(), Wt = /* @__PURE__ */ new m(), Gt = [
3449
+ const I = /* @__PURE__ */ new f(), Bt = /* @__PURE__ */ new m(), Gt = [
3411
3450
  "maxIterationCount",
3412
3451
  "minStepSize",
3413
3452
  "maxStepSize",
@@ -3425,12 +3464,14 @@ const I = /* @__PURE__ */ new f(), Wt = /* @__PURE__ */ new m(), Gt = [
3425
3464
  "minShadowLengthStepSize",
3426
3465
  "maxShadowLengthRayDistance",
3427
3466
  "hazeDensityScale",
3428
- "hazeExponent"
3429
- ], Bt = [
3467
+ "hazeExponent",
3468
+ "hazeScatteringCoefficient",
3469
+ "hazeAbsorptionCoefficient"
3470
+ ], Vt = [
3430
3471
  "multiScatteringOctaves",
3431
- "accurateSunSkyIrradiance",
3472
+ "accurateSunSkyLight",
3432
3473
  "accuratePhaseFunction"
3433
- ], Vt = [
3474
+ ], kt = [
3434
3475
  "maxIterationCount",
3435
3476
  "minStepSize",
3436
3477
  "maxStepSize",
@@ -3438,11 +3479,11 @@ const I = /* @__PURE__ */ new f(), Wt = /* @__PURE__ */ new m(), Gt = [
3438
3479
  "minExtinction",
3439
3480
  "minTransmittance",
3440
3481
  "opticalDepthTailScale"
3441
- ], kt = [
3442
- "temporalJitter"
3443
3482
  ], jt = [
3444
- "temporalPass"
3483
+ "temporalJitter"
3445
3484
  ], Yt = [
3485
+ "temporalPass"
3486
+ ], Zt = [
3446
3487
  "cascadeCount",
3447
3488
  "mapSize",
3448
3489
  "maxFar",
@@ -3451,35 +3492,35 @@ const I = /* @__PURE__ */ new f(), Wt = /* @__PURE__ */ new m(), Gt = [
3451
3492
  "splitLambda"
3452
3493
  ], D = {
3453
3494
  type: "change"
3454
- }, Zt = {
3455
- resolutionScale: l.resolutionScale,
3456
- width: q.AUTO_SIZE,
3457
- height: q.AUTO_SIZE
3495
+ }, Kt = {
3496
+ resolutionScale: c.resolutionScale,
3497
+ width: K.AUTO_SIZE,
3498
+ height: K.AUTO_SIZE
3458
3499
  };
3459
3500
  class qt extends Fe {
3460
- constructor(e = new xe(), t, n = Ce.DEFAULT) {
3501
+ constructor(e = new we(), t, n = Te.DEFAULT) {
3461
3502
  var d, p, g, S;
3462
- super("CloudsEffect", Ht, {
3463
- attributes: ze.DEPTH,
3503
+ super("CloudsEffect", zt, {
3504
+ attributes: We.DEPTH,
3464
3505
  uniforms: /* @__PURE__ */ new Map([["cloudsBuffer", new r(null)]])
3465
- }), this.camera = e, this.atmosphere = n, this.cloudLayers = K.DEFAULT.clone(), this.correctAltitude = !0, this.localWeatherRepeat = new m().setScalar(100), this.localWeatherOffset = new m(), this.shapeRepeat = new f().setScalar(3e-4), this.shapeOffset = new f(), this.shapeDetailRepeat = new f().setScalar(6e-3), this.shapeDetailOffset = new f(), this.turbulenceRepeat = new m().setScalar(20), this.ellipsoidCenter = new f(), this.ellipsoidMatrix = new v(), this.inverseEllipsoidMatrix = new v(), this.altitudeCorrection = new f(), this.sunDirection = new f(), this.localWeatherVelocity = new m(), this.shapeVelocity = new f(), this.shapeDetailVelocity = new f(), this._atmosphereOverlay = null, this._atmosphereShadow = null, this._atmosphereShadowLength = null, this.events = new ke(), this.frame = 0, this.shadowCascadeCount = 0, this.shadowMapSize = new m(), this.onResolutionChange = () => {
3506
+ }), this.camera = e, this.atmosphere = n, this.cloudLayers = q.DEFAULT.clone(), this.correctAltitude = !0, this.localWeatherRepeat = new m().setScalar(100), this.localWeatherOffset = new m(), this.shapeRepeat = new f().setScalar(3e-4), this.shapeOffset = new f(), this.shapeDetailRepeat = new f().setScalar(6e-3), this.shapeDetailOffset = new f(), this.turbulenceRepeat = new m().setScalar(20), this.ellipsoidCenter = new f(), this.ellipsoidMatrix = new v(), this.inverseEllipsoidMatrix = new v(), this.altitudeCorrection = new f(), this.sunDirection = new f(), this.localWeatherVelocity = new m(), this.shapeVelocity = new f(), this.shapeDetailVelocity = new f(), this._atmosphereOverlay = null, this._atmosphereShadow = null, this._atmosphereShadowLength = null, this.events = new je(), this.frame = 0, this.shadowCascadeCount = 0, this.shadowMapSize = new m(), this.onResolutionChange = () => {
3466
3507
  this.setSize(this.resolution.baseWidth, this.resolution.baseHeight);
3467
3508
  }, this.skipRendering = !0;
3468
3509
  const {
3469
3510
  resolutionScale: a,
3470
3511
  width: i,
3471
3512
  height: s,
3472
- resolutionX: c = i,
3473
- resolutionY: h = s
3513
+ resolutionX: l = i,
3514
+ resolutionY: u = s
3474
3515
  } = {
3475
- ...Zt,
3516
+ ...Kt,
3476
3517
  ...t
3477
3518
  };
3478
3519
  this.shadowMaps = new ht({
3479
- cascadeCount: l.shadow.cascadeCount,
3480
- mapSize: l.shadow.mapSize,
3520
+ cascadeCount: c.shadow.cascadeCount,
3521
+ mapSize: c.shadow.mapSize,
3481
3522
  splitLambda: 0.6
3482
- }), this.parameterUniforms = Nt({
3523
+ }), this.parameterUniforms = Mt({
3483
3524
  localWeatherTexture: ((d = this.proceduralLocalWeather) == null ? void 0 : d.texture) ?? null,
3484
3525
  localWeatherRepeat: this.localWeatherRepeat,
3485
3526
  localWeatherOffset: this.localWeatherOffset,
@@ -3491,43 +3532,43 @@ class qt extends Fe {
3491
3532
  shapeDetailOffset: this.shapeDetailOffset,
3492
3533
  turbulenceTexture: ((S = this.proceduralTurbulence) == null ? void 0 : S.texture) ?? null,
3493
3534
  turbulenceRepeat: this.turbulenceRepeat
3494
- }), this.layerUniforms = bt(), this.atmosphereUniforms = Ut(n, {
3535
+ }), this.layerUniforms = Ut(), this.atmosphereUniforms = Ht(n, {
3495
3536
  ellipsoidCenter: this.ellipsoidCenter,
3496
3537
  ellipsoidMatrix: this.ellipsoidMatrix,
3497
3538
  inverseEllipsoidMatrix: this.inverseEllipsoidMatrix,
3498
3539
  altitudeCorrection: this.altitudeCorrection,
3499
3540
  sunDirection: this.sunDirection
3500
3541
  });
3501
- const u = {
3542
+ const h = {
3502
3543
  shadow: this.shadowMaps,
3503
3544
  parameterUniforms: this.parameterUniforms,
3504
3545
  layerUniforms: this.layerUniforms,
3505
3546
  atmosphereUniforms: this.atmosphereUniforms
3506
3547
  };
3507
- this.shadowPass = new It(u), this.shadowPass.mainCamera = e, this.cloudsPass = new Ct(u, n), this.cloudsPass.mainCamera = e, this.clouds = he(
3508
- ue(
3548
+ this.shadowPass = new Nt(h), this.shadowPass.mainCamera = e, this.cloudsPass = new Tt(h, n), this.cloudsPass.mainCamera = e, this.clouds = ue(
3549
+ he(
3509
3550
  {},
3510
3551
  this.cloudsPass.currentMaterial,
3511
3552
  Gt
3512
3553
  ),
3513
3554
  this.cloudsPass.currentMaterial,
3514
- Bt
3515
- ), this.shadow = he(
3516
- ue(
3555
+ Vt
3556
+ ), this.shadow = ue(
3557
+ he(
3517
3558
  {},
3518
3559
  this.shadowPass.currentMaterial,
3519
- Vt
3560
+ kt
3520
3561
  ),
3521
3562
  this.shadowPass.currentMaterial,
3522
- kt,
3523
- this.shadowPass,
3524
3563
  jt,
3564
+ this.shadowPass,
3565
+ Yt,
3525
3566
  this.shadowMaps,
3526
- Yt
3527
- ), this.resolution = new q(
3567
+ Zt
3568
+ ), this.resolution = new K(
3528
3569
  this,
3529
- c,
3530
- h,
3570
+ l,
3571
+ u,
3531
3572
  a
3532
3573
  ), this.resolution.addEventListener("change", this.onResolutionChange);
3533
3574
  }
@@ -3541,17 +3582,17 @@ class qt extends Fe {
3541
3582
  this.shadowPass.initialize(e, t, n), this.cloudsPass.initialize(e, t, n);
3542
3583
  }
3543
3584
  updateSharedUniforms(e) {
3544
- Mt(this.layerUniforms, this.cloudLayers);
3585
+ bt(this.layerUniforms, this.cloudLayers);
3545
3586
  const { parameterUniforms: t } = this;
3546
3587
  t.localWeatherOffset.value.add(
3547
- Wt.copy(this.localWeatherVelocity).multiplyScalar(e)
3588
+ Bt.copy(this.localWeatherVelocity).multiplyScalar(e)
3548
3589
  ), t.shapeOffset.value.add(
3549
3590
  I.copy(this.shapeVelocity).multiplyScalar(e)
3550
3591
  ), t.shapeDetailOffset.value.add(
3551
3592
  I.copy(this.shapeDetailVelocity).multiplyScalar(e)
3552
3593
  );
3553
3594
  const n = this.inverseEllipsoidMatrix.copy(this.ellipsoidMatrix).invert(), a = this.camera.getWorldPosition(I).applyMatrix4(n).sub(this.ellipsoidCenter), i = this.altitudeCorrection;
3554
- this.correctAltitude ? Ye(
3595
+ this.correctAltitude ? Ze(
3555
3596
  a,
3556
3597
  this.atmosphere.bottomRadius,
3557
3598
  this.ellipsoid,
@@ -3561,14 +3602,14 @@ class qt extends Fe {
3561
3602
  const s = this.ellipsoid.getSurfaceNormal(
3562
3603
  a,
3563
3604
  I
3564
- ), c = this.sunDirection.dot(s), h = Te(1e6, 1e3, c);
3605
+ ), l = this.sunDirection.dot(s), u = De(1e6, 1e3, l);
3565
3606
  this.shadowMaps.update(
3566
3607
  this.camera,
3567
3608
  // The sun direction must be rotated with the ellipsoid to ensure the
3568
3609
  // frusta are constructed correctly. Note this affects the transformation
3569
3610
  // in the shadow shader.
3570
3611
  I.copy(this.sunDirection).applyMatrix4(this.ellipsoidMatrix),
3571
- h
3612
+ u
3572
3613
  );
3573
3614
  }
3574
3615
  updateWeatherTextureChannels() {
@@ -3576,11 +3617,11 @@ class qt extends Fe {
3576
3617
  this.cloudsPass.currentMaterial.localWeatherChannels = e, this.shadowPass.currentMaterial.localWeatherChannels = e;
3577
3618
  }
3578
3619
  updateAtmosphereComposition() {
3579
- const { shadowMaps: e, shadowPass: t, cloudsPass: n } = this, a = t.currentMaterial.uniforms, i = n.currentMaterial.uniforms, s = this._atmosphereOverlay, c = Object.assign(this._atmosphereOverlay ?? {}, {
3620
+ const { shadowMaps: e, shadowPass: t, cloudsPass: n } = this, a = t.currentMaterial.uniforms, i = n.currentMaterial.uniforms, s = this._atmosphereOverlay, l = Object.assign(this._atmosphereOverlay ?? {}, {
3580
3621
  map: n.outputBuffer
3581
3622
  });
3582
- s !== c && (this._atmosphereOverlay = c, D.target = this, D.property = "atmosphereOverlay", this.events.dispatchEvent(D));
3583
- const h = this._atmosphereShadow, u = Object.assign(this._atmosphereShadow ?? {}, {
3623
+ s !== l && (this._atmosphereOverlay = l, D.target = this, D.property = "atmosphereOverlay", this.events.dispatchEvent(D));
3624
+ const u = this._atmosphereShadow, h = Object.assign(this._atmosphereShadow ?? {}, {
3584
3625
  map: t.outputBuffer,
3585
3626
  mapSize: e.mapSize,
3586
3627
  cascadeCount: e.cascadeCount,
@@ -3590,20 +3631,20 @@ class qt extends Fe {
3590
3631
  far: e.far,
3591
3632
  topHeight: i.shadowTopHeight.value
3592
3633
  });
3593
- h !== u && (this._atmosphereShadow = u, D.target = this, D.property = "atmosphereShadow", this.events.dispatchEvent(D));
3634
+ u !== h && (this._atmosphereShadow = h, D.target = this, D.property = "atmosphereShadow", this.events.dispatchEvent(D));
3594
3635
  const d = this._atmosphereShadowLength, p = n.shadowLengthBuffer != null ? Object.assign(this._atmosphereShadowLength ?? {}, {
3595
3636
  map: n.shadowLengthBuffer
3596
3637
  }) : null;
3597
3638
  d !== p && (this._atmosphereShadowLength = p, D.target = this, D.property = "atmosphereShadowLength", this.events.dispatchEvent(D));
3598
3639
  }
3599
3640
  update(e, t, n = 0) {
3600
- var c, h, u, d;
3641
+ var l, u, h, d;
3601
3642
  const { shadowMaps: a, shadowPass: i, cloudsPass: s } = this;
3602
3643
  if (a.cascadeCount !== this.shadowCascadeCount || !a.mapSize.equals(this.shadowMapSize)) {
3603
3644
  const { width: p, height: g } = a.mapSize, S = a.cascadeCount;
3604
3645
  this.shadowMapSize.set(p, g), this.shadowCascadeCount = S, i.setSize(p, g, S), s.setShadowSize(p, g, S);
3605
3646
  }
3606
- (c = this.proceduralLocalWeather) == null || c.render(e, n), (h = this.proceduralShape) == null || h.render(e, n), (u = this.proceduralShapeDetail) == null || u.render(e, n), (d = this.proceduralTurbulence) == null || d.render(e, n), ++this.frame, this.updateSharedUniforms(n), this.updateWeatherTextureChannels(), i.update(e, this.frame, n), s.shadowBuffer = i.outputBuffer, s.update(e, this.frame, n), this.updateAtmosphereComposition(), this.uniforms.get("cloudsBuffer").value = this.cloudsPass.outputBuffer;
3647
+ (l = this.proceduralLocalWeather) == null || l.render(e, n), (u = this.proceduralShape) == null || u.render(e, n), (h = this.proceduralShapeDetail) == null || h.render(e, n), (d = this.proceduralTurbulence) == null || d.render(e, n), ++this.frame, this.updateSharedUniforms(n), this.updateWeatherTextureChannels(), i.update(e, this.frame, n), s.shadowBuffer = i.outputBuffer, s.update(e, this.frame, n), this.updateAtmosphereComposition(), this.uniforms.get("cloudsBuffer").value = this.cloudsPass.outputBuffer;
3607
3648
  }
3608
3649
  setSize(e, t) {
3609
3650
  const { resolution: n } = this;
@@ -3616,7 +3657,7 @@ class qt extends Fe {
3616
3657
  }
3617
3658
  // eslint-disable-next-line accessor-pairs
3618
3659
  set qualityPreset(e) {
3619
- const { clouds: t, shadow: n, ...a } = dt[e];
3660
+ const { clouds: t, shadow: n, ...a } = pt[e];
3620
3661
  Object.assign(this, a), Object.assign(this.clouds, t), Object.assign(this.shadow, n);
3621
3662
  }
3622
3663
  // Textures
@@ -3731,17 +3772,33 @@ class qt extends Fe {
3731
3772
  set scatterAnisotropyMix(e) {
3732
3773
  this.cloudsPass.currentMaterial.scatterAnisotropyMix = e;
3733
3774
  }
3775
+ /** @deprecated Use skyLightScale instead. */
3734
3776
  get skyIrradianceScale() {
3735
- return this.cloudsPass.currentMaterial.uniforms.skyIrradianceScale.value;
3777
+ return this.skyLightScale;
3736
3778
  }
3779
+ /** @deprecated Use skyLightScale instead. */
3737
3780
  set skyIrradianceScale(e) {
3738
- this.cloudsPass.currentMaterial.uniforms.skyIrradianceScale.value = e;
3781
+ this.skyLightScale = e;
3782
+ }
3783
+ get skyLightScale() {
3784
+ return this.cloudsPass.currentMaterial.uniforms.skyLightScale.value;
3785
+ }
3786
+ set skyLightScale(e) {
3787
+ this.cloudsPass.currentMaterial.uniforms.skyLightScale.value = e;
3739
3788
  }
3789
+ /** @deprecated Use groundBounceScale instead. */
3740
3790
  get groundIrradianceScale() {
3741
- return this.cloudsPass.currentMaterial.uniforms.groundIrradianceScale.value;
3791
+ return this.groundBounceScale;
3742
3792
  }
3793
+ /** @deprecated Use groundBounceScale instead. */
3743
3794
  set groundIrradianceScale(e) {
3744
- this.cloudsPass.currentMaterial.uniforms.groundIrradianceScale.value = e;
3795
+ this.groundBounceScale = e;
3796
+ }
3797
+ get groundBounceScale() {
3798
+ return this.cloudsPass.currentMaterial.uniforms.groundBounceScale.value;
3799
+ }
3800
+ set groundBounceScale(e) {
3801
+ this.cloudsPass.currentMaterial.uniforms.groundBounceScale.value = e;
3745
3802
  }
3746
3803
  get powderScale() {
3747
3804
  return this.cloudsPass.currentMaterial.uniforms.powderScale.value;
@@ -3784,18 +3841,24 @@ class qt extends Fe {
3784
3841
  set transmittanceTexture(e) {
3785
3842
  this.cloudsPass.currentMaterial.transmittanceTexture = e;
3786
3843
  }
3844
+ get singleMieScatteringTexture() {
3845
+ return this.cloudsPass.currentMaterial.singleMieScatteringTexture;
3846
+ }
3847
+ set singleMieScatteringTexture(e) {
3848
+ this.cloudsPass.currentMaterial.singleMieScatteringTexture = e;
3849
+ }
3850
+ get higherOrderScatteringTexture() {
3851
+ return this.cloudsPass.currentMaterial.higherOrderScatteringTexture;
3852
+ }
3853
+ set higherOrderScatteringTexture(e) {
3854
+ this.cloudsPass.currentMaterial.higherOrderScatteringTexture = e;
3855
+ }
3787
3856
  get ellipsoid() {
3788
3857
  return this.cloudsPass.currentMaterial.ellipsoid;
3789
3858
  }
3790
3859
  set ellipsoid(e) {
3791
3860
  this.cloudsPass.currentMaterial.ellipsoid = e;
3792
3861
  }
3793
- get photometric() {
3794
- return this.cloudsPass.currentMaterial.photometric;
3795
- }
3796
- set photometric(e) {
3797
- this.cloudsPass.currentMaterial.photometric = e;
3798
- }
3799
3862
  get sunAngularRadius() {
3800
3863
  return this.cloudsPass.currentMaterial.sunAngularRadius;
3801
3864
  }
@@ -3803,21 +3866,21 @@ class qt extends Fe {
3803
3866
  this.cloudsPass.currentMaterial.sunAngularRadius = e;
3804
3867
  }
3805
3868
  }
3806
- zt([
3869
+ Wt([
3807
3870
  C("SKIP_RENDERING")
3808
3871
  ], qt.prototype, "skipRendering");
3809
- const tn = 128, nn = 32, V = "45a1c6c1bb9fd38b3680fd120795ff4c32df68ff", an = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${V}/packages/clouds/assets/local_weather.png`, rn = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${V}/packages/clouds/assets/shape.bin`, on = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${V}/packages/clouds/assets/shape_detail.bin`, sn = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${V}/packages/clouds/assets/turbulence.png`;
3872
+ const nn = 128, an = 32, V = "45a1c6c1bb9fd38b3680fd120795ff4c32df68ff", rn = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${V}/packages/clouds/assets/local_weather.png`, on = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${V}/packages/clouds/assets/shape.bin`, sn = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${V}/packages/clouds/assets/shape_detail.bin`, cn = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${V}/packages/clouds/assets/turbulence.png`;
3810
3873
  export {
3811
- tn as C,
3812
- an as D,
3813
- nn as a,
3874
+ nn as C,
3875
+ rn as D,
3876
+ an as a,
3814
3877
  T as b,
3815
- K as c,
3816
- Zt as d,
3878
+ q as c,
3879
+ Kt as d,
3817
3880
  qt as e,
3818
- rn as f,
3819
- on as g,
3820
- sn as h,
3821
- B as i
3881
+ on as f,
3882
+ sn as g,
3883
+ cn as h,
3884
+ G as i
3822
3885
  };
3823
3886
  //# sourceMappingURL=shared.js.map