Browse Source

Updated shaders to FSR 3.1.3:

- Color clamp now uses ellipsoid instead of AABB to help with ghosting streaks
- Moved velocity factor to a different section of the accumulate pass
fsr3.1.1
Nico de Poel 1 year ago
parent
commit
922e89f9fe
  1. 23
      Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h
  2. 2
      Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h
  3. 2
      Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h

23
Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_accumulate.h

@ -52,21 +52,20 @@ void RectifyHistory(
const FfxFloat32 fReactiveFactor = ffxPow(params.fReactiveMask, 1.0f / 2.0f); const FfxFloat32 fReactiveFactor = ffxPow(params.fReactiveMask, 1.0f / 2.0f);
const FfxFloat32 fShadingChangeFactor = params.fShadingChange; const FfxFloat32 fShadingChangeFactor = params.fShadingChange;
const FfxFloat32 fBoxScaleT = ffxMax(fVecolityFactor, ffxMax(fDistanceFactor, ffxMax(fAccumulationFactor, ffxMax(fReactiveFactor, fShadingChangeFactor)))); const FfxFloat32 fBoxScaleT = ffxMax(fVecolityFactor, ffxMax(fDistanceFactor, ffxMax(fAccumulationFactor, ffxMax(fReactiveFactor, fShadingChangeFactor))));
const FfxFloat32 fBoxScale = ffxLerp(3.0f, 1.0f, fBoxScaleT);
const FfxFloat32x3 fScaledBoxVec = data.clippingBox.boxVec * FfxFloat32x3(1.7f, 1.0f, 1.0f) * fBoxScale;
const FfxFloat32 fBoxScale = ffxLerp(3.0f, 1.0f, fBoxScaleT);
const FfxFloat32x3 fScaledBoxVec = data.clippingBox.boxVec * fBoxScale;
const FfxFloat32x3 fBoxMin = data.clippingBox.boxCenter - fScaledBoxVec;
const FfxFloat32x3 fBoxMax = data.clippingBox.boxCenter + fScaledBoxVec;
if (any(FFX_GREATER_THAN(fBoxMin, data.fHistoryColor)) || any(FFX_GREATER_THAN(data.fHistoryColor, fBoxMax))) {
const FfxFloat32x3 fClampedHistoryColor = clamp(data.fHistoryColor, fBoxMin, fBoxMax);
const FfxFloat32x3 fClampedScaledBoxVec = ffxMax(fScaledBoxVec, FfxFloat32x3(1.193e-7f, 1.193e-7f, 1.193e-7f));
const FfxFloat32x3 fTransformedHistoryColor = (data.fHistoryColor - data.clippingBox.boxCenter) / fClampedScaledBoxVec;
const FfxFloat32 fHistoryContribution = ffxMax(params.fLumaInstabilityFactor, data.fLockContributionThisFrame) * params.fAccumulation * (1 - params.fDisocclusion);
if (length(fTransformedHistoryColor)>1.f) {
const FfxFloat32x3 fClampedHistoryColor = normalize(fTransformedHistoryColor);
const FfxFloat32x3 fFinalClampedHistoryColor = (fClampedHistoryColor * fScaledBoxVec) + data.clippingBox.boxCenter;
// Scale history color using rectification info, also using accumulation mask to avoid potential invalid color protection // Scale history color using rectification info, also using accumulation mask to avoid potential invalid color protection
data.fHistoryColor = ffxLerp(fClampedHistoryColor, data.fHistoryColor, ffxSaturate(fHistoryContribution));
const FfxFloat32 fHistoryContribution = ffxMax(params.fLumaInstabilityFactor, data.fLockContributionThisFrame) * params.fAccumulation * (1 - params.fDisocclusion);
data.fHistoryColor = ffxLerp(fFinalClampedHistoryColor, data.fHistoryColor, ffxSaturate(fHistoryContribution));
} }
} }
@ -97,7 +96,7 @@ void ComputeBaseAccumulationWeight(const AccumulationPassCommonParams params, FF
{ {
FfxFloat32 fBaseAccumulation = params.fAccumulation; FfxFloat32 fBaseAccumulation = params.fAccumulation;
fBaseAccumulation = ffxMin(fBaseAccumulation, ffxLerp(fBaseAccumulation, 0.15f, ffxSaturate(ffxMax(0.0f, params.f4KVelocity / 0.5f))));
fBaseAccumulation = ffxMin(fBaseAccumulation, ffxLerp(fBaseAccumulation, 0.15f, ffxSaturate(ffxMax(0.0f, (params.f4KVelocity * VelocityFactor()) / 0.5f))));
data.fHistoryWeight = fBaseAccumulation; data.fHistoryWeight = fBaseAccumulation;
} }

2
Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_callbacks_hlsl.h

@ -796,7 +796,7 @@ FfxFloat32 Exposure()
FfxFloat32 exposure = r_input_exposure[FfxUInt32x2(0, 0)].x; FfxFloat32 exposure = r_input_exposure[FfxUInt32x2(0, 0)].x;
#if defined(__XBOX_SCARLETT) #if defined(__XBOX_SCARLETT)
if (exposure < 0.000030517578/** 2^15 */) {
if (exposure < 0.000030517578/** 2^-15 */) {
exposure = 1.0f; exposure = 1.0f;
} }
#else #else

2
Shaders/shaders/fsr3upscaler/ffx_fsr3upscaler_common.h

@ -123,7 +123,7 @@ struct AccumulationPassCommonParams
FfxFloat32 Get4KVelocity(FfxFloat32x2 fMotionVector) FfxFloat32 Get4KVelocity(FfxFloat32x2 fMotionVector)
{ {
return length(fMotionVector * FfxFloat32x2(3840.0f, 2160.0f)) * VelocityFactor();
return length(fMotionVector * FfxFloat32x2(3840.0f, 2160.0f));
} }
struct RectificationBox struct RectificationBox

Loading…
Cancel
Save