@react-three/postprocessing 2.14.10 → 2.14.12

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/dist/index.js CHANGED
@@ -310,11 +310,7 @@ const Bloom = wrapEffect(BloomEffect, {
310
310
  blendFunction: BlendFunction.ADD
311
311
  });
312
312
  const BrightnessContrast = wrapEffect(BrightnessContrastEffect);
313
- const ChromaticAberration = forwardRef(function ChromaticAberration2(props, ref) {
314
- const offset = useVector2(props, "offset");
315
- const effect = useMemo(() => new ChromaticAberrationEffect({ ...props, offset }), [offset, props]);
316
- return /* @__PURE__ */ jsx("primitive", { ref, object: effect, dispose: null });
317
- });
313
+ const ChromaticAberration = wrapEffect(ChromaticAberrationEffect);
318
314
  const ColorAverage = forwardRef(function ColorAverage2({ blendFunction = BlendFunction.NORMAL }, ref) {
319
315
  const effect = useMemo(() => new ColorAverageEffect(blendFunction), [blendFunction]);
320
316
  return /* @__PURE__ */ jsx("primitive", { ref, object: effect, dispose: null });
@@ -912,7 +908,7 @@ void main() {
912
908
  #define SAMPLES 16
913
909
  #define FSAMPLES 16.0
914
910
  uniform sampler2D sceneDiffuse;
915
- uniform sampler2D sceneNormal;
911
+ uniform highp sampler2D sceneNormal;
916
912
  uniform highp sampler2D sceneDepth;
917
913
  uniform mat4 projectionMatrixInv;
918
914
  uniform mat4 viewMatrixInv;
@@ -962,7 +958,7 @@ uniform sampler2D bluenoise;
962
958
  float b = farZ * nearZ / (nearZ - farZ);
963
959
  float linDepth = a + b / depth;
964
960
  vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;
965
- vec4 wpos = viewMatrixInv * projectionMatrixInv * clipVec;
961
+ vec4 wpos = projectionMatrixInv * clipVec;
966
962
  return wpos.xyz / wpos.w;
967
963
  }
968
964
  vec3 getWorldPos(float depth, vec2 coord) {
@@ -973,7 +969,7 @@ uniform sampler2D bluenoise;
973
969
  vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
974
970
  vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;
975
971
  // Perspective division
976
- vec4 worldSpacePosition = viewMatrixInv * viewSpacePosition;
972
+ vec4 worldSpacePosition = viewSpacePosition;
977
973
  worldSpacePosition.xyz /= worldSpacePosition.w;
978
974
  return worldSpacePosition.xyz;
979
975
  }
@@ -1052,7 +1048,7 @@ void main() {
1052
1048
  ;
1053
1049
  float moveAmt = samplesR[int(mod(i + noise.a * FSAMPLES, FSAMPLES))];
1054
1050
  vec3 samplePos = worldPos + radiusToUse * moveAmt * sampleDirection;
1055
- vec4 offset = projViewMat * vec4(samplePos, 1.0);
1051
+ vec4 offset = projMat * vec4(samplePos, 1.0);
1056
1052
  offset.xyz /= offset.w;
1057
1053
  offset.xyz = offset.xyz * 0.5 + 0.5;
1058
1054
  float sampleDepth = textureLod(sceneDepth, offset.xy, 0.0).x;
@@ -1188,8 +1184,8 @@ const $12b21d24d1192a04$export$a815acccbd2c9a49 = {
1188
1184
  /* glsl */
1189
1185
  `
1190
1186
  uniform sampler2D sceneDiffuse;
1191
- uniform sampler2D sceneDepth;
1192
- uniform sampler2D downsampledDepth;
1187
+ uniform highp sampler2D sceneDepth;
1188
+ uniform highp sampler2D downsampledDepth;
1193
1189
  uniform sampler2D tDiffuse;
1194
1190
  uniform sampler2D blueNoise;
1195
1191
  uniform vec2 resolution;
@@ -1242,7 +1238,7 @@ const $12b21d24d1192a04$export$a815acccbd2c9a49 = {
1242
1238
  float b = farZ * nearZ / (nearZ - farZ);
1243
1239
  float linDepth = a + b / depth;
1244
1240
  vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;
1245
- vec4 wpos = viewMatrixInv * projectionMatrixInv * clipVec;
1241
+ vec4 wpos = projectionMatrixInv * clipVec;
1246
1242
  return wpos.xyz / wpos.w;
1247
1243
  }
1248
1244
  vec3 getWorldPos(float depth, vec2 coord) {
@@ -1255,7 +1251,7 @@ const $12b21d24d1192a04$export$a815acccbd2c9a49 = {
1255
1251
  vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
1256
1252
  vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;
1257
1253
  // Perspective division
1258
- vec4 worldSpacePosition = viewMatrixInv * viewSpacePosition;
1254
+ vec4 worldSpacePosition = viewSpacePosition;
1259
1255
  worldSpacePosition.xyz /= worldSpacePosition.w;
1260
1256
  return worldSpacePosition.xyz;
1261
1257
  }
@@ -1510,7 +1506,7 @@ const $e52378cd0f5a973d$export$57856b59f317262e = {
1510
1506
  float b = farZ * nearZ / (nearZ - farZ);
1511
1507
  float linDepth = a + b / depth;
1512
1508
  vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;
1513
- vec4 wpos = viewMatrixInv * projectionMatrixInv * clipVec;
1509
+ vec4 wpos = projectionMatrixInv * clipVec;
1514
1510
  return wpos.xyz / wpos.w;
1515
1511
  }
1516
1512
  vec3 getWorldPos(float depth, vec2 coord) {
@@ -1522,7 +1518,7 @@ const $e52378cd0f5a973d$export$57856b59f317262e = {
1522
1518
  vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
1523
1519
  vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;
1524
1520
  // Perspective division
1525
- vec4 worldSpacePosition = viewMatrixInv * viewSpacePosition;
1521
+ vec4 worldSpacePosition = viewSpacePosition;
1526
1522
  worldSpacePosition.xyz /= worldSpacePosition.w;
1527
1523
  return worldSpacePosition.xyz;
1528
1524
  }
@@ -1539,6 +1535,10 @@ const $e52378cd0f5a973d$export$57856b59f317262e = {
1539
1535
  vec3 normal = data.rgb * 2.0 - 1.0;
1540
1536
  float count = 1.0;
1541
1537
  float d = texture2D(sceneDepth, vUv).x;
1538
+ if (d == 1.0) {
1539
+ gl_FragColor = data;
1540
+ return;
1541
+ }
1542
1542
  vec3 worldPos = getWorldPos(d, vUv);
1543
1543
  float size = radius;
1544
1544
  float angle;
@@ -1571,7 +1571,7 @@ const $e52378cd0f5a973d$export$57856b59f317262e = {
1571
1571
  float dSample = texture2D(sceneDepth, uv + offset).x;
1572
1572
  vec3 worldPosSample = getWorldPos(dSample, uv + offset);
1573
1573
  float tangentPlaneDist = abs(dot(worldPos - worldPosSample, normal));
1574
- float rangeCheck = exp(-1.0 * tangentPlaneDist * (1.0 / distanceFalloffToUse)) * max(dot(normal, normalSample), 0.0) * (1.0 - abs(occSample - baseOcc));
1574
+ 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));
1575
1575
  occlusion += occSample * rangeCheck;
1576
1576
  count += rangeCheck;
1577
1577
  }
@@ -1617,7 +1617,7 @@ const $26aca173e0984d99$export$1efdf491687cd442 = {
1617
1617
  fragmentShader: (
1618
1618
  /* glsl */
1619
1619
  `
1620
- uniform sampler2D sceneDepth;
1620
+ uniform highp sampler2D sceneDepth;
1621
1621
  uniform vec2 resolution;
1622
1622
  uniform float near;
1623
1623
  uniform float far;
@@ -1636,7 +1636,7 @@ const $26aca173e0984d99$export$1efdf491687cd442 = {
1636
1636
  float b = farZ * nearZ / (nearZ - farZ);
1637
1637
  float linDepth = a + b / depth;
1638
1638
  vec4 clipVec = vec4(uv, linDepth, 1.0) * 2.0 - 1.0;
1639
- vec4 wpos = viewMatrixInv * projectionMatrixInv * clipVec;
1639
+ vec4 wpos = projectionMatrixInv * clipVec;
1640
1640
  return wpos.xyz / wpos.w;
1641
1641
  }
1642
1642
  vec3 getWorldPos(float depth, vec2 coord) {
@@ -1647,7 +1647,7 @@ const $26aca173e0984d99$export$1efdf491687cd442 = {
1647
1647
  vec4 clipSpacePosition = vec4(coord * 2.0 - 1.0, z, 1.0);
1648
1648
  vec4 viewSpacePosition = projectionMatrixInv * clipSpacePosition;
1649
1649
  // Perspective division
1650
- vec4 worldSpacePosition = viewMatrixInv * viewSpacePosition;
1650
+ vec4 worldSpacePosition = viewSpacePosition;
1651
1651
  worldSpacePosition.xyz /= worldSpacePosition.w;
1652
1652
  return worldSpacePosition.xyz;
1653
1653
  }