@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.
- package/CHANGELOG.md +37 -0
- package/README.md +25 -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 +180 -186
- package/build/r3f.js.map +1 -1
- package/build/shared.cjs +102 -74
- package/build/shared.cjs.map +1 -1
- package/build/shared.js +443 -380
- package/build/shared.js.map +1 -1
- package/package.json +3 -3
- package/src/CloudLayers.ts +2 -2
- package/src/CloudsEffect.ts +52 -29
- package/src/CloudsMaterial.ts +53 -30
- 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 +65 -63
- package/src/r3f/Clouds.tsx +170 -188
- package/src/shaders/clouds.frag +64 -50
- package/src/shaders/clouds.glsl +1 -1
- package/src/shaders/clouds.vert +18 -5
- package/src/shaders/parameters.glsl +3 -2
- 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 +19 -9
- package/types/CloudsMaterial.d.ts +10 -5
- package/types/qualityPresets.d.ts +1 -1
- package/types/r3f/CloudLayer.d.ts +3 -1
- package/types/r3f/Clouds.d.ts +2 -1
package/src/shaders/clouds.frag
CHANGED
@@ -13,14 +13,28 @@ precision highp sampler2DArray;
|
|
13
13
|
#include "core/cascadedShadowMaps"
|
14
14
|
#include "core/interleavedGradientNoise"
|
15
15
|
#include "core/vogelDisk"
|
16
|
-
|
17
|
-
#include "atmosphere/
|
16
|
+
|
17
|
+
#include "atmosphere/bruneton/definitions"
|
18
|
+
|
19
|
+
uniform AtmosphereParameters ATMOSPHERE;
|
20
|
+
uniform vec3 SUN_SPECTRAL_RADIANCE_TO_LUMINANCE;
|
21
|
+
uniform vec3 SKY_SPECTRAL_RADIANCE_TO_LUMINANCE;
|
22
|
+
|
23
|
+
uniform sampler2D transmittance_texture;
|
24
|
+
uniform sampler3D scattering_texture;
|
25
|
+
uniform sampler2D irradiance_texture;
|
26
|
+
uniform sampler3D single_mie_scattering_texture;
|
27
|
+
uniform sampler3D higher_order_scattering_texture;
|
28
|
+
|
29
|
+
#include "atmosphere/bruneton/common"
|
30
|
+
#include "atmosphere/bruneton/runtime"
|
31
|
+
|
18
32
|
#include "types"
|
19
33
|
#include "parameters"
|
20
34
|
#include "clouds"
|
21
35
|
|
22
36
|
#if !defined(RECIPROCAL_PI4)
|
23
|
-
#define RECIPROCAL_PI4
|
37
|
+
#define RECIPROCAL_PI4 0.07957747154594767
|
24
38
|
#endif // !defined(RECIPROCAL_PI4)
|
25
39
|
|
26
40
|
uniform sampler2D depthBuffer;
|
@@ -36,8 +50,8 @@ uniform float mipLevelScale;
|
|
36
50
|
// Scattering
|
37
51
|
const vec2 scatterAnisotropy = vec2(SCATTER_ANISOTROPY_1, SCATTER_ANISOTROPY_2);
|
38
52
|
const float scatterAnisotropyMix = SCATTER_ANISOTROPY_MIX;
|
39
|
-
uniform float
|
40
|
-
uniform float
|
53
|
+
uniform float skyLightScale;
|
54
|
+
uniform float groundBounceScale;
|
41
55
|
uniform float powderScale;
|
42
56
|
uniform float powderExponent;
|
43
57
|
|
@@ -266,7 +280,7 @@ vec4 getCascadedShadowMaps(vec2 uv) {
|
|
266
280
|
}
|
267
281
|
|
268
282
|
#if !defined(DEBUG_SHOW_SHADOW_MAP_TYPE)
|
269
|
-
#define DEBUG_SHOW_SHADOW_MAP_TYPE
|
283
|
+
#define DEBUG_SHOW_SHADOW_MAP_TYPE 0
|
270
284
|
#endif // !defined(DEBUG_SHOW_SHADOW_MAP_TYPE
|
271
285
|
|
272
286
|
const float frontDepthScale = 1e-5;
|
@@ -415,30 +429,31 @@ vec3 getGroundSunSkyIrradiance(
|
|
415
429
|
const float height,
|
416
430
|
out vec3 skyIrradiance
|
417
431
|
) {
|
418
|
-
#ifdef
|
432
|
+
#ifdef ACCURATE_SUN_SKY_LIGHT
|
419
433
|
return GetSunAndSkyIrradiance(
|
420
434
|
(position - surfaceNormal * height) * METER_TO_LENGTH_UNIT,
|
435
|
+
surfaceNormal,
|
421
436
|
sunDirection,
|
422
437
|
skyIrradiance
|
423
438
|
);
|
424
|
-
#else //
|
439
|
+
#else // ACCURATE_SUN_SKY_LIGHT
|
425
440
|
skyIrradiance = vGroundIrradiance.sky;
|
426
441
|
return vGroundIrradiance.sun;
|
427
|
-
#endif //
|
442
|
+
#endif // ACCURATE_SUN_SKY_LIGHT
|
428
443
|
}
|
429
444
|
|
430
445
|
vec3 getCloudsSunSkyIrradiance(const vec3 position, const float height, out vec3 skyIrradiance) {
|
431
|
-
#ifdef
|
432
|
-
return
|
433
|
-
#else //
|
446
|
+
#ifdef ACCURATE_SUN_SKY_LIGHT
|
447
|
+
return GetSunAndSkyScalarIrradiance(position * METER_TO_LENGTH_UNIT, sunDirection, skyIrradiance);
|
448
|
+
#else // ACCURATE_SUN_SKY_LIGHT
|
434
449
|
float alpha = remapClamped(height, minHeight, maxHeight);
|
435
450
|
skyIrradiance = mix(vCloudsIrradiance.minSky, vCloudsIrradiance.maxSky, alpha);
|
436
451
|
return mix(vCloudsIrradiance.minSun, vCloudsIrradiance.maxSun, alpha);
|
437
|
-
#endif //
|
452
|
+
#endif // ACCURATE_SUN_SKY_LIGHT
|
438
453
|
}
|
439
454
|
|
440
|
-
#ifdef
|
441
|
-
vec3
|
455
|
+
#ifdef GROUND_BOUNCE
|
456
|
+
vec3 approximateRadianceFromGround(
|
442
457
|
const vec3 position,
|
443
458
|
const vec3 surfaceNormal,
|
444
459
|
const float height,
|
@@ -455,12 +470,11 @@ vec3 approximateIrradianceFromGround(
|
|
455
470
|
vec3 skyIrradiance;
|
456
471
|
vec3 sunIrradiance = getGroundSunSkyIrradiance(position, surfaceNormal, height, skyIrradiance);
|
457
472
|
const float groundAlbedo = 0.3;
|
458
|
-
vec3 groundIrradiance = skyIrradiance + (1.0 - coverage) * sunIrradiance
|
459
|
-
vec3
|
460
|
-
|
461
|
-
return albedo * bouncedIrradiance * RECIPROCAL_PI4 * groundIrradianceScale;
|
473
|
+
vec3 groundIrradiance = skyIrradiance + (1.0 - coverage) * sunIrradiance;
|
474
|
+
vec3 bouncedRadiance = groundAlbedo * RECIPROCAL_PI * groundIrradiance;
|
475
|
+
return bouncedRadiance * exp(-opticalDepthToGround);
|
462
476
|
}
|
463
|
-
#endif //
|
477
|
+
#endif // GROUND_BOUNCE
|
464
478
|
|
465
479
|
vec4 marchClouds(
|
466
480
|
const vec3 rayOrigin,
|
@@ -548,28 +562,28 @@ vec4 marchClouds(
|
|
548
562
|
);
|
549
563
|
}
|
550
564
|
|
551
|
-
|
552
|
-
vec3 radiance = albedo * sunIrradiance * scattering;
|
565
|
+
vec3 radiance = sunIrradiance * approximateMultipleScattering(opticalDepth, cosTheta);
|
553
566
|
|
554
|
-
#ifdef
|
567
|
+
#ifdef GROUND_BOUNCE
|
555
568
|
// Fudge factor for the irradiance from ground.
|
556
569
|
if (height < shadowTopHeight && mipLevel < 0.5) {
|
557
|
-
|
570
|
+
vec3 groundRadiance = approximateRadianceFromGround(
|
558
571
|
position,
|
559
572
|
surfaceNormal,
|
560
573
|
height,
|
561
574
|
mipLevel,
|
562
575
|
jitter
|
563
576
|
);
|
577
|
+
radiance += groundRadiance * RECIPROCAL_PI4 * groundBounceScale;
|
564
578
|
}
|
565
|
-
#endif //
|
579
|
+
#endif // GROUND_BOUNCE
|
566
580
|
|
567
581
|
// Crude approximation of sky gradient. Better than none in the shadows.
|
568
|
-
float skyGradient = dot(0.5 +
|
569
|
-
radiance +=
|
582
|
+
float skyGradient = dot(weather.heightFraction * 0.5 + 0.5, media.weight);
|
583
|
+
radiance += skyIrradiance * RECIPROCAL_PI4 * skyGradient * skyLightScale;
|
570
584
|
|
571
|
-
// Finally multiply by
|
572
|
-
radiance *= media.
|
585
|
+
// Finally multiply by scattering.
|
586
|
+
radiance *= media.scattering;
|
573
587
|
|
574
588
|
#ifdef POWDER
|
575
589
|
radiance *= 1.0 - powderScale * exp(-media.extinction * powderExponent);
|
@@ -622,7 +636,7 @@ float marchShadowLength(
|
|
622
636
|
float maxRayDistance = rayNearFar.y - rayNearFar.x;
|
623
637
|
float stepSize = minShadowLengthStepSize;
|
624
638
|
float rayDistance = stepSize * jitter;
|
625
|
-
const float attenuationFactor = 1.0 -
|
639
|
+
const float attenuationFactor = 1.0 - 5e-4;
|
626
640
|
float attenuation = 1.0;
|
627
641
|
|
628
642
|
// TODO: This march is closed, and sample resolution can be much lower.
|
@@ -634,14 +648,6 @@ float marchShadowLength(
|
|
634
648
|
vec3 position = rayDistance * rayDirection + rayOrigin;
|
635
649
|
float opticalDepth = sampleShadowOpticalDepth(position, 0.0, 0.0, jitter);
|
636
650
|
shadowLength += (1.0 - exp(-opticalDepth)) * stepSize * attenuation;
|
637
|
-
|
638
|
-
// Hack to prevent over-integration of shadow length. The shadow should be
|
639
|
-
// attenuated by the inscatter as the ray travels further.
|
640
|
-
attenuation *= attenuationFactor;
|
641
|
-
if (attenuation < 1e-5) {
|
642
|
-
break;
|
643
|
-
}
|
644
|
-
|
645
651
|
stepSize *= perspectiveStepScale;
|
646
652
|
rayDistance += stepSize;
|
647
653
|
}
|
@@ -668,25 +674,33 @@ vec4 approximateHaze(
|
|
668
674
|
return vec4(0.0); // Prevent artifact in views from space
|
669
675
|
}
|
670
676
|
|
677
|
+
// Blend two normals by the difference in angle so that normal near the
|
678
|
+
// ground becomes that of the origin, and in the sky that of the horizon.
|
679
|
+
vec3 normalAtOrigin = normalize(rayOrigin);
|
680
|
+
vec3 normalAtHorizon = (rayOrigin - dot(rayOrigin, rayDirection) * rayDirection) / bottomRadius;
|
681
|
+
float alpha = remapClamped(dot(normalAtOrigin, normalAtHorizon), 0.9, 1.0);
|
682
|
+
vec3 normal = mix(normalAtOrigin, normalAtHorizon, alpha);
|
683
|
+
|
671
684
|
// Analytical optical depth where density exponentially decreases with height.
|
672
685
|
// Based on: https://iquilezles.org/articles/fog/
|
673
|
-
float angle = max(dot(
|
686
|
+
float angle = max(dot(normal, rayDirection), 1e-5);
|
674
687
|
float exponent = angle * hazeExponent;
|
688
|
+
float linearTerm = density / hazeExponent / angle;
|
689
|
+
|
675
690
|
// Derive the optical depths separately for with and without shadow length.
|
676
691
|
float expTerm = 1.0 - exp(-maxRayDistance * exponent);
|
677
692
|
float shadowExpTerm = 1.0 - exp(-min(maxRayDistance, shadowLength) * exponent);
|
678
|
-
float linearTerm = density / hazeExponent / angle;
|
679
693
|
float opticalDepth = expTerm * linearTerm;
|
680
|
-
float
|
694
|
+
float shadowOpticalDepth = max((expTerm - shadowExpTerm) * linearTerm, 0.0);
|
695
|
+
float transmittance = saturate(1.0 - exp(-opticalDepth));
|
696
|
+
float shadowTransmittance = saturate(1.0 - exp(-shadowOpticalDepth));
|
681
697
|
|
682
698
|
vec3 skyIrradiance = vGroundIrradiance.sky;
|
683
699
|
vec3 sunIrradiance = vGroundIrradiance.sun;
|
684
|
-
vec3
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
// Inscatter is attenuated by shadow length, but transmittance is not.
|
689
|
-
return vec4(inscatter, saturate(1.0 - exp(-opticalDepth)));
|
700
|
+
vec3 inscatter = sunIrradiance * phaseFunction(cosTheta) * shadowTransmittance;
|
701
|
+
inscatter += skyIrradiance * RECIPROCAL_PI4 * skyLightScale * transmittance;
|
702
|
+
inscatter *= hazeScatteringCoefficient / (hazeAbsorptionCoefficient + hazeScatteringCoefficient);
|
703
|
+
return vec4(inscatter, transmittance);
|
690
704
|
}
|
691
705
|
|
692
706
|
#endif // HAZE
|
@@ -705,8 +719,7 @@ void applyAerialPerspective(
|
|
705
719
|
sunDirection,
|
706
720
|
transmittance
|
707
721
|
);
|
708
|
-
|
709
|
-
color.rgb = mix(vec3(0.0), color.rgb * transmittance / clampedAlpha + inscatter, color.a);
|
722
|
+
color.rgb = color.rgb * transmittance + inscatter * color.a;
|
710
723
|
}
|
711
724
|
|
712
725
|
bool rayIntersectsGround(const vec3 cameraPosition, const vec3 rayDirection) {
|
@@ -985,7 +998,8 @@ void main() {
|
|
985
998
|
cosTheta,
|
986
999
|
shadowLength
|
987
1000
|
);
|
988
|
-
color = color
|
1001
|
+
color.rgb = mix(color.rgb, haze.rgb, haze.a);
|
1002
|
+
color.a = color.a * (1.0 - haze.a) + haze.a;
|
989
1003
|
#endif // HAZE
|
990
1004
|
|
991
1005
|
outputColor = color;
|
package/src/shaders/clouds.glsl
CHANGED
@@ -167,7 +167,7 @@ MediaSample sampleMedia(
|
|
167
167
|
}
|
168
168
|
#endif // SHAPE_DETAIL
|
169
169
|
|
170
|
-
//
|
170
|
+
// Apply the density profiles.
|
171
171
|
density = saturate(density * densityScales * getLayerDensity(weather.heightFraction));
|
172
172
|
|
173
173
|
MediaSample media;
|
package/src/shaders/clouds.vert
CHANGED
@@ -1,8 +1,21 @@
|
|
1
1
|
precision highp float;
|
2
2
|
precision highp sampler3D;
|
3
3
|
|
4
|
-
#include "atmosphere/
|
5
|
-
|
4
|
+
#include "atmosphere/bruneton/definitions"
|
5
|
+
|
6
|
+
uniform AtmosphereParameters ATMOSPHERE;
|
7
|
+
uniform vec3 SUN_SPECTRAL_RADIANCE_TO_LUMINANCE;
|
8
|
+
uniform vec3 SKY_SPECTRAL_RADIANCE_TO_LUMINANCE;
|
9
|
+
|
10
|
+
uniform sampler2D transmittance_texture;
|
11
|
+
uniform sampler3D scattering_texture;
|
12
|
+
uniform sampler2D irradiance_texture;
|
13
|
+
uniform sampler3D single_mie_scattering_texture;
|
14
|
+
uniform sampler3D higher_order_scattering_texture;
|
15
|
+
|
16
|
+
#include "atmosphere/bruneton/common"
|
17
|
+
#include "atmosphere/bruneton/runtime"
|
18
|
+
|
6
19
|
#include "types"
|
7
20
|
|
8
21
|
uniform mat4 inverseProjectionMatrix;
|
@@ -32,7 +45,7 @@ out GroundIrradiance vGroundIrradiance;
|
|
32
45
|
out CloudsIrradiance vCloudsIrradiance;
|
33
46
|
|
34
47
|
void sampleSunSkyIrradiance(const vec3 positionECEF) {
|
35
|
-
vGroundIrradiance.sun =
|
48
|
+
vGroundIrradiance.sun = GetSunAndSkyScalarIrradiance(
|
36
49
|
positionECEF * METER_TO_LENGTH_UNIT,
|
37
50
|
sunDirection,
|
38
51
|
vGroundIrradiance.sky
|
@@ -40,12 +53,12 @@ void sampleSunSkyIrradiance(const vec3 positionECEF) {
|
|
40
53
|
|
41
54
|
vec3 surfaceNormal = normalize(positionECEF);
|
42
55
|
vec2 radii = (bottomRadius + vec2(minHeight, maxHeight)) * METER_TO_LENGTH_UNIT;
|
43
|
-
vCloudsIrradiance.minSun =
|
56
|
+
vCloudsIrradiance.minSun = GetSunAndSkyScalarIrradiance(
|
44
57
|
surfaceNormal * radii.x,
|
45
58
|
sunDirection,
|
46
59
|
vCloudsIrradiance.minSky
|
47
60
|
);
|
48
|
-
vCloudsIrradiance.maxSun =
|
61
|
+
vCloudsIrradiance.maxSun = GetSunAndSkyScalarIrradiance(
|
49
62
|
surfaceNormal * radii.y,
|
50
63
|
sunDirection,
|
51
64
|
vCloudsIrradiance.maxSky
|
@@ -11,7 +11,6 @@ uniform vec3 sunDirection;
|
|
11
11
|
// Participating medium
|
12
12
|
uniform float scatteringCoefficient;
|
13
13
|
uniform float absorptionCoefficient;
|
14
|
-
uniform vec3 albedo;
|
15
14
|
|
16
15
|
// Primary raymarch
|
17
16
|
uniform float minDensity;
|
@@ -43,6 +42,8 @@ uniform float turbulenceDisplacement;
|
|
43
42
|
#ifdef HAZE
|
44
43
|
uniform float hazeDensityScale;
|
45
44
|
uniform float hazeExponent;
|
45
|
+
uniform float hazeScatteringCoefficient;
|
46
|
+
uniform float hazeAbsorptionCoefficient;
|
46
47
|
#endif // HAZE
|
47
48
|
|
48
49
|
// Cloud layers
|
@@ -61,4 +62,4 @@ uniform float maxHeight;
|
|
61
62
|
uniform float shadowTopHeight;
|
62
63
|
uniform float shadowBottomHeight;
|
63
64
|
uniform vec4 shadowLayerMask;
|
64
|
-
uniform
|
65
|
+
uniform CloudDensityProfile densityProfile;
|
package/src/shaders/types.glsl
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#ifdef VARIANCE_9_SAMPLES
|
2
|
-
#define VARIANCE_OFFSET_COUNT
|
2
|
+
#define VARIANCE_OFFSET_COUNT 8
|
3
3
|
const ivec2 varianceOffsets[8] = ivec2[8](
|
4
4
|
ivec2(-1, -1),
|
5
5
|
ivec2(-1, 1),
|
@@ -11,7 +11,7 @@ const ivec2 varianceOffsets[8] = ivec2[8](
|
|
11
11
|
ivec2(-1, 0)
|
12
12
|
);
|
13
13
|
#else // VARIANCE_9_SAMPLES
|
14
|
-
#define VARIANCE_OFFSET_COUNT
|
14
|
+
#define VARIANCE_OFFSET_COUNT 4
|
15
15
|
const ivec2 varianceOffsets[4] = ivec2[4](ivec2(1, 0), ivec2(0, -1), ivec2(0, 1), ivec2(-1, 0));
|
16
16
|
#endif // VARIANCE_9_SAMPLES
|
17
17
|
|
package/src/uniforms.ts
CHANGED
@@ -8,11 +8,11 @@ import {
|
|
8
8
|
type Vector2
|
9
9
|
} from 'three'
|
10
10
|
import invariant from 'tiny-invariant'
|
11
|
-
import {
|
11
|
+
import type { Primitive } from 'type-fest'
|
12
12
|
|
13
|
-
import {
|
13
|
+
import type { AtmosphereParameters } from '@takram/three-atmosphere'
|
14
14
|
|
15
|
-
import {
|
15
|
+
import type { CloudLayers } from './CloudLayers'
|
16
16
|
|
17
17
|
export interface CloudParameterUniforms {
|
18
18
|
// Participating medium
|
package/types/CloudsEffect.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Effect, Resolution } from 'postprocessing';
|
2
|
-
import { Camera, Data3DTexture, EventDispatcher, Matrix4, Texture, Uniform, Vector2, Vector3,
|
2
|
+
import { Camera, Data3DTexture, EventDispatcher, Matrix4, Texture, Uniform, Vector2, Vector3, DepthPackingStrategies, TextureDataType, WebGLRenderer, WebGLRenderTarget } from 'three';
|
3
3
|
import { AtmosphereParameters, AtmosphereOverlay, AtmosphereShadow, AtmosphereShadowLength } from '@takram/three-atmosphere';
|
4
4
|
import { UniformMap, Ellipsoid, PropertyShorthand, UniformShorthand } from '@takram/three-geospatial';
|
5
5
|
import { CascadedShadowMaps } from './CascadedShadowMaps';
|
@@ -11,8 +11,8 @@ import { ProceduralTexture } from './ProceduralTexture';
|
|
11
11
|
import { QualityPreset } from './qualityPresets';
|
12
12
|
import { ShadowMaterial } from './ShadowMaterial';
|
13
13
|
import { ShadowPass } from './ShadowPass';
|
14
|
-
declare const cloudsUniformKeys: ["maxIterationCount", "minStepSize", "maxStepSize", "maxRayDistance", "perspectiveStepScale", "minDensity", "minExtinction", "minTransmittance", "maxIterationCountToSun", "maxIterationCountToGround", "minSecondaryStepSize", "secondaryStepScale", "maxShadowFilterRadius", "maxShadowLengthIterationCount", "minShadowLengthStepSize", "maxShadowLengthRayDistance", "hazeDensityScale", "hazeExponent"];
|
15
|
-
declare const cloudsMaterialParameterKeys: ["multiScatteringOctaves", "
|
14
|
+
declare const cloudsUniformKeys: ["maxIterationCount", "minStepSize", "maxStepSize", "maxRayDistance", "perspectiveStepScale", "minDensity", "minExtinction", "minTransmittance", "maxIterationCountToSun", "maxIterationCountToGround", "minSecondaryStepSize", "secondaryStepScale", "maxShadowFilterRadius", "maxShadowLengthIterationCount", "minShadowLengthStepSize", "maxShadowLengthRayDistance", "hazeDensityScale", "hazeExponent", "hazeScatteringCoefficient", "hazeAbsorptionCoefficient"];
|
15
|
+
declare const cloudsMaterialParameterKeys: ["multiScatteringOctaves", "accurateSunSkyLight", "accuratePhaseFunction"];
|
16
16
|
declare const shadowUniformKeys: ["maxIterationCount", "minStepSize", "maxStepSize", "minDensity", "minExtinction", "minTransmittance", "opticalDepthTailScale"];
|
17
17
|
declare const shadowMaterialParameterKeys: ["temporalJitter"];
|
18
18
|
declare const shadowPassParameterKeys: ["temporalPass"];
|
@@ -140,10 +140,18 @@ export declare class CloudsEffect extends Effect {
|
|
140
140
|
set scatterAnisotropy2(value: number);
|
141
141
|
get scatterAnisotropyMix(): number;
|
142
142
|
set scatterAnisotropyMix(value: number);
|
143
|
+
/** @deprecated Use skyLightScale instead. */
|
143
144
|
get skyIrradianceScale(): number;
|
145
|
+
/** @deprecated Use skyLightScale instead. */
|
144
146
|
set skyIrradianceScale(value: number);
|
147
|
+
get skyLightScale(): number;
|
148
|
+
set skyLightScale(value: number);
|
149
|
+
/** @deprecated Use groundBounceScale instead. */
|
145
150
|
get groundIrradianceScale(): number;
|
151
|
+
/** @deprecated Use groundBounceScale instead. */
|
146
152
|
set groundIrradianceScale(value: number);
|
153
|
+
get groundBounceScale(): number;
|
154
|
+
set groundBounceScale(value: number);
|
147
155
|
get powderScale(): number;
|
148
156
|
set powderScale(value: number);
|
149
157
|
get powderExponent(): number;
|
@@ -151,16 +159,18 @@ export declare class CloudsEffect extends Effect {
|
|
151
159
|
get atmosphereOverlay(): AtmosphereOverlay | null;
|
152
160
|
get atmosphereShadow(): AtmosphereShadow | null;
|
153
161
|
get atmosphereShadowLength(): AtmosphereShadowLength | null;
|
154
|
-
get irradianceTexture():
|
155
|
-
set irradianceTexture(value:
|
162
|
+
get irradianceTexture(): Texture | null;
|
163
|
+
set irradianceTexture(value: Texture | null);
|
156
164
|
get scatteringTexture(): Data3DTexture | null;
|
157
165
|
set scatteringTexture(value: Data3DTexture | null);
|
158
|
-
get transmittanceTexture():
|
159
|
-
set transmittanceTexture(value:
|
166
|
+
get transmittanceTexture(): Texture | null;
|
167
|
+
set transmittanceTexture(value: Texture | null);
|
168
|
+
get singleMieScatteringTexture(): Data3DTexture | null;
|
169
|
+
set singleMieScatteringTexture(value: Data3DTexture | null);
|
170
|
+
get higherOrderScatteringTexture(): Data3DTexture | null;
|
171
|
+
set higherOrderScatteringTexture(value: Data3DTexture | null);
|
160
172
|
get ellipsoid(): Ellipsoid;
|
161
173
|
set ellipsoid(value: Ellipsoid);
|
162
|
-
get photometric(): boolean;
|
163
|
-
set photometric(value: boolean);
|
164
174
|
get sunAngularRadius(): number;
|
165
175
|
set sunAngularRadius(value: number);
|
166
176
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Matrix4, Uniform, Vector2,
|
1
|
+
import { Matrix4, Uniform, Vector2, BufferGeometry, Camera, Data3DTexture, DataArrayTexture, Group, Object3D, Scene, Texture, WebGLRenderer } from 'three';
|
2
2
|
import { AtmosphereMaterialBase, AtmosphereParameters, AtmosphereMaterialBaseUniforms } from '@takram/three-atmosphere';
|
3
3
|
import { AtmosphereUniforms, CloudLayerUniforms, CloudParameterUniforms } from './uniforms';
|
4
4
|
declare module 'three' {
|
@@ -26,9 +26,8 @@ export interface CloudsMaterialUniforms extends CloudParameterUniforms, CloudLay
|
|
26
26
|
targetUvScale: Uniform<Vector2>;
|
27
27
|
mipLevelScale: Uniform<number>;
|
28
28
|
stbnTexture: Uniform<Data3DTexture | null>;
|
29
|
-
|
30
|
-
|
31
|
-
groundIrradianceScale: Uniform<number>;
|
29
|
+
skyLightScale: Uniform<number>;
|
30
|
+
groundBounceScale: Uniform<number>;
|
32
31
|
powderScale: Uniform<number>;
|
33
32
|
powderExponent: Uniform<number>;
|
34
33
|
maxIterationCount: Uniform<number>;
|
@@ -54,6 +53,8 @@ export interface CloudsMaterialUniforms extends CloudParameterUniforms, CloudLay
|
|
54
53
|
maxShadowLengthRayDistance: Uniform<number>;
|
55
54
|
hazeDensityScale: Uniform<number>;
|
56
55
|
hazeExponent: Uniform<number>;
|
56
|
+
hazeScatteringCoefficient: Uniform<number>;
|
57
|
+
hazeAbsorptionCoefficient: Uniform<number>;
|
57
58
|
}
|
58
59
|
export declare class CloudsMaterial extends AtmosphereMaterialBase {
|
59
60
|
uniforms: AtmosphereMaterialBaseUniforms & CloudsMaterialUniforms;
|
@@ -75,7 +76,11 @@ export declare class CloudsMaterial extends AtmosphereMaterialBase {
|
|
75
76
|
shadowLength: boolean;
|
76
77
|
haze: boolean;
|
77
78
|
multiScatteringOctaves: number;
|
78
|
-
|
79
|
+
/** @deprecated Use accurateSunSkyLight instead. */
|
80
|
+
get accurateSunSkyIrradiance(): boolean;
|
81
|
+
/** @deprecated Use accurateSunSkyLight instead. */
|
82
|
+
set accurateSunSkyIrradiance(value: boolean);
|
83
|
+
accurateSunSkyLight: boolean;
|
79
84
|
accuratePhaseFunction: boolean;
|
80
85
|
shadowCascadeCount: number;
|
81
86
|
shadowSampleCount: number;
|
@@ -1,6 +1,8 @@
|
|
1
|
+
import { FC, Ref } from 'react';
|
1
2
|
import { ExpandNestedProps } from '@takram/three-geospatial/r3f';
|
2
3
|
import { CloudLayer as CloudLayerImpl, CloudLayerLike } from '../CloudLayer';
|
3
4
|
export interface CloudLayerProps extends CloudLayerLike, ExpandNestedProps<CloudLayerLike, 'densityProfile'> {
|
5
|
+
ref?: Ref<CloudLayerImpl>;
|
4
6
|
index?: number;
|
5
7
|
}
|
6
|
-
export declare const CloudLayer:
|
8
|
+
export declare const CloudLayer: FC<CloudLayerProps>;
|
package/types/r3f/Clouds.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { ElementProps } from '@react-three/fiber';
|
2
|
+
import { FC } from 'react';
|
2
3
|
import { Data3DTexture, Texture } from 'three';
|
3
4
|
import { ExpandNestedProps } from '@takram/three-geospatial/r3f';
|
4
5
|
import { CloudsEffect } from '../CloudsEffect';
|
@@ -12,4 +13,4 @@ export interface CloudsProps extends Omit<ElementProps<typeof CloudsEffect, Clou
|
|
12
13
|
turbulenceTexture?: Texture | ProceduralTexture | string;
|
13
14
|
stbnTexture?: Data3DTexture | string;
|
14
15
|
}
|
15
|
-
export declare const Clouds:
|
16
|
+
export declare const Clouds: FC<CloudsProps>;
|