@takram/three-clouds 0.7.0 → 0.7.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takram/three-clouds",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "A Three.js and R3F implementation of geospatial volumetric clouds",
5
5
  "keywords": [
6
6
  "three",
@@ -45,15 +45,15 @@
45
45
  "README.md"
46
46
  ],
47
47
  "dependencies": {
48
- "@takram/three-atmosphere": "0.17.0",
49
- "@takram/three-geospatial": "0.7.0",
48
+ "@takram/three-atmosphere": "0.17.1",
49
+ "@takram/three-geospatial": "0.7.1",
50
50
  "tiny-invariant": "^1.3.3",
51
51
  "type-fest": "^5.4.4"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@react-three/fiber": ">=9.0.4",
55
55
  "@react-three/postprocessing": ">=3.0.4",
56
- "postprocessing": ">=6.38.0",
56
+ "postprocessing": ">=6.36.7",
57
57
  "react": ">=19.0",
58
58
  "three": ">=0.170.0"
59
59
  },
@@ -5,6 +5,7 @@ precision highp sampler2DArray;
5
5
  #include <common>
6
6
  #include <packing>
7
7
 
8
+ #include "core/depth"
8
9
  #include "core/math"
9
10
  #include "core/turbo"
10
11
  #include "core/generators"
@@ -97,14 +98,6 @@ layout(location = 1) out vec3 outputDepthVelocity;
97
98
  layout(location = 2) out float outputShadowLength;
98
99
  #endif // SHADOW_LENGTH
99
100
 
100
- float readDepth(const vec2 uv) {
101
- #if DEPTH_PACKING == 3201
102
- return unpackRGBAToDepth(texture(depthBuffer, uv));
103
- #else // DEPTH_PACKING == 3201
104
- return texture(depthBuffer, uv).r;
105
- #endif // DEPTH_PACKING == 3201
106
- }
107
-
108
101
  float getViewZ(const float depth) {
109
102
  #ifdef PERSPECTIVE_CAMERA
110
103
  return perspectiveDepthToViewZ(depth, cameraNear, cameraFar);
@@ -817,8 +810,10 @@ vec2 getHazeRayNearFar(const IntersectionResult intersections) {
817
810
  #endif // HAZE
818
811
 
819
812
  float getRayDistanceToScene(const vec3 rayDirection, out float viewZ) {
820
- float depth = readDepth(vUv * targetUvScale + temporalJitter);
813
+ float depth = readDepthValue(depthBuffer, vUv * targetUvScale + temporalJitter);
814
+ depth = reverseLogDepth(depth, cameraNear, cameraFar);
821
815
  if (depth < 1.0 - 1e-7) {
816
+ depth = reverseLogDepth(depth, cameraNear, cameraFar);
822
817
  viewZ = getViewZ(depth);
823
818
  return -viewZ / dot(rayDirection, vCameraDirection);
824
819
  }