@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takram/three-clouds",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "A Three.js and R3F implementation of geospatial volumetric clouds",
5
5
  "keywords": [
6
6
  "three",
@@ -45,8 +45,8 @@
45
45
  "README.md"
46
46
  ],
47
47
  "dependencies": {
48
- "@takram/three-atmosphere": "0.11.2",
49
- "@takram/three-geospatial": "0.2.1",
48
+ "@takram/three-atmosphere": "0.13.0",
49
+ "@takram/three-geospatial": "0.3.0",
50
50
  "tiny-invariant": "^1.3.3",
51
51
  "type-fest": "^4.34.1"
52
52
  },
@@ -1,7 +1,7 @@
1
- import { type Vector3, type Vector4 } from 'three'
1
+ import type { Vector3, Vector4 } from 'three'
2
2
 
3
3
  import { CloudLayer, type CloudLayerLike } from './CloudLayer'
4
- import { type DensityProfileLike } from './DensityProfile'
4
+ import type { DensityProfileLike } from './DensityProfile'
5
5
 
6
6
  type NumericKey = keyof {
7
7
  [P in keyof CloudLayer as number extends CloudLayer[P] ? P : never]: any
@@ -8,7 +8,6 @@ import {
8
8
  Uniform,
9
9
  Vector2,
10
10
  Vector3,
11
- type DataTexture,
12
11
  type DepthPackingStrategies,
13
12
  type PerspectiveCamera,
14
13
  type TextureDataType,
@@ -36,18 +35,12 @@ import {
36
35
 
37
36
  import { CascadedShadowMaps } from './CascadedShadowMaps'
38
37
  import { CloudLayers } from './CloudLayers'
39
- import {
40
- type CloudsMaterial,
41
- type CloudsMaterialUniforms
42
- } from './CloudsMaterial'
38
+ import type { CloudsMaterial, CloudsMaterialUniforms } from './CloudsMaterial'
43
39
  import { CloudsPass } from './CloudsPass'
44
- import { type Procedural3DTexture } from './Procedural3DTexture'
45
- import { type ProceduralTexture } from './ProceduralTexture'
40
+ import type { Procedural3DTexture } from './Procedural3DTexture'
41
+ import type { ProceduralTexture } from './ProceduralTexture'
46
42
  import { defaults, qualityPresets, type QualityPreset } from './qualityPresets'
47
- import {
48
- type ShadowMaterial,
49
- type ShadowMaterialUniforms
50
- } from './ShadowMaterial'
43
+ import type { ShadowMaterial, ShadowMaterialUniforms } from './ShadowMaterial'
51
44
  import { ShadowPass } from './ShadowPass'
52
45
  import {
53
46
  createAtmosphereUniforms,
@@ -82,13 +75,15 @@ const cloudsUniformKeys = [
82
75
  'minShadowLengthStepSize',
83
76
  'maxShadowLengthRayDistance',
84
77
  'hazeDensityScale',
85
- 'hazeExponent'
78
+ 'hazeExponent',
79
+ 'hazeScatteringCoefficient',
80
+ 'hazeAbsorptionCoefficient'
86
81
  ] as const satisfies Array<keyof CloudsMaterialUniforms>
87
82
 
88
83
  // prettier-ignore
89
84
  const cloudsMaterialParameterKeys = [
90
85
  'multiScatteringOctaves',
91
- 'accurateSunSkyIrradiance',
86
+ 'accurateSunSkyLight',
92
87
  'accuratePhaseFunction',
93
88
  ] as const satisfies Array<keyof CloudsMaterial>
94
89
 
@@ -706,20 +701,40 @@ export class CloudsEffect extends Effect {
706
701
  this.cloudsPass.currentMaterial.scatterAnisotropyMix = value
707
702
  }
708
703
 
704
+ /** @deprecated Use skyLightScale instead. */
709
705
  get skyIrradianceScale(): number {
710
- return this.cloudsPass.currentMaterial.uniforms.skyIrradianceScale.value
706
+ return this.skyLightScale
711
707
  }
712
708
 
709
+ /** @deprecated Use skyLightScale instead. */
713
710
  set skyIrradianceScale(value: number) {
714
- this.cloudsPass.currentMaterial.uniforms.skyIrradianceScale.value = value
711
+ this.skyLightScale = value
712
+ }
713
+
714
+ get skyLightScale(): number {
715
+ return this.cloudsPass.currentMaterial.uniforms.skyLightScale.value
716
+ }
717
+
718
+ set skyLightScale(value: number) {
719
+ this.cloudsPass.currentMaterial.uniforms.skyLightScale.value = value
715
720
  }
716
721
 
722
+ /** @deprecated Use groundBounceScale instead. */
717
723
  get groundIrradianceScale(): number {
718
- return this.cloudsPass.currentMaterial.uniforms.groundIrradianceScale.value
724
+ return this.groundBounceScale
719
725
  }
720
726
 
727
+ /** @deprecated Use groundBounceScale instead. */
721
728
  set groundIrradianceScale(value: number) {
722
- this.cloudsPass.currentMaterial.uniforms.groundIrradianceScale.value = value
729
+ this.groundBounceScale = value
730
+ }
731
+
732
+ get groundBounceScale(): number {
733
+ return this.cloudsPass.currentMaterial.uniforms.groundBounceScale.value
734
+ }
735
+
736
+ set groundBounceScale(value: number) {
737
+ this.cloudsPass.currentMaterial.uniforms.groundBounceScale.value = value
723
738
  }
724
739
 
725
740
  get powderScale(): number {
@@ -754,11 +769,11 @@ export class CloudsEffect extends Effect {
754
769
 
755
770
  // Atmosphere parameters
756
771
 
757
- get irradianceTexture(): DataTexture | null {
772
+ get irradianceTexture(): Texture | null {
758
773
  return this.cloudsPass.currentMaterial.irradianceTexture
759
774
  }
760
775
 
761
- set irradianceTexture(value: DataTexture | null) {
776
+ set irradianceTexture(value: Texture | null) {
762
777
  this.cloudsPass.currentMaterial.irradianceTexture = value
763
778
  }
764
779
 
@@ -770,28 +785,36 @@ export class CloudsEffect extends Effect {
770
785
  this.cloudsPass.currentMaterial.scatteringTexture = value
771
786
  }
772
787
 
773
- get transmittanceTexture(): DataTexture | null {
788
+ get transmittanceTexture(): Texture | null {
774
789
  return this.cloudsPass.currentMaterial.transmittanceTexture
775
790
  }
776
791
 
777
- set transmittanceTexture(value: DataTexture | null) {
792
+ set transmittanceTexture(value: Texture | null) {
778
793
  this.cloudsPass.currentMaterial.transmittanceTexture = value
779
794
  }
780
795
 
781
- get ellipsoid(): Ellipsoid {
782
- return this.cloudsPass.currentMaterial.ellipsoid
796
+ get singleMieScatteringTexture(): Data3DTexture | null {
797
+ return this.cloudsPass.currentMaterial.singleMieScatteringTexture
783
798
  }
784
799
 
785
- set ellipsoid(value: Ellipsoid) {
786
- this.cloudsPass.currentMaterial.ellipsoid = value
800
+ set singleMieScatteringTexture(value: Data3DTexture | null) {
801
+ this.cloudsPass.currentMaterial.singleMieScatteringTexture = value
787
802
  }
788
803
 
789
- get photometric(): boolean {
790
- return this.cloudsPass.currentMaterial.photometric
804
+ get higherOrderScatteringTexture(): Data3DTexture | null {
805
+ return this.cloudsPass.currentMaterial.higherOrderScatteringTexture
791
806
  }
792
807
 
793
- set photometric(value: boolean) {
794
- this.cloudsPass.currentMaterial.photometric = value
808
+ set higherOrderScatteringTexture(value: Data3DTexture | null) {
809
+ this.cloudsPass.currentMaterial.higherOrderScatteringTexture = value
810
+ }
811
+
812
+ get ellipsoid(): Ellipsoid {
813
+ return this.cloudsPass.currentMaterial.ellipsoid
814
+ }
815
+
816
+ set ellipsoid(value: Ellipsoid) {
817
+ this.cloudsPass.currentMaterial.ellipsoid = value
795
818
  }
796
819
 
797
820
  get sunAngularRadius(): number {
@@ -24,9 +24,10 @@ import {
24
24
  type AtmosphereMaterialBaseUniforms
25
25
  } from '@takram/three-atmosphere'
26
26
  import {
27
- parameters as atmosphereParameters,
28
- functions
29
- } from '@takram/three-atmosphere/shaders'
27
+ common,
28
+ definitions,
29
+ runtime
30
+ } from '@takram/three-atmosphere/shaders/bruneton'
30
31
  import {
31
32
  assertType,
32
33
  define,
@@ -50,10 +51,10 @@ import {
50
51
 
51
52
  import { bayerOffsets } from './bayer'
52
53
  import { defaults } from './qualityPresets'
53
- import {
54
- type AtmosphereUniforms,
55
- type CloudLayerUniforms,
56
- type CloudParameterUniforms
54
+ import type {
55
+ AtmosphereUniforms,
56
+ CloudLayerUniforms,
57
+ CloudParameterUniforms
57
58
  } from './uniforms'
58
59
 
59
60
  import fragmentShader from './shaders/clouds.frag?raw'
@@ -97,9 +98,8 @@ export interface CloudsMaterialUniforms
97
98
  stbnTexture: Uniform<Data3DTexture | null>
98
99
 
99
100
  // Scattering
100
- albedo: Uniform<Vector3>
101
- skyIrradianceScale: Uniform<number>
102
- groundIrradianceScale: Uniform<number>
101
+ skyLightScale: Uniform<number>
102
+ groundBounceScale: Uniform<number>
103
103
  powderScale: Uniform<number>
104
104
  powderExponent: Uniform<number>
105
105
 
@@ -135,6 +135,8 @@ export interface CloudsMaterialUniforms
135
135
  // Haze
136
136
  hazeDensityScale: Uniform<number>
137
137
  hazeExponent: Uniform<number>
138
+ hazeScatteringCoefficient: Uniform<number>
139
+ hazeAbsorptionCoefficient: Uniform<number>
138
140
  }
139
141
 
140
142
  export class CloudsMaterial extends AtmosphereMaterialBase {
@@ -159,8 +161,11 @@ export class CloudsMaterial extends AtmosphereMaterialBase {
159
161
  glslVersion: GLSL3,
160
162
  vertexShader: resolveIncludes(vertexShader, {
161
163
  atmosphere: {
162
- parameters: atmosphereParameters,
163
- functions
164
+ bruneton: {
165
+ common,
166
+ definitions,
167
+ runtime
168
+ }
164
169
  },
165
170
  types
166
171
  }),
@@ -177,8 +182,11 @@ export class CloudsMaterial extends AtmosphereMaterialBase {
177
182
  vogelDisk
178
183
  },
179
184
  atmosphere: {
180
- parameters: atmosphereParameters,
181
- functions
185
+ bruneton: {
186
+ common,
187
+ definitions,
188
+ runtime
189
+ }
182
190
  },
183
191
  types,
184
192
  parameters,
@@ -207,9 +215,8 @@ export class CloudsMaterial extends AtmosphereMaterialBase {
207
215
  stbnTexture: new Uniform(null),
208
216
 
209
217
  // Scattering
210
- albedo: new Uniform(new Vector3()),
211
- skyIrradianceScale: new Uniform(2.5),
212
- groundIrradianceScale: new Uniform(3),
218
+ skyLightScale: new Uniform(1),
219
+ groundBounceScale: new Uniform(1),
213
220
  powderScale: new Uniform(0.8),
214
221
  powderExponent: new Uniform(150),
215
222
 
@@ -249,7 +256,9 @@ export class CloudsMaterial extends AtmosphereMaterialBase {
249
256
 
250
257
  // Haze
251
258
  hazeDensityScale: new Uniform(3e-5),
252
- hazeExponent: new Uniform(1e-3)
259
+ hazeExponent: new Uniform(1e-3),
260
+ hazeScatteringCoefficient: new Uniform(0.9),
261
+ hazeAbsorptionCoefficient: new Uniform(0.5),
253
262
  } satisfies Partial<AtmosphereMaterialBaseUniforms> &
254
263
  CloudsMaterialUniforms
255
264
  },
@@ -268,12 +277,16 @@ export class CloudsMaterial extends AtmosphereMaterialBase {
268
277
  // Disable onBeforeRender in AtmosphereMaterialBase because we're rendering
269
278
  // into fullscreen quad with another camera for the scene projection.
270
279
 
271
- const uniforms = this.uniforms
272
- uniforms.albedo.value.setScalar(
273
- uniforms.scatteringCoefficient.value /
274
- (uniforms.absorptionCoefficient.value +
275
- uniforms.scatteringCoefficient.value)
276
- )
280
+ const prevLogarithmicDepthBuffer = this.defines.USE_LOGDEPTHBUF != null
281
+ const nextLogarithmicDepthBuffer =
282
+ renderer.capabilities.logarithmicDepthBuffer
283
+ if (nextLogarithmicDepthBuffer !== prevLogarithmicDepthBuffer) {
284
+ if (nextLogarithmicDepthBuffer) {
285
+ this.defines.USE_LOGDEPTHBUF = '1'
286
+ } else {
287
+ delete this.defines.USE_LOGDEPTHBUF
288
+ }
289
+ }
277
290
 
278
291
  const prevPowder = this.defines.POWDER != null
279
292
  const nextPowder = this.uniforms.powderScale.value > 0
@@ -286,15 +299,15 @@ export class CloudsMaterial extends AtmosphereMaterialBase {
286
299
  this.needsUpdate = true
287
300
  }
288
301
 
289
- const prevGroundIrradiance = this.defines.GROUND_IRRADIANCE != null
302
+ const prevGroundIrradiance = this.defines.GROUND_BOUNCE != null
290
303
  const nextGroundIrradiance =
291
- this.uniforms.groundIrradianceScale.value > 0 &&
304
+ this.uniforms.groundBounceScale.value > 0 &&
292
305
  this.uniforms.maxIterationCountToGround.value > 0
293
306
  if (nextGroundIrradiance !== prevGroundIrradiance) {
294
307
  if (nextPowder) {
295
- this.defines.GROUND_IRRADIANCE = '1'
308
+ this.defines.GROUND_BOUNCE = '1'
296
309
  } else {
297
- delete this.defines.GROUND_IRRADIANCE
310
+ delete this.defines.GROUND_BOUNCE
298
311
  }
299
312
  this.needsUpdate = true
300
313
  }
@@ -441,8 +454,18 @@ export class CloudsMaterial extends AtmosphereMaterialBase {
441
454
  @defineInt('MULTI_SCATTERING_OCTAVES', { min: 1, max: 12 })
442
455
  multiScatteringOctaves: number = defaults.clouds.multiScatteringOctaves
443
456
 
444
- @define('ACCURATE_SUN_SKY_IRRADIANCE')
445
- accurateSunSkyIrradiance: boolean = defaults.clouds.accurateSunSkyIrradiance
457
+ /** @deprecated Use accurateSunSkyLight instead. */
458
+ get accurateSunSkyIrradiance(): boolean {
459
+ return this.accurateSunSkyLight
460
+ }
461
+
462
+ /** @deprecated Use accurateSunSkyLight instead. */
463
+ set accurateSunSkyIrradiance(value: boolean) {
464
+ this.accurateSunSkyLight = value
465
+ }
466
+
467
+ @define('ACCURATE_SUN_SKY_LIGHT')
468
+ accurateSunSkyLight: boolean = defaults.clouds.accurateSunSkyLight
446
469
 
447
470
  @define('ACCURATE_PHASE_FUNCTION')
448
471
  accuratePhaseFunction: boolean = defaults.clouds.accuratePhaseFunction
package/src/CloudsPass.ts CHANGED
@@ -12,16 +12,16 @@ import {
12
12
  type WebGLRenderer
13
13
  } from 'three'
14
14
 
15
- import { type AtmosphereParameters } from '@takram/three-atmosphere'
15
+ import type { AtmosphereParameters } from '@takram/three-atmosphere'
16
16
 
17
17
  import { CloudsMaterial } from './CloudsMaterial'
18
18
  import { CloudsResolveMaterial } from './CloudsResolveMaterial'
19
19
  import { PassBase, type PassBaseOptions } from './PassBase'
20
20
  import { defaults } from './qualityPresets'
21
- import {
22
- type AtmosphereUniforms,
23
- type CloudLayerUniforms,
24
- type CloudParameterUniforms
21
+ import type {
22
+ AtmosphereUniforms,
23
+ CloudLayerUniforms,
24
+ CloudParameterUniforms
25
25
  } from './uniforms'
26
26
 
27
27
  type RenderTarget = WebGLRenderTarget & {
@@ -43,7 +43,6 @@ function createRenderTarget(
43
43
  shadowLength?: Texture
44
44
  } = new WebGLRenderTarget(1, 1, {
45
45
  depthBuffer: false,
46
- stencilBuffer: false,
47
46
  type: HalfFloatType
48
47
  })
49
48
  renderTarget.texture.minFilter = LinearFilter
package/src/PassBase.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Pass } from 'postprocessing'
2
2
  import { Camera } from 'three'
3
3
 
4
- import { type CascadedShadowMaps } from './CascadedShadowMaps'
4
+ import type { CascadedShadowMaps } from './CascadedShadowMaps'
5
5
 
6
6
  export interface PassBaseOptions {
7
7
  shadow: CascadedShadowMaps
@@ -14,7 +14,7 @@ import {
14
14
  type WebGLRenderer
15
15
  } from 'three'
16
16
 
17
- import { type ProceduralTexture } from './ProceduralTexture'
17
+ import type { ProceduralTexture } from './ProceduralTexture'
18
18
 
19
19
  export type Procedural3DTexture = ProceduralTexture<Data3DTexture>
20
20
 
@@ -53,7 +53,6 @@ export class Procedural3DTextureBase implements Procedural3DTexture {
53
53
 
54
54
  this.renderTarget = new WebGL3DRenderTarget(size, size, size, {
55
55
  depthBuffer: false,
56
- stencilBuffer: false,
57
56
  format: RedFormat
58
57
  })
59
58
  const texture = this.renderTarget.texture
@@ -79,13 +78,12 @@ export class Procedural3DTextureBase implements Procedural3DTexture {
79
78
 
80
79
  // Unfortunately, rendering into 3D target requires as many draw calls as
81
80
  // the value of "size".
82
- const renderTarget = renderer.getRenderTarget()
83
81
  for (let layer = 0; layer < this.size; ++layer) {
84
82
  this.material.uniforms.layer.value = layer / this.size
85
83
  renderer.setRenderTarget(this.renderTarget, layer)
86
84
  renderer.render(this.mesh, this.camera)
87
85
  }
88
- renderer.setRenderTarget(renderTarget)
86
+ renderer.setRenderTarget(null)
89
87
  }
90
88
 
91
89
  get texture(): Data3DTexture {
@@ -58,7 +58,6 @@ export class ProceduralTextureBase implements ProceduralTexture {
58
58
 
59
59
  this.renderTarget = new WebGLRenderTarget(size, size, {
60
60
  depthBuffer: false,
61
- stencilBuffer: false,
62
61
  format: RGBAFormat
63
62
  })
64
63
  const texture = this.renderTarget.texture
@@ -82,10 +81,9 @@ export class ProceduralTextureBase implements ProceduralTexture {
82
81
  }
83
82
  this.needsRender = false
84
83
 
85
- const renderTarget = renderer.getRenderTarget()
86
84
  renderer.setRenderTarget(this.renderTarget)
87
85
  renderer.render(this.mesh, this.camera)
88
- renderer.setRenderTarget(renderTarget)
86
+ renderer.setRenderTarget(null)
89
87
  }
90
88
 
91
89
  get texture(): Texture {
@@ -1,9 +1,9 @@
1
1
  import { ShaderPass, type CopyMaterial } from 'postprocessing'
2
- import {
3
- type Uniform,
4
- type WebGLArrayRenderTarget,
5
- type WebGLRenderer,
6
- type WebGLRenderTarget
2
+ import type {
3
+ Uniform,
4
+ WebGLArrayRenderTarget,
5
+ WebGLRenderer,
6
+ WebGLRenderTarget
7
7
  } from 'three'
8
8
 
9
9
  import { setArrayRenderTargetLayers } from './helpers/setArrayRenderTargetLayers'
@@ -17,10 +17,10 @@ import {
17
17
  import { math, raySphereIntersection } from '@takram/three-geospatial/shaders'
18
18
 
19
19
  import { defaults } from './qualityPresets'
20
- import {
21
- type AtmosphereUniforms,
22
- type CloudLayerUniforms,
23
- type CloudParameterUniforms
20
+ import type {
21
+ AtmosphereUniforms,
22
+ CloudLayerUniforms,
23
+ CloudParameterUniforms
24
24
  } from './uniforms'
25
25
 
26
26
  import clouds from './shaders/clouds.glsl?raw'
package/src/ShadowPass.ts CHANGED
@@ -12,16 +12,15 @@ import { PassBase, type PassBaseOptions } from './PassBase'
12
12
  import { ShaderArrayPass } from './ShaderArrayPass'
13
13
  import { ShadowMaterial } from './ShadowMaterial'
14
14
  import { ShadowResolveMaterial } from './ShadowResolveMaterial'
15
- import {
16
- type AtmosphereUniforms,
17
- type CloudLayerUniforms,
18
- type CloudParameterUniforms
15
+ import type {
16
+ AtmosphereUniforms,
17
+ CloudLayerUniforms,
18
+ CloudParameterUniforms
19
19
  } from './uniforms'
20
20
 
21
21
  function createRenderTarget(name: string): WebGLArrayRenderTarget {
22
22
  const renderTarget = new WebGLArrayRenderTarget(1, 1, 1, {
23
- depthBuffer: false,
24
- stencilBuffer: false
23
+ depthBuffer: false
25
24
  })
26
25
  // Constructor option doesn't work
27
26
  renderTarget.texture.type = HalfFloatType
package/src/constants.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export const CLOUD_SHAPE_TEXTURE_SIZE = 128
2
2
  export const CLOUD_SHAPE_DETAIL_TEXTURE_SIZE = 32
3
3
 
4
+ // Reference to the latest assets.
4
5
  const ref = '45a1c6c1bb9fd38b3680fd120795ff4c32df68ff'
5
6
  export const DEFAULT_LOCAL_WEATHER_URL = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${ref}/packages/clouds/assets/local_weather.png`
6
7
  export const DEFAULT_SHAPE_URL = `https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/${ref}/packages/clouds/assets/shape.bin`
@@ -1,15 +1,12 @@
1
- import { type WebGLArrayRenderTarget, type WebGLRenderer } from 'three'
1
+ import type { WebGLArrayRenderTarget, WebGLRenderer } from 'three'
2
2
  import invariant from 'tiny-invariant'
3
3
 
4
4
  export function setArrayRenderTargetLayers(
5
5
  renderer: WebGLRenderer,
6
6
  outputBuffer: WebGLArrayRenderTarget
7
7
  ): void {
8
- const glTexture = (
9
- renderer.properties.get(outputBuffer.texture) as {
10
- __webglTexture?: WebGLTexture
11
- }
12
- ).__webglTexture
8
+ const property: any = renderer.properties.get(outputBuffer.texture)
9
+ const glTexture: WebGLTexture | undefined = property.__webglTexture
13
10
 
14
11
  const gl = renderer.getContext()
15
12
  invariant(gl instanceof WebGL2RenderingContext)
@@ -1,7 +1,7 @@
1
1
  import { Vector2 } from 'three'
2
- import { type PartialDeep, type SharedUnionFieldsDeep } from 'type-fest'
2
+ import type { PartialDeep, SharedUnionFieldsDeep } from 'type-fest'
3
3
 
4
- import { type CloudsEffect } from './CloudsEffect'
4
+ import type { CloudsEffect } from './CloudsEffect'
5
5
 
6
6
  export type QualityPreset = 'low' | 'medium' | 'high' | 'ultra'
7
7
 
@@ -13,7 +13,7 @@ const values = {
13
13
  haze: true,
14
14
  clouds: {
15
15
  multiScatteringOctaves: 8,
16
- accurateSunSkyIrradiance: true,
16
+ accurateSunSkyLight: true,
17
17
  accuratePhaseFunction: false,
18
18
 
19
19
  // Primary raymarch
@@ -67,7 +67,7 @@ export const qualityPresets: Record<QualityPreset, Schema> = {
67
67
  turbulence: false, // Expensive
68
68
  clouds: {
69
69
  ...defaults.clouds,
70
- accurateSunSkyIrradiance: false, // Greatly reduces texel reads.
70
+ accurateSunSkyLight: false, // Greatly reduces texel reads.
71
71
  maxIterationCount: 200,
72
72
  minStepSize: 100,
73
73
  maxRayDistance: 1e5,
@@ -95,7 +95,7 @@ export const qualityPresets: Record<QualityPreset, Schema> = {
95
95
  ...defaults.clouds,
96
96
  minDensity: 1e-4,
97
97
  minExtinction: 1e-4,
98
- accurateSunSkyIrradiance: false,
98
+ accurateSunSkyLight: false,
99
99
  maxIterationCountToSun: 2,
100
100
  maxIterationCountToGround: 1
101
101
  },