Browse Source

Set normalized device coordinates Y direction to be up, which is standard in Unity, and properly detect non-zero motion vector inputs. This *seems* to be the correct recipe.

sgsr2_fs
Nico de Poel 1 year ago
parent
commit
5b203e7ef5
  1. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/2_pass_cs/sgsr2_convert.compute
  2. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/3_pass_cs/sgsr2_convert.compute
  3. 2
      Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/sgsr2_common.hlsl

2
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/2_pass_cs/sgsr2_convert.compute

@ -68,7 +68,7 @@ void CS(uint3 gl_GlobalInvocationID : SV_DispatchThreadID)
float2 EncodedVelocity = LOAD_TEXTURE2D_X(InputVelocity, InputPos);
float2 motion;
if (EncodedVelocity.x > 0.0)
if (any(abs(EncodedVelocity) > 0.0))
{
motion = decodeVelocityFromTexture(EncodedVelocity.xy);
}

2
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/3_pass_cs/sgsr2_convert.compute

@ -58,7 +58,7 @@ void CS(uint3 gl_GlobalInvocationID : SV_DispatchThreadID)
float2 EncodedVelocity = LOAD_TEXTURE2D_X(InputVelocity, InputPos);
float2 motion;
if (EncodedVelocity.x > 0.0)
if (any(abs(EncodedVelocity) > 0.0))
{
motion = decodeVelocityFromTexture(EncodedVelocity.xy);
}

2
Packages/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/Upscaling/SGSR2/Shaders/sgsr2_common.hlsl

@ -1,5 +1,7 @@
#define EPSILON 1.192e-07f
#define REQUEST_NDC_Y_UP
#ifdef UNITY_REVERSED_Z
#define DEPTH_NEAREST(a, b) max((a), (b))
#define DEPTH_CLIP(depth) ((depth) > 1.0e-05f)

Loading…
Cancel
Save