@react-three/postprocessing 2.14.10 → 2.14.11

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.
@@ -8,7 +8,7 @@ export type OutlineProps = ConstructorParameters<typeof OutlineEffect>[2] & Part
8
8
  }>;
9
9
  export declare const Outline: import("react").ForwardRefExoticComponent<{
10
10
  blendFunction?: import("postprocessing").BlendFunction | undefined;
11
- patternTexture?: number | undefined;
11
+ patternTexture?: import("three").Texture | undefined;
12
12
  patternScale?: number | undefined;
13
13
  edgeStrength?: number | undefined;
14
14
  pulseSpeed?: number | undefined;
package/dist/index.cjs CHANGED
@@ -930,7 +930,7 @@ void main() {
930
930
  #define SAMPLES 16
931
931
  #define FSAMPLES 16.0
932
932
  uniform sampler2D sceneDiffuse;
933
- uniform sampler2D sceneNormal;
933
+ uniform highp sampler2D sceneNormal;
934
934
  uniform highp sampler2D sceneDepth;
935
935
  uniform mat4 projectionMatrixInv;
936
936
  uniform mat4 viewMatrixInv;
@@ -980,7 +980,7 @@ uniform sampler2D bluenoise;
980
980
  float b = farZ * nearZ / (nearZ - farZ);
981
981
  float linDepth = a + b / depth;
982
982
  vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;
983
- vec4 wpos = viewMatrixInv * projectionMatrixInv * clipVec;
983
+ vec4 wpos = projectionMatrixInv * clipVec;
984
984
  return wpos.xyz / wpos.w;
985
985
  }
986
986
  vec3 getWorldPos(float depth, vec2 coord) {
@@ -991,7 +991,7 @@ uniform sampler2D bluenoise;
991
991
  vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
992
992
  vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;
993
993
  // Perspective division
994
- vec4 worldSpacePosition = viewMatrixInv * viewSpacePosition;
994
+ vec4 worldSpacePosition = viewSpacePosition;
995
995
  worldSpacePosition.xyz /= worldSpacePosition.w;
996
996
  return worldSpacePosition.xyz;
997
997
  }
@@ -1070,7 +1070,7 @@ void main() {
1070
1070
  ;
1071
1071
  float moveAmt = samplesR[int(mod(i + noise.a * FSAMPLES, FSAMPLES))];
1072
1072
  vec3 samplePos = worldPos + radiusToUse * moveAmt * sampleDirection;
1073
- vec4 offset = projViewMat * vec4(samplePos, 1.0);
1073
+ vec4 offset = projMat * vec4(samplePos, 1.0);
1074
1074
  offset.xyz /= offset.w;
1075
1075
  offset.xyz = offset.xyz * 0.5 + 0.5;
1076
1076
  float sampleDepth = textureLod(sceneDepth, offset.xy, 0.0).x;
@@ -1206,8 +1206,8 @@ const $12b21d24d1192a04$export$a815acccbd2c9a49 = {
1206
1206
  /* glsl */
1207
1207
  `
1208
1208
  uniform sampler2D sceneDiffuse;
1209
- uniform sampler2D sceneDepth;
1210
- uniform sampler2D downsampledDepth;
1209
+ uniform highp sampler2D sceneDepth;
1210
+ uniform highp sampler2D downsampledDepth;
1211
1211
  uniform sampler2D tDiffuse;
1212
1212
  uniform sampler2D blueNoise;
1213
1213
  uniform vec2 resolution;
@@ -1260,7 +1260,7 @@ const $12b21d24d1192a04$export$a815acccbd2c9a49 = {
1260
1260
  float b = farZ * nearZ / (nearZ - farZ);
1261
1261
  float linDepth = a + b / depth;
1262
1262
  vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;
1263
- vec4 wpos = viewMatrixInv * projectionMatrixInv * clipVec;
1263
+ vec4 wpos = projectionMatrixInv * clipVec;
1264
1264
  return wpos.xyz / wpos.w;
1265
1265
  }
1266
1266
  vec3 getWorldPos(float depth, vec2 coord) {
@@ -1273,7 +1273,7 @@ const $12b21d24d1192a04$export$a815acccbd2c9a49 = {
1273
1273
  vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
1274
1274
  vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;
1275
1275
  // Perspective division
1276
- vec4 worldSpacePosition = viewMatrixInv * viewSpacePosition;
1276
+ vec4 worldSpacePosition = viewSpacePosition;
1277
1277
  worldSpacePosition.xyz /= worldSpacePosition.w;
1278
1278
  return worldSpacePosition.xyz;
1279
1279
  }
@@ -1528,7 +1528,7 @@ const $e52378cd0f5a973d$export$57856b59f317262e = {
1528
1528
  float b = farZ * nearZ / (nearZ - farZ);
1529
1529
  float linDepth = a + b / depth;
1530
1530
  vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;
1531
- vec4 wpos = viewMatrixInv * projectionMatrixInv * clipVec;
1531
+ vec4 wpos = projectionMatrixInv * clipVec;
1532
1532
  return wpos.xyz / wpos.w;
1533
1533
  }
1534
1534
  vec3 getWorldPos(float depth, vec2 coord) {
@@ -1540,7 +1540,7 @@ const $e52378cd0f5a973d$export$57856b59f317262e = {
1540
1540
  vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
1541
1541
  vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;
1542
1542
  // Perspective division
1543
- vec4 worldSpacePosition = viewMatrixInv * viewSpacePosition;
1543
+ vec4 worldSpacePosition = viewSpacePosition;
1544
1544
  worldSpacePosition.xyz /= worldSpacePosition.w;
1545
1545
  return worldSpacePosition.xyz;
1546
1546
  }
@@ -1557,6 +1557,10 @@ const $e52378cd0f5a973d$export$57856b59f317262e = {
1557
1557
  vec3 normal = data.rgb * 2.0 - 1.0;
1558
1558
  float count = 1.0;
1559
1559
  float d = texture2D(sceneDepth, vUv).x;
1560
+ if (d == 1.0) {
1561
+ gl_FragColor = data;
1562
+ return;
1563
+ }
1560
1564
  vec3 worldPos = getWorldPos(d, vUv);
1561
1565
  float size = radius;
1562
1566
  float angle;
@@ -1589,7 +1593,7 @@ const $e52378cd0f5a973d$export$57856b59f317262e = {
1589
1593
  float dSample = texture2D(sceneDepth, uv + offset).x;
1590
1594
  vec3 worldPosSample = getWorldPos(dSample, uv + offset);
1591
1595
  float tangentPlaneDist = abs(dot(worldPos - worldPosSample, normal));
1592
- float rangeCheck = exp(-1.0 * tangentPlaneDist * (1.0 / distanceFalloffToUse)) * max(dot(normal, normalSample), 0.0) * (1.0 - abs(occSample - baseOcc));
1596
+ float rangeCheck = dSample == 1.0 ? 0.0 :exp(-1.0 * tangentPlaneDist * (1.0 / distanceFalloffToUse)) * max(dot(normal, normalSample), 0.0) * (1.0 - abs(occSample - baseOcc));
1593
1597
  occlusion += occSample * rangeCheck;
1594
1598
  count += rangeCheck;
1595
1599
  }
@@ -1635,7 +1639,7 @@ const $26aca173e0984d99$export$1efdf491687cd442 = {
1635
1639
  fragmentShader: (
1636
1640
  /* glsl */
1637
1641
  `
1638
- uniform sampler2D sceneDepth;
1642
+ uniform highp sampler2D sceneDepth;
1639
1643
  uniform vec2 resolution;
1640
1644
  uniform float near;
1641
1645
  uniform float far;
@@ -1654,7 +1658,7 @@ const $26aca173e0984d99$export$1efdf491687cd442 = {
1654
1658
  float b = farZ * nearZ / (nearZ - farZ);
1655
1659
  float linDepth = a + b / depth;
1656
1660
  vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;
1657
- vec4 wpos = viewMatrixInv * projectionMatrixInv * clipVec;
1661
+ vec4 wpos = projectionMatrixInv * clipVec;
1658
1662
  return wpos.xyz / wpos.w;
1659
1663
  }
1660
1664
  vec3 getWorldPos(float depth, vec2 coord) {
@@ -1665,7 +1669,7 @@ const $26aca173e0984d99$export$1efdf491687cd442 = {
1665
1669
  vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
1666
1670
  vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;
1667
1671
  // Perspective division
1668
- vec4 worldSpacePosition = viewMatrixInv * viewSpacePosition;
1672
+ vec4 worldSpacePosition = viewSpacePosition;
1669
1673
  worldSpacePosition.xyz /= worldSpacePosition.w;
1670
1674
  return worldSpacePosition.xyz;
1671
1675
  }