diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h index 1c5cd16..7bd5892 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_accumulate.h @@ -135,6 +135,7 @@ FfxFloat32x3 ComputeBaseAccumulationWeight(const AccumulationPassCommonParams pa FfxFloat32 ComputeLumaInstabilityFactor(const AccumulationPassCommonParams params, RectificationBox clippingBox, FfxFloat32 fThisFrameReactiveFactor, FfxFloat32 fLuminanceDiff) { + const FfxFloat32 fUnormThreshold = 1.0f / 255.0f; const FfxInt32 N_MINUS_1 = 0; const FfxInt32 N_MINUS_2 = 1; const FfxInt32 N_MINUS_3 = 2; @@ -156,7 +157,8 @@ FfxFloat32 ComputeLumaInstabilityFactor(const AccumulationPassCommonParams param FfxFloat32 fMin = abs(fDiffs0); - if (fMin >= (1.0f / 255.0f)) { + if (fMin >= fUnormThreshold) + { for (int i = N_MINUS_2; i <= N_MINUS_4; i++) { FfxFloat32 fDiffs1 = (fCurrentFrameLuma - fCurrentFrameLumaHistory[i]); @@ -168,10 +170,13 @@ FfxFloat32 ComputeLumaInstabilityFactor(const AccumulationPassCommonParams param } } - fLumaInstability = FfxFloat32(fMin != abs(fDiffs0)); + const FfxFloat32 fBoxSize = clippingBox.boxVec.x; + const FfxFloat32 fBoxSizeFactor = ffxPow(ffxSaturate(fBoxSize / 0.1f), 6.0f); - fLumaInstability *= 1.0f - ffxMax(params.fAccumulationMask, ffxPow(fThisFrameReactiveFactor, 1.0f / 3.0f)); - fLumaInstability *= ffxLerp(1.0f, 0.0f, ffxSaturate(params.fHrVelocity / 20.0f)); + fLumaInstability = FfxFloat32(fMin != abs(fDiffs0)) * fBoxSizeFactor; + fLumaInstability = FfxFloat32(fLumaInstability > fUnormThreshold); + + fLumaInstability *= 1.0f - ffxMax(params.fAccumulationMask, ffxPow(fThisFrameReactiveFactor, 1.0f / 6.0f)); } //shift history diff --git a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h index be41b38..fa4c975 100644 --- a/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h +++ b/Packages/com.unity.postprocessing@3.2.2/PostProcessing/Shaders/FSR2/shaders/ffx_fsr2_depth_clip.h @@ -216,7 +216,7 @@ FfxFloat32x3 ComputePreparedInputColor(FfxInt32x2 iPxLrPos) return fPreparedYCoCg; } -float EvaluateSurface(FfxInt32x2 iPxPos, FfxFloat32x2 fMotionVector) +FfxFloat32 EvaluateSurface(FfxInt32x2 iPxPos, FfxFloat32x2 fMotionVector) { FfxFloat32 d0 = GetViewSpaceDepth(LoadReconstructedPrevDepth(iPxPos + FfxInt32x2(0, -1))); FfxFloat32 d1 = GetViewSpaceDepth(LoadReconstructedPrevDepth(iPxPos + FfxInt32x2(0, 0))); @@ -224,6 +224,7 @@ float EvaluateSurface(FfxInt32x2 iPxPos, FfxFloat32x2 fMotionVector) return 1.0f - FfxFloat32(((d0 - d1) > (d1 * 0.01f)) && ((d1 - d2) > (d2 * 0.01f))); } + void DepthClip(FfxInt32x2 iPxPos) { FfxFloat32x2 fDepthUv = (iPxPos + 0.5f) / RenderSize();