From 30c78350ebd66755f0acf6f91cdf850ff84caeb3 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 15 Apr 2025 22:24:12 +0200 Subject: [PATCH] Fix incorrect motion vectors for material that uses position offset #3367 --- Content/Editor/MaterialTemplates/Deformable.shader | 1 + Content/Editor/MaterialTemplates/Surface.shader | 2 ++ Content/Editor/MaterialTemplates/Terrain.shader | 1 + 3 files changed, 4 insertions(+) diff --git a/Content/Editor/MaterialTemplates/Deformable.shader b/Content/Editor/MaterialTemplates/Deformable.shader index 4de948d28..acc303e9d 100644 --- a/Content/Editor/MaterialTemplates/Deformable.shader +++ b/Content/Editor/MaterialTemplates/Deformable.shader @@ -337,6 +337,7 @@ VertexOutput VS_SplineModel(ModelInput input) // Apply world position offset per-vertex #if USE_POSITION_OFFSET output.Geometry.WorldPosition += material.PositionOffset; + output.Geometry.PrevWorldPosition += material.PositionOffset; output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix); #endif diff --git a/Content/Editor/MaterialTemplates/Surface.shader b/Content/Editor/MaterialTemplates/Surface.shader index ba3c36440..4826fc014 100644 --- a/Content/Editor/MaterialTemplates/Surface.shader +++ b/Content/Editor/MaterialTemplates/Surface.shader @@ -377,6 +377,7 @@ VertexOutput VS(ModelInput input) // Apply world position offset per-vertex #if USE_POSITION_OFFSET output.Geometry.WorldPosition += material.PositionOffset; + output.Geometry.PrevWorldPosition += material.PositionOffset; output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix); #endif @@ -547,6 +548,7 @@ VertexOutput VS_Skinned(ModelInput_Skinned input) // Apply world position offset per-vertex #if USE_POSITION_OFFSET output.Geometry.WorldPosition += material.PositionOffset; + output.Geometry.PrevWorldPosition += material.PositionOffset; output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix); #endif diff --git a/Content/Editor/MaterialTemplates/Terrain.shader b/Content/Editor/MaterialTemplates/Terrain.shader index abc444316..3b786a7cd 100644 --- a/Content/Editor/MaterialTemplates/Terrain.shader +++ b/Content/Editor/MaterialTemplates/Terrain.shader @@ -438,6 +438,7 @@ VertexOutput VS(TerrainVertexInput input) // Apply world position offset per-vertex #if USE_POSITION_OFFSET output.Geometry.WorldPosition += material.PositionOffset; + output.Geometry.PrevWorldPosition += material.PositionOffset; output.Position = mul(float4(output.Geometry.WorldPosition, 1), ViewProjectionMatrix); #endif