@takram/three-clouds 0.3.0 → 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.
- package/CHANGELOG.md +19 -0
- package/README.md +16 -17
- package/build/index.cjs +9 -9
- package/build/index.cjs.map +1 -1
- package/build/index.js +70 -77
- package/build/index.js.map +1 -1
- package/build/r3f.cjs +1 -1
- package/build/r3f.cjs.map +1 -1
- package/build/r3f.js +122 -127
- package/build/r3f.js.map +1 -1
- package/build/shared.cjs +70 -55
- package/build/shared.cjs.map +1 -1
- package/build/shared.js +352 -303
- package/build/shared.js.map +1 -1
- package/package.json +3 -3
- package/src/CloudLayers.ts +2 -2
- package/src/CloudsEffect.ts +49 -28
- package/src/CloudsMaterial.ts +38 -21
- package/src/CloudsPass.ts +5 -6
- package/src/PassBase.ts +1 -1
- package/src/Procedural3DTexture.ts +2 -4
- package/src/ProceduralTexture.ts +1 -3
- package/src/ShaderArrayPass.ts +5 -5
- package/src/ShadowMaterial.ts +4 -4
- package/src/ShadowPass.ts +5 -6
- package/src/constants.ts +1 -0
- package/src/helpers/setArrayRenderTargetLayers.ts +3 -6
- package/src/qualityPresets.ts +5 -5
- package/src/r3f/CloudLayer.tsx +1 -1
- package/src/r3f/Clouds.tsx +71 -85
- package/src/shaders/clouds.frag +36 -34
- package/src/shaders/clouds.vert +18 -5
- package/src/shaders/parameters.glsl +1 -1
- package/src/shaders/shadowResolve.frag +2 -2
- package/src/shaders/types.glsl +1 -1
- package/src/shaders/varianceClipping.glsl +2 -2
- package/src/uniforms.ts +3 -3
- package/types/CloudsEffect.d.ts +18 -8
- package/types/CloudsMaterial.d.ts +7 -3
- package/types/qualityPresets.d.ts +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- `CloudsEffect`: Added `singleMieScatteringTexture` and `higherOrderScatteringTexture` props.
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- Removed `photometric` options and props. It outputs luminance only now.
|
12
|
+
- Removed the shadow length attenuation hack.
|
13
|
+
- React components no longer trigger React state changes when textures are loaded.
|
14
|
+
- `CloudsEffect`: Deprecated and renamed `skyIrradianceScale`, `groundIrradianceScale` and `accurateSunSkyIrradiance` to `skyLightScale`, `groundBounceScale` and `accurateSunSkyLight`.
|
15
|
+
- Migrated to core API changes.
|
16
|
+
- Updated dependencies.
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
|
20
|
+
- Fixed unnecessary side effects of type-only imports.
|
21
|
+
|
3
22
|
## [0.3.0] - 2025-06-12
|
4
23
|
|
5
24
|
### Changed
|
package/README.md
CHANGED
@@ -41,7 +41,7 @@ const Scene = () => (
|
|
41
41
|
<Atmosphere>
|
42
42
|
<EffectComposer enableNormalPass>
|
43
43
|
<Clouds qualityPreset='high' coverage={0.4} />
|
44
|
-
<AerialPerspective sky
|
44
|
+
<AerialPerspective sky sunLight skyLight />
|
45
45
|
</EffectComposer>
|
46
46
|
</Atmosphere>
|
47
47
|
)
|
@@ -81,7 +81,7 @@ const Scene = () => (
|
|
81
81
|
coverageFilterWidth={0.5}
|
82
82
|
/>
|
83
83
|
</Clouds>
|
84
|
-
<AerialPerspective sky
|
84
|
+
<AerialPerspective sky sunLight skyLight />
|
85
85
|
</EffectComposer>
|
86
86
|
</Atmosphere>
|
87
87
|
)
|
@@ -100,7 +100,7 @@ const Scene = () => (
|
|
100
100
|
<Atmosphere>
|
101
101
|
<EffectComposer enableNormalPass>
|
102
102
|
<Clouds localWeatherTexture={/* path to weather texture */} />
|
103
|
-
<AerialPerspective sky
|
103
|
+
<AerialPerspective sky sunLight skyLight />
|
104
104
|
</EffectComposer>
|
105
105
|
</Atmosphere>
|
106
106
|
)
|
@@ -131,7 +131,7 @@ const Scene = () => (
|
|
131
131
|
<Atmosphere>
|
132
132
|
<EffectComposer enableNormalPass>
|
133
133
|
<Clouds localWeatherTexture={localWeatherTexture} />
|
134
|
-
<AerialPerspective sky
|
134
|
+
<AerialPerspective sky sunLight skyLight />
|
135
135
|
</EffectComposer>
|
136
136
|
</Atmosphere>
|
137
137
|
)
|
@@ -195,7 +195,7 @@ This illustrates that greater total cloud layer height increases computational c
|
|
195
195
|
|
196
196
|
- The cloud base of each layer lines up at the same altitude, making it look artificial. This may be improved by tweaking the shape altering function.
|
197
197
|
|
198
|
-
- Interpolated sun and sky irradiance, when [`
|
198
|
+
- Interpolated sun and sky irradiance, when [`accurateSunSkyLight`](#cloudsaccuratesunskylight) is set to false, could be improved by using spherical harmonics to approximate the radial gradient of the sky.
|
199
199
|
|
200
200
|
- A large portion of weather sampling is wasted simply checking whether it is outside the cloud shell. However, since we already know the front depth and sample count at the texel from the reprojected previous frame, using this information to better estimate the ray marching range would make it much more efficient.
|
201
201
|
|
@@ -241,13 +241,13 @@ const Scene = () => (
|
|
241
241
|
qualityPreset='high'
|
242
242
|
coverage={0.4}
|
243
243
|
// Just use dash-case to pierce into nested properties.
|
244
|
-
clouds-
|
244
|
+
clouds-accurateSunSkyLight
|
245
245
|
shadow-cascadeCount={3}
|
246
246
|
/>
|
247
247
|
{/* By placing it inside Atmosphere along with AerialPerspective, the
|
248
248
|
output buffers are routed to AerialPerspective and composited into the
|
249
249
|
final render. */}
|
250
|
-
<AerialPerspective sky
|
250
|
+
<AerialPerspective sky sunLight skyLight />
|
251
251
|
</EffectComposer>
|
252
252
|
</Atmosphere>
|
253
253
|
)
|
@@ -368,7 +368,7 @@ const Scene = () => {
|
|
368
368
|
/>
|
369
369
|
{/* The number of cloud layers is limited to 4. */}
|
370
370
|
</Clouds>
|
371
|
-
<AerialPerspective sky
|
371
|
+
<AerialPerspective sky sunLight skyLight />
|
372
372
|
</EffectComposer>
|
373
373
|
</Atmosphere>
|
374
374
|
)
|
@@ -496,7 +496,6 @@ Nothing novel here, just a combination of existing techniques. See the [referenc
|
|
496
496
|
- **Shadow resolve**
|
497
497
|
|
498
498
|
Applies temporal anti-aliasing (TAA) on BSM, not for the aliasing at polygon edges, but rather for temporal filtering:
|
499
|
-
|
500
499
|
- Reduce spatial aliasing in BSM due to the high-frequency details of the clouds relative to the output resolution.
|
501
500
|
- Reduce temporal aliasing caused by temporal jitters during shadow ray marching.
|
502
501
|
|
@@ -676,21 +675,21 @@ Controls dual-lobe Henyey-Greenstein phase function. Positive anisotropy strengt
|
|
676
675
|
|
677
676
|
These values take effect only when [`accuratePhaseFunction`](#cloudsaccuratephasefunction) is disabled.
|
678
677
|
|
679
|
-
####
|
678
|
+
#### skyLightScale
|
680
679
|
|
681
680
|
```ts
|
682
|
-
|
681
|
+
skyLightScale: number = 1
|
683
682
|
```
|
684
683
|
|
685
|
-
The contribution of sky
|
684
|
+
The contribution of sky light. This is a fudge factor and you might adjust this value to make it look convincing to you.
|
686
685
|
|
687
|
-
####
|
686
|
+
#### groundBounceScale
|
688
687
|
|
689
688
|
```ts
|
690
|
-
|
689
|
+
groundBounceScale: number = 1
|
691
690
|
```
|
692
691
|
|
693
|
-
The contribution of
|
692
|
+
The contribution of light bouncing off the ground. This is a fudge factor and you might adjust this value to make it look convincing to you.
|
694
693
|
|
695
694
|
#### powderScale, powderExponent
|
696
695
|
|
@@ -826,10 +825,10 @@ multiScatteringOctaves: number = 8
|
|
826
825
|
|
827
826
|
The number of octaves accumulated to approximate multiple scattering. A higher value results in brighter clouds, but values beyond 8 have no noticeable effect.
|
828
827
|
|
829
|
-
#### clouds.
|
828
|
+
#### clouds.accurateSunSkyLight
|
830
829
|
|
831
830
|
```ts
|
832
|
-
|
831
|
+
accurateSunSkyLight: boolean = true
|
833
832
|
```
|
834
833
|
|
835
834
|
Whether to sample sun and sky irradiance at every sample point during ray marching. If disabled, irradiance is approximated by interpolating values at the bottom and top of the total cloud layers above the camera, which is only plausible for small-scale scenes.
|
package/build/index.cjs
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./shared.cjs"),c=require("@takram/three-geospatial"),
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./shared.cjs"),c=require("@takram/three-geospatial"),a=require("@takram/three-geospatial/shaders"),n=require("three");class g{constructor({size:t,fragmentShader:r}){this.needsRender=!0,this.camera=new n.Camera,this.size=t,this.material=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:`
|
2
2
|
in vec3 position;
|
3
3
|
out vec2 vUv;
|
4
4
|
void main() {
|
5
5
|
vUv = position.xy * 0.5 + 0.5;
|
6
6
|
gl_Position = vec4(position.xy, 0.0, 1.0);
|
7
7
|
}
|
8
|
-
`,fragmentShader:r,uniforms:{layer:new n.Uniform(0)}}),this.mesh=new n.Mesh(new n.PlaneGeometry(2,2),this.material),this.renderTarget=new n.WebGL3DRenderTarget(t,t,t,{depthBuffer:!1,
|
8
|
+
`,fragmentShader:r,uniforms:{layer:new n.Uniform(0)}}),this.mesh=new n.Mesh(new n.PlaneGeometry(2,2),this.material),this.renderTarget=new n.WebGL3DRenderTarget(t,t,t,{depthBuffer:!1,format:n.RedFormat});const e=this.renderTarget.texture;e.minFilter=n.LinearFilter,e.magFilter=n.LinearFilter,e.wrapS=n.RepeatWrapping,e.wrapT=n.RepeatWrapping,e.wrapR=n.RepeatWrapping,e.colorSpace=n.NoColorSpace,e.needsUpdate=!0}dispose(){this.renderTarget.dispose(),this.material.dispose()}render(t,r){if(this.needsRender){this.needsRender=!1;for(let e=0;e<this.size;++e)this.material.uniforms.layer.value=e/this.size,t.setRenderTarget(this.renderTarget,e),t.render(this.mesh,this.camera);t.setRenderTarget(null)}}get texture(){return this.renderTarget.texture}}const p=`// Based on the following work with slight modifications.
|
9
9
|
// https://github.com/sebh/TileableVolumeNoise
|
10
10
|
|
11
11
|
/**
|
@@ -83,7 +83,7 @@ void main() {
|
|
83
83
|
float worleyFbm = getWorleyFbm(point);
|
84
84
|
outputColor = remap(perlinWorley, worleyFbm - 1.0, 1.0);
|
85
85
|
}
|
86
|
-
`,
|
86
|
+
`,s=`// Ported from GLM: https://github.com/g-truc/glm/blob/master/glm/gtc/noise.inl
|
87
87
|
|
88
88
|
/**
|
89
89
|
* OpenGL Mathematics (GLM)
|
@@ -294,7 +294,7 @@ float perlin(const vec4 position, const vec4 rep) {
|
|
294
294
|
float n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
|
295
295
|
return 2.2 * n_xyzw;
|
296
296
|
}
|
297
|
-
`,
|
297
|
+
`,l=`// Based on the following work with slight modifications.
|
298
298
|
// https://github.com/sebh/TileableVolumeNoise
|
299
299
|
|
300
300
|
/**
|
@@ -382,7 +382,7 @@ float getPerlinNoise(const vec3 point, const vec3 frequency, const int octaveCou
|
|
382
382
|
float getPerlinNoise(const vec3 point, const float frequency, const int octaveCount) {
|
383
383
|
return getPerlinNoise(point, vec3(frequency), octaveCount);
|
384
384
|
}
|
385
|
-
`;class
|
385
|
+
`;class u extends g{constructor(){super({size:o.CLOUD_SHAPE_TEXTURE_SIZE,fragmentShader:c.resolveIncludes(p,{core:{math:a.math},perlin:s,tileableNoise:l})})}}const v=`// Based on the following work with slight modifications.
|
386
386
|
// https://github.com/sebh/TileableVolumeNoise
|
387
387
|
|
388
388
|
/**
|
@@ -438,14 +438,14 @@ void main() {
|
|
438
438
|
);
|
439
439
|
outputColor = dot(fbm, vec3(0.625, 0.25, 0.125));
|
440
440
|
}
|
441
|
-
`;class
|
441
|
+
`;class d extends g{constructor(){super({size:o.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE,fragmentShader:c.resolveIncludes(v,{core:{math:a.math},perlin:s,tileableNoise:l})})}}class f{constructor({size:t,fragmentShader:r}){this.needsRender=!0,this.camera=new n.Camera,this.size=t,this.material=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:`
|
442
442
|
in vec3 position;
|
443
443
|
out vec2 vUv;
|
444
444
|
void main() {
|
445
445
|
vUv = position.xy * 0.5 + 0.5;
|
446
446
|
gl_Position = vec4(position.xy, 0.0, 1.0);
|
447
447
|
}
|
448
|
-
`,fragmentShader:r,uniforms:{layer:new n.Uniform(0)}}),this.mesh=new n.Mesh(new n.PlaneGeometry(2,2),this.material),this.renderTarget=new n.WebGLRenderTarget(t,t,{depthBuffer:!1,
|
448
|
+
`,fragmentShader:r,uniforms:{layer:new n.Uniform(0)}}),this.mesh=new n.Mesh(new n.PlaneGeometry(2,2),this.material),this.renderTarget=new n.WebGLRenderTarget(t,t,{depthBuffer:!1,format:n.RGBAFormat});const e=this.renderTarget.texture;e.generateMipmaps=!0,e.minFilter=n.LinearMipMapLinearFilter,e.magFilter=n.LinearFilter,e.wrapS=n.RepeatWrapping,e.wrapT=n.RepeatWrapping,e.colorSpace=n.NoColorSpace,e.needsUpdate=!0}dispose(){this.renderTarget.dispose(),this.material.dispose()}render(t,r){this.needsRender&&(this.needsRender=!1,t.setRenderTarget(this.renderTarget),t.render(this.mesh,this.camera),t.setRenderTarget(null))}get texture(){return this.renderTarget.texture}}const y=`precision highp float;
|
449
449
|
precision highp int;
|
450
450
|
|
451
451
|
#include "core/math"
|
@@ -528,7 +528,7 @@ void main() {
|
|
528
528
|
|
529
529
|
outputColor.a = 1.0;
|
530
530
|
}
|
531
|
-
`;class
|
531
|
+
`;class T extends f{constructor(){super({size:512,fragmentShader:c.resolveIncludes(y,{core:{math:a.math},perlin:s,tileableNoise:l})})}}const h=`precision highp float;
|
532
532
|
precision highp int;
|
533
533
|
|
534
534
|
#include "core/math"
|
@@ -579,5 +579,5 @@ void main() {
|
|
579
579
|
outputColor.rgb = 0.5 * curl(point) + 0.5;
|
580
580
|
outputColor.a = 1.0;
|
581
581
|
}
|
582
|
-
`;class
|
582
|
+
`;class E extends f{constructor(){super({size:128,fragmentShader:c.resolveIncludes(h,{core:{math:a.math},perlin:s,tileableNoise:l})})}}exports.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE=o.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE;exports.CLOUD_SHAPE_TEXTURE_SIZE=o.CLOUD_SHAPE_TEXTURE_SIZE;exports.CloudLayer=o.CloudLayer;exports.CloudLayers=o.CloudLayers;exports.CloudsEffect=o.CloudsEffect;exports.DEFAULT_LOCAL_WEATHER_URL=o.DEFAULT_LOCAL_WEATHER_URL;exports.DEFAULT_SHAPE_DETAIL_URL=o.DEFAULT_SHAPE_DETAIL_URL;exports.DEFAULT_SHAPE_URL=o.DEFAULT_SHAPE_URL;exports.DEFAULT_TURBULENCE_URL=o.DEFAULT_TURBULENCE_URL;exports.DensityProfile=o.DensityProfile;exports.cloudsPassOptionsDefaults=o.cloudsPassOptionsDefaults;exports.CloudShape=u;exports.CloudShapeDetail=d;exports.LocalWeather=T;exports.Procedural3DTextureBase=g;exports.ProceduralTextureBase=f;exports.Turbulence=E;
|
583
583
|
//# sourceMappingURL=index.cjs.map
|
package/build/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/Procedural3DTexture.ts","../src/shaders/cloudShape.frag?raw","../src/shaders/perlin.glsl?raw","../src/shaders/tileableNoise.glsl?raw","../src/CloudShape.ts","../src/shaders/cloudShapeDetail.frag?raw","../src/CloudShapeDetail.ts","../src/ProceduralTexture.ts","../src/shaders/localWeather.frag?raw","../src/LocalWeather.ts","../src/shaders/turbulence.frag?raw","../src/Turbulence.ts"],"sourcesContent":null,"names":["Procedural3DTextureBase","size","fragmentShader","Camera","RawShaderMaterial","GLSL3","Uniform","Mesh","PlaneGeometry","WebGL3DRenderTarget","RedFormat","texture","LinearFilter","RepeatWrapping","NoColorSpace","renderer","deltaTime","
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/Procedural3DTexture.ts","../src/shaders/cloudShape.frag?raw","../src/shaders/perlin.glsl?raw","../src/shaders/tileableNoise.glsl?raw","../src/CloudShape.ts","../src/shaders/cloudShapeDetail.frag?raw","../src/CloudShapeDetail.ts","../src/ProceduralTexture.ts","../src/shaders/localWeather.frag?raw","../src/LocalWeather.ts","../src/shaders/turbulence.frag?raw","../src/Turbulence.ts"],"sourcesContent":null,"names":["Procedural3DTextureBase","size","fragmentShader","Camera","RawShaderMaterial","GLSL3","Uniform","Mesh","PlaneGeometry","WebGL3DRenderTarget","RedFormat","texture","LinearFilter","RepeatWrapping","NoColorSpace","renderer","deltaTime","layer","fragmentShader$3","perlin","tileableNoise","CloudShape","CLOUD_SHAPE_TEXTURE_SIZE","resolveIncludes","math","fragmentShader$2","CloudShapeDetail","CLOUD_SHAPE_DETAIL_TEXTURE_SIZE","ProceduralTextureBase","WebGLRenderTarget","RGBAFormat","LinearMipMapLinearFilter","fragmentShader$1","LocalWeather","Turbulence"],"mappings":"uNAyBO,MAAMA,CAAuD,CASlE,YAAY,CAAE,KAAAC,EAAM,eAAAC,GAAqD,CAPzE,KAAA,YAAc,GAKd,KAAiB,OAAS,IAAIC,SAG5B,KAAK,KAAOF,EACZ,KAAK,SAAW,IAAIG,oBAAkB,CACpC,YAAaC,EAAAA,MACb,aAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQzB,eAAAH,EACA,SAAU,CACR,MAAO,IAAII,EAAAA,QAAQ,CAAC,CAAA,CACtB,CACD,EACD,KAAK,KAAO,IAAIC,EAAAA,KAAK,IAAIC,EAAAA,cAAc,EAAG,CAAC,EAAG,KAAK,QAAQ,EAE3D,KAAK,aAAe,IAAIC,EAAAA,oBAAoBR,EAAMA,EAAMA,EAAM,CAC5D,YAAa,GACb,OAAQS,EAAAA,SAAA,CACT,EACD,MAAMC,EAAU,KAAK,aAAa,QAClCA,EAAQ,UAAYC,EAAAA,aACpBD,EAAQ,UAAYC,EAAAA,aACpBD,EAAQ,MAAQE,EAAAA,eAChBF,EAAQ,MAAQE,EAAAA,eAChBF,EAAQ,MAAQE,EAAAA,eAChBF,EAAQ,WAAaG,EAAAA,aACrBH,EAAQ,YAAc,EAAA,CAGxB,SAAgB,CACd,KAAK,aAAa,QAAA,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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECSR,MAAMC,UAAqBL,CAAsB,CACtD,aAAc,CACZ,MAAM,CACJ,KAAM,IACN,eAAgBL,EAAAA,gBAAgBrB,EAAgB,CAC9C,KAAM,CAAA,KAAEsB,EAAAA,IAAA,EACR,OAAAL,EACA,cAAAC,CAAA,CACD,CAAA,CACF,CAAA,CAEL,CCpBA,MAAAlB,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECSR,MAAMgC,UAAmBN,CAAsB,CACpD,aAAc,CACZ,MAAM,CACJ,KAAM,IACN,eAAgBL,EAAAA,gBAAgBrB,EAAgB,CAC9C,KAAM,CAAA,KAAEsB,EAAAA,IAAA,EACR,OAAAL,EACA,cAAAC,CAAA,CACD,CAAA,CACF,CAAA,CAEL"}
|
package/build/index.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import { C as
|
2
|
-
import { b as
|
3
|
-
import { resolveIncludes as
|
4
|
-
import { math as
|
5
|
-
import { Camera as
|
6
|
-
class
|
1
|
+
import { C as m, a as w } from "./shared.js";
|
2
|
+
import { b as G, c as B, e as _, D as Y, g as q, f as V, h as X, i as k, d as j } from "./shared.js";
|
3
|
+
import { resolveIncludes as r } from "@takram/three-geospatial";
|
4
|
+
import { math as c } from "@takram/three-geospatial/shaders";
|
5
|
+
import { Camera as g, RawShaderMaterial as f, Uniform as p, GLSL3 as v, Mesh as u, PlaneGeometry as y, WebGL3DRenderTarget as E, RedFormat as I, LinearFilter as l, RepeatWrapping as i, NoColorSpace as d, WebGLRenderTarget as R, RGBAFormat as x, LinearMipMapLinearFilter as O } from "three";
|
6
|
+
class T {
|
7
7
|
constructor({ size: e, fragmentShader: o }) {
|
8
|
-
this.needsRender = !0, this.camera = new
|
9
|
-
glslVersion:
|
8
|
+
this.needsRender = !0, this.camera = new g(), this.size = e, this.material = new f({
|
9
|
+
glslVersion: v,
|
10
10
|
vertexShader: (
|
11
11
|
/* glsl */
|
12
12
|
`
|
@@ -20,33 +20,31 @@ class h {
|
|
20
20
|
),
|
21
21
|
fragmentShader: o,
|
22
22
|
uniforms: {
|
23
|
-
layer: new
|
23
|
+
layer: new p(0)
|
24
24
|
}
|
25
|
-
}), this.mesh = new
|
25
|
+
}), this.mesh = new u(new y(2, 2), this.material), this.renderTarget = new E(e, e, e, {
|
26
26
|
depthBuffer: !1,
|
27
|
-
stencilBuffer: !1,
|
28
27
|
format: I
|
29
28
|
});
|
30
29
|
const n = this.renderTarget.texture;
|
31
|
-
n.minFilter =
|
30
|
+
n.minFilter = l, n.magFilter = l, n.wrapS = i, n.wrapT = i, n.wrapR = i, n.colorSpace = d, n.needsUpdate = !0;
|
32
31
|
}
|
33
32
|
dispose() {
|
34
33
|
this.renderTarget.dispose(), this.material.dispose();
|
35
34
|
}
|
36
35
|
render(e, o) {
|
37
|
-
if (
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
e.setRenderTarget(n);
|
36
|
+
if (this.needsRender) {
|
37
|
+
this.needsRender = !1;
|
38
|
+
for (let n = 0; n < this.size; ++n)
|
39
|
+
this.material.uniforms.layer.value = n / this.size, e.setRenderTarget(this.renderTarget, n), e.render(this.mesh, this.camera);
|
40
|
+
e.setRenderTarget(null);
|
41
|
+
}
|
44
42
|
}
|
45
43
|
get texture() {
|
46
44
|
return this.renderTarget.texture;
|
47
45
|
}
|
48
46
|
}
|
49
|
-
const
|
47
|
+
const N = `// Based on the following work with slight modifications.
|
50
48
|
// https://github.com/sebh/TileableVolumeNoise
|
51
49
|
|
52
50
|
/**
|
@@ -124,7 +122,7 @@ void main() {
|
|
124
122
|
float worleyFbm = getWorleyFbm(point);
|
125
123
|
outputColor = remap(perlinWorley, worleyFbm - 1.0, 1.0);
|
126
124
|
}
|
127
|
-
`,
|
125
|
+
`, s = `// Ported from GLM: https://github.com/g-truc/glm/blob/master/glm/gtc/noise.inl
|
128
126
|
|
129
127
|
/**
|
130
128
|
* OpenGL Mathematics (GLM)
|
@@ -335,7 +333,7 @@ float perlin(const vec4 position, const vec4 rep) {
|
|
335
333
|
float n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
|
336
334
|
return 2.2 * n_xyzw;
|
337
335
|
}
|
338
|
-
`,
|
336
|
+
`, a = `// Based on the following work with slight modifications.
|
339
337
|
// https://github.com/sebh/TileableVolumeNoise
|
340
338
|
|
341
339
|
/**
|
@@ -424,19 +422,19 @@ float getPerlinNoise(const vec3 point, const float frequency, const int octaveCo
|
|
424
422
|
return getPerlinNoise(point, vec3(frequency), octaveCount);
|
425
423
|
}
|
426
424
|
`;
|
427
|
-
class
|
425
|
+
class b extends T {
|
428
426
|
constructor() {
|
429
427
|
super({
|
430
|
-
size:
|
431
|
-
fragmentShader:
|
432
|
-
core: { math:
|
433
|
-
perlin:
|
434
|
-
tileableNoise:
|
428
|
+
size: m,
|
429
|
+
fragmentShader: r(N, {
|
430
|
+
core: { math: c },
|
431
|
+
perlin: s,
|
432
|
+
tileableNoise: a
|
435
433
|
})
|
436
434
|
});
|
437
435
|
}
|
438
436
|
}
|
439
|
-
const
|
437
|
+
const S = `// Based on the following work with slight modifications.
|
440
438
|
// https://github.com/sebh/TileableVolumeNoise
|
441
439
|
|
442
440
|
/**
|
@@ -493,22 +491,22 @@ void main() {
|
|
493
491
|
outputColor = dot(fbm, vec3(0.625, 0.25, 0.125));
|
494
492
|
}
|
495
493
|
`;
|
496
|
-
class
|
494
|
+
class F extends T {
|
497
495
|
constructor() {
|
498
496
|
super({
|
499
|
-
size:
|
500
|
-
fragmentShader:
|
501
|
-
core: { math:
|
502
|
-
perlin:
|
503
|
-
tileableNoise:
|
497
|
+
size: w,
|
498
|
+
fragmentShader: r(S, {
|
499
|
+
core: { math: c },
|
500
|
+
perlin: s,
|
501
|
+
tileableNoise: a
|
504
502
|
})
|
505
503
|
});
|
506
504
|
}
|
507
505
|
}
|
508
|
-
class
|
506
|
+
class h {
|
509
507
|
constructor({ size: e, fragmentShader: o }) {
|
510
|
-
this.needsRender = !0, this.camera = new
|
511
|
-
glslVersion:
|
508
|
+
this.needsRender = !0, this.camera = new g(), this.size = e, this.material = new f({
|
509
|
+
glslVersion: v,
|
512
510
|
vertexShader: (
|
513
511
|
/* glsl */
|
514
512
|
`
|
@@ -522,31 +520,26 @@ class m {
|
|
522
520
|
),
|
523
521
|
fragmentShader: o,
|
524
522
|
uniforms: {
|
525
|
-
layer: new
|
523
|
+
layer: new p(0)
|
526
524
|
}
|
527
|
-
}), this.mesh = new
|
525
|
+
}), this.mesh = new u(new y(2, 2), this.material), this.renderTarget = new R(e, e, {
|
528
526
|
depthBuffer: !1,
|
529
|
-
|
530
|
-
format: O
|
527
|
+
format: x
|
531
528
|
});
|
532
529
|
const n = this.renderTarget.texture;
|
533
|
-
n.generateMipmaps = !0, n.minFilter =
|
530
|
+
n.generateMipmaps = !0, n.minFilter = O, n.magFilter = l, n.wrapS = i, n.wrapT = i, n.colorSpace = d, n.needsUpdate = !0;
|
534
531
|
}
|
535
532
|
dispose() {
|
536
533
|
this.renderTarget.dispose(), this.material.dispose();
|
537
534
|
}
|
538
535
|
render(e, o) {
|
539
|
-
|
540
|
-
return;
|
541
|
-
this.needsRender = !1;
|
542
|
-
const n = e.getRenderTarget();
|
543
|
-
e.setRenderTarget(this.renderTarget), e.render(this.mesh, this.camera), e.setRenderTarget(n);
|
536
|
+
this.needsRender && (this.needsRender = !1, e.setRenderTarget(this.renderTarget), e.render(this.mesh, this.camera), e.setRenderTarget(null));
|
544
537
|
}
|
545
538
|
get texture() {
|
546
539
|
return this.renderTarget.texture;
|
547
540
|
}
|
548
541
|
}
|
549
|
-
const
|
542
|
+
const A = `precision highp float;
|
550
543
|
precision highp int;
|
551
544
|
|
552
545
|
#include "core/math"
|
@@ -630,19 +623,19 @@ void main() {
|
|
630
623
|
outputColor.a = 1.0;
|
631
624
|
}
|
632
625
|
`;
|
633
|
-
class
|
626
|
+
class U extends h {
|
634
627
|
constructor() {
|
635
628
|
super({
|
636
629
|
size: 512,
|
637
|
-
fragmentShader:
|
638
|
-
core: { math:
|
639
|
-
perlin:
|
640
|
-
tileableNoise:
|
630
|
+
fragmentShader: r(A, {
|
631
|
+
core: { math: c },
|
632
|
+
perlin: s,
|
633
|
+
tileableNoise: a
|
641
634
|
})
|
642
635
|
});
|
643
636
|
}
|
644
637
|
}
|
645
|
-
const
|
638
|
+
const P = `precision highp float;
|
646
639
|
precision highp int;
|
647
640
|
|
648
641
|
#include "core/math"
|
@@ -694,35 +687,35 @@ void main() {
|
|
694
687
|
outputColor.a = 1.0;
|
695
688
|
}
|
696
689
|
`;
|
697
|
-
class
|
690
|
+
class W extends h {
|
698
691
|
constructor() {
|
699
692
|
super({
|
700
693
|
size: 128,
|
701
|
-
fragmentShader:
|
702
|
-
core: { math:
|
703
|
-
perlin:
|
704
|
-
tileableNoise:
|
694
|
+
fragmentShader: r(P, {
|
695
|
+
core: { math: c },
|
696
|
+
perlin: s,
|
697
|
+
tileableNoise: a
|
705
698
|
})
|
706
699
|
});
|
707
700
|
}
|
708
701
|
}
|
709
702
|
export {
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
703
|
+
w as CLOUD_SHAPE_DETAIL_TEXTURE_SIZE,
|
704
|
+
m as CLOUD_SHAPE_TEXTURE_SIZE,
|
705
|
+
G as CloudLayer,
|
706
|
+
B as CloudLayers,
|
707
|
+
b as CloudShape,
|
708
|
+
F as CloudShapeDetail,
|
709
|
+
_ as CloudsEffect,
|
710
|
+
Y as DEFAULT_LOCAL_WEATHER_URL,
|
711
|
+
q as DEFAULT_SHAPE_DETAIL_URL,
|
712
|
+
V as DEFAULT_SHAPE_URL,
|
713
|
+
X as DEFAULT_TURBULENCE_URL,
|
714
|
+
k as DensityProfile,
|
715
|
+
U as LocalWeather,
|
716
|
+
T as Procedural3DTextureBase,
|
717
|
+
h as ProceduralTextureBase,
|
718
|
+
W as Turbulence,
|
719
|
+
j as cloudsPassOptionsDefaults
|
727
720
|
};
|
728
721
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/Procedural3DTexture.ts","../src/shaders/cloudShape.frag?raw","../src/shaders/perlin.glsl?raw","../src/shaders/tileableNoise.glsl?raw","../src/CloudShape.ts","../src/shaders/cloudShapeDetail.frag?raw","../src/CloudShapeDetail.ts","../src/ProceduralTexture.ts","../src/shaders/localWeather.frag?raw","../src/LocalWeather.ts","../src/shaders/turbulence.frag?raw","../src/Turbulence.ts"],"sourcesContent":null,"names":["Procedural3DTextureBase","size","fragmentShader","Camera","RawShaderMaterial","GLSL3","Uniform","Mesh","PlaneGeometry","WebGL3DRenderTarget","RedFormat","texture","LinearFilter","RepeatWrapping","NoColorSpace","renderer","deltaTime","
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/Procedural3DTexture.ts","../src/shaders/cloudShape.frag?raw","../src/shaders/perlin.glsl?raw","../src/shaders/tileableNoise.glsl?raw","../src/CloudShape.ts","../src/shaders/cloudShapeDetail.frag?raw","../src/CloudShapeDetail.ts","../src/ProceduralTexture.ts","../src/shaders/localWeather.frag?raw","../src/LocalWeather.ts","../src/shaders/turbulence.frag?raw","../src/Turbulence.ts"],"sourcesContent":null,"names":["Procedural3DTextureBase","size","fragmentShader","Camera","RawShaderMaterial","GLSL3","Uniform","Mesh","PlaneGeometry","WebGL3DRenderTarget","RedFormat","texture","LinearFilter","RepeatWrapping","NoColorSpace","renderer","deltaTime","layer","fragmentShader$3","perlin","tileableNoise","CloudShape","CLOUD_SHAPE_TEXTURE_SIZE","resolveIncludes","math","fragmentShader$2","CloudShapeDetail","CLOUD_SHAPE_DETAIL_TEXTURE_SIZE","ProceduralTextureBase","WebGLRenderTarget","RGBAFormat","LinearMipMapLinearFilter","fragmentShader$1","LocalWeather","Turbulence"],"mappings":";;;;;AAyBO,MAAMA,EAAuD;AAAA,EASlE,YAAY,EAAE,MAAAC,GAAM,gBAAAC,KAAqD;AAPzE,SAAA,cAAc,IAKd,KAAiB,SAAS,IAAIC,EAAA,GAG5B,KAAK,OAAOF,GACZ,KAAK,WAAW,IAAIG,EAAkB;AAAA,MACpC,aAAaC;AAAA,MACb;AAAA;AAAA,QAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQzB,gBAAAH;AAAA,MACA,UAAU;AAAA,QACR,OAAO,IAAII,EAAQ,CAAC;AAAA,MAAA;AAAA,IACtB,CACD,GACD,KAAK,OAAO,IAAIC,EAAK,IAAIC,EAAc,GAAG,CAAC,GAAG,KAAK,QAAQ,GAE3D,KAAK,eAAe,IAAIC,EAAoBR,GAAMA,GAAMA,GAAM;AAAA,MAC5D,aAAa;AAAA,MACb,QAAQS;AAAA,IAAA,CACT;AACD,UAAMC,IAAU,KAAK,aAAa;AAClC,IAAAA,EAAQ,YAAYC,GACpBD,EAAQ,YAAYC,GACpBD,EAAQ,QAAQE,GAChBF,EAAQ,QAAQE,GAChBF,EAAQ,QAAQE,GAChBF,EAAQ,aAAaG,GACrBH,EAAQ,cAAc;AAAA,EAAA;AAAA,EAGxB,UAAgB;AACd,SAAK,aAAa,QAAA,GAClB,KAAK,SAAS,QAAA;AAAA,EAAQ;AA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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACSR,MAAMC,UAAqBL,EAAsB;AAAA,EACtD,cAAc;AACZ,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,gBAAgBL,EAAgBrB,GAAgB;AAAA,QAC9C,MAAM,EAAE,MAAAsB,EAAA;AAAA,QACR,QAAAL;AAAA,QACA,eAAAC;AAAA,MAAA,CACD;AAAA,IAAA,CACF;AAAA,EAAA;AAEL;ACpBA,MAAAlB,IAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACSR,MAAMgC,UAAmBN,EAAsB;AAAA,EACpD,cAAc;AACZ,UAAM;AAAA,MACJ,MAAM;AAAA,MACN,gBAAgBL,EAAgBrB,GAAgB;AAAA,QAC9C,MAAM,EAAE,MAAAsB,EAAA;AAAA,QACR,QAAAL;AAAA,QACA,eAAAC;AAAA,MAAA,CACD;AAAA,IAAA,CACF;AAAA,EAAA;AAEL;"}
|
package/build/r3f.cjs
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),C=require("@react-three/fiber"),M=require("@react-three/postprocessing"),r=require("react"),l=require("three"),m=require("@takram/three-atmosphere/r3f"),T=require("@takram/three-geospatial"),u=require("./shared.cjs"),D=r.createContext(null),O=({layers:e,disableDefault:t=!1,children:n})=>{const[a,d]=r.useState();return r.useLayoutEffect(()=>{e.set(t?Array(4).fill(u.CloudLayer.DEFAULT):u.CloudLayers.DEFAULT),d({layers:e,indexPool:[0,1,2,3],disableDefault:t})},[e,t]),a!=null&&h.jsx(D.Provider,{value:a,children:n})};function g(e,t){const n=r.useMemo(()=>typeof e=="string"?new l.TextureLoader().load(e,a=>{a.minFilter=l.LinearMipMapLinearFilter,a.magFilter=l.LinearFilter,a.wrapS=l.RepeatWrapping,a.wrapT=l.RepeatWrapping,a.colorSpace=l.NoColorSpace,a.needsUpdate=!0}):void 0,[e]);return r.useEffect(()=>{if(n!=null)return()=>{n.dispose()}},[n]),(typeof e=="string"?n:e)??null}function S(e,t){const n=r.useMemo(()=>typeof e=="string"?new T.DataTextureLoader(l.Data3DTexture,T.parseUint8Array,{width:t,height:t,depth:t,format:l.RedFormat,minFilter:l.LinearFilter,magFilter:l.LinearFilter,wrapS:l.RepeatWrapping,wrapT:l.RepeatWrapping,wrapR:l.RepeatWrapping,colorSpace:l.NoColorSpace}).load(e):void 0,[e,t]);return r.useEffect(()=>{if(n!=null)return()=>{n.dispose()}},[n]),(typeof e=="string"?n:e)??null}function q(e){const t=r.useMemo(()=>typeof e=="string"?new T.STBNLoader().load(e):void 0,[e]);return r.useEffect(()=>{if(t!=null)return()=>{t.dispose()}},[t]),(typeof e=="string"?t:e)??null}const P=({ref:e,disableDefaultLayers:t=!1,localWeatherTexture:n=u.DEFAULT_LOCAL_WEATHER_URL,shapeTexture:a=u.DEFAULT_SHAPE_URL,shapeDetailTexture:d=u.DEFAULT_SHAPE_DETAIL_URL,turbulenceTexture:p=u.DEFAULT_TURBULENCE_URL,stbnTexture:L=T.DEFAULT_STBN_URL,children:c,...f})=>{const{textures:i,transientStates:o,...E}=r.useContext(m.AtmosphereContext),[U,w]=m.separateProps({...u.cloudsPassOptionsDefaults,...E,...i,...f}),s=r.useMemo(()=>new u.CloudsEffect,[]);r.useEffect(()=>()=>{s.dispose()},[s]),C.useFrame(()=>{o!=null&&(s.sunDirection.copy(o.sunDirection),s.ellipsoidCenter.copy(o.ellipsoidCenter),s.ellipsoidMatrix.copy(o.ellipsoidMatrix))}),r.useEffect(()=>{if(o!=null)return o.overlay=s.atmosphereOverlay,o.shadow=s.atmosphereShadow,o.shadowLength=s.atmosphereShadowLength,()=>{o.overlay=null,o.shadow=null,o.shadowLength=null}},[s,o]);const y=r.useCallback(x=>{if(o!=null)switch(x.property){case"atmosphereOverlay":o.overlay=s.atmosphereOverlay;break;case"atmosphereShadow":o.shadow=s.atmosphereShadow;break;case"atmosphereShadowLength":o.shadowLength=s.atmosphereShadowLength;break}},[s,o]);r.useEffect(()=>(s.events.addEventListener("change",y),()=>{s.events.removeEventListener("change",y)}),[s,y]),C.useThree(({gl:x})=>x);const A=g(n),F=S(a,u.CLOUD_SHAPE_TEXTURE_SIZE),v=S(d,u.CLOUD_SHAPE_DETAIL_TEXTURE_SIZE),_=g(p),b=q(L),{camera:R}=r.useContext(M.EffectComposerContext);return h.jsxs(h.Fragment,{children:[h.jsx("primitive",{ref:e,object:s,mainCamera:R,...U,localWeatherTexture:A,shapeTexture:F,shapeDetailTexture:v,turbulenceTexture:_,stbnTexture:b,...w}),h.jsx(O,{layers:s.cloudLayers,disableDefault:t,children:c})]})},W=({ref:e,index:t,...n})=>{const a=r.useContext(D);if(a==null)throw new Error("CloudLayer can only be used within the Clouds component!");const{layers:d,indexPool:p,disableDefault:L}=a,[c,f]=r.useState();if(r.useLayoutEffect(()=>{if(t!=null){const i=p.indexOf(t);if(i!==-1)return p.splice(i,1),f(t),()=>{p.push(t),f(void 0)}}else{const i=p.sort((o,E)=>o-E).shift();if(i!=null)return f(i),()=>{p.push(i),f(void 0)}}},[t,d,p]),r.useLayoutEffect(()=>{if(c==null)return;const i=d[c];return()=>{i.copy(L?u.CloudLayer.DEFAULT:u.CloudLayers.DEFAULT[c])}},[d,c,L]),r.useEffect(()=>{c!=null&&(typeof e=="function"?e(d[c]):e!=null&&(e.current=d[c]))},[e,d,c]),c!=null){const i=d[c];i.copy(L?u.CloudLayer.DEFAULT:u.CloudLayers.DEFAULT[c]),i.set(n)}return null};exports.CloudLayer=W;exports.Clouds=P;
|
2
2
|
//# sourceMappingURL=r3f.cjs.map
|