I'm trying to perform forward pixel projection based on previous frame depth. Using UV, I'm reading prevDepth for given pixel and based on that I'm recreating worldPos in camera space (where (0, 0, 0) is camera position). Then I offset this position using previous frame camera position to find prevWorldPos in camera space.
Then I'm doing standard matrix multiplication to get ndc and then prev frame uv. So, it works quite nice without any additional history buffer or using pixel neighbours, at least for camera rotation.
When it comes to camera translation, value of prevUV is the same as uv and it results in no changes in affected pixels and it destroys the reprojection. And I don't understand why.
float3 worldPosition = GetWorldPosFromUV(uv, prevDepth); // Current frame worldPos in camera space float3 prevWorldPosition = worldPosition + (currFrameCameraOffset - prevFrameCameraOffset); // Transform to camera space position in previous frame float4 ndcPrev = mul(float4(prevWorldPosition, 1.0f), viewProjMatrixPrevFrame); ndcPrev.xyz /= ndcPrev.w; float2 prevUV = ndcPrev.xy * float2(0.5f, -0.5f) + float2(0.5f, 0.5f); return prevUV;