From a6a1177bd83c25441e2e42e67c1f10f6aced6f72 Mon Sep 17 00:00:00 2001 From: Tim <15017472+doodlum@users.noreply.github.com> Date: Sun, 13 Oct 2024 15:37:20 +0100 Subject: [PATCH 1/2] fix: sky motion vectors --- package/Shaders/Sky.hlsl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/package/Shaders/Sky.hlsl b/package/Shaders/Sky.hlsl index 7805c84a2..cf49abdc0 100644 --- a/package/Shaders/Sky.hlsl +++ b/package/Shaders/Sky.hlsl @@ -241,7 +241,15 @@ PS_OUTPUT main(PS_INPUT input) psout.Color = float4(0, 0, 0, 1.0); # endif // OCCLUSION - float2 screenMotionVector = GetSSMotionVector(input.WorldPosition, input.PreviousWorldPosition, eyeIndex); + float3 viewPosition = mul(CameraView[eyeIndex], float4(input.WorldPosition.xyz, 1)).xyz; + float2 screenUV = FrameBuffer::ViewToUV(viewPosition, true, eyeIndex); + + float4 positionWS = half4(2 * half2(screenUV.x, -screenUV.y + 1) - 1, 1.0, 1); + positionWS = mul(CameraViewProjInverse[eyeIndex], positionWS); + positionWS.xyz = positionWS.xyz / positionWS.w; + positionWS.w = 1; + + float2 screenMotionVector = GetSSMotionVector(positionWS, positionWS, eyeIndex); psout.MotionVectors = float4(screenMotionVector, 0, psout.Color.w); psout.Normal = float4(0.5, 0.5, 0, psout.Color.w); From fe9f2f0a6a12952b326ab24cfbb9c4c7a7cb0492 Mon Sep 17 00:00:00 2001 From: doodlum Date: Sun, 13 Oct 2024 14:38:21 +0000 Subject: [PATCH 2/2] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20clang-forma?= =?UTF-8?q?t=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/Shaders/Sky.hlsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/Shaders/Sky.hlsl b/package/Shaders/Sky.hlsl index cf49abdc0..a0be92e28 100644 --- a/package/Shaders/Sky.hlsl +++ b/package/Shaders/Sky.hlsl @@ -248,7 +248,7 @@ PS_OUTPUT main(PS_INPUT input) positionWS = mul(CameraViewProjInverse[eyeIndex], positionWS); positionWS.xyz = positionWS.xyz / positionWS.w; positionWS.w = 1; - + float2 screenMotionVector = GetSSMotionVector(positionWS, positionWS, eyeIndex); psout.MotionVectors = float4(screenMotionVector, 0, psout.Color.w);