DOF’s TAA pass can introduce a lot of ghosting when there’s a fast moving object in the foreground and a noisy background (“DOF” and “TAA” of the kind used in the attached sample project).
In Unreal 5.6 there’s a new CVar: r.DOF.TAA.CoCBilateralFilterStrength which should help with ghosting artifacts introduced by TAA in DOF passes. However, it doesn’t work as expected since a lot of ghosting artifacts are still visible even with filter strength set to 1.
Looking at the implementation (TemporalAA.usf) it looks like that CVar enables an additional filtering on history data based on CoC radius (proportional to depth/viewZ) differences. However, I suspect that comparing current frame data CoC radius with neighborhood clamped history data may decrease the effectiveness of the filtering when it comes to reduce ghosting. (see WithClampedHistory.gif)
TemporalAA.usf - line 2262: float BilateralWeight = ComputeBilateralWeight(IntermediaryResult.Filtered.CocRadius, History.CocRadius);
Here, History is already clamped, so large CocRadius deltas between current and history data are lost (or at least greatly reduced).
Solution:
1. Edit TemporalAA.usf, line 2262: replace float BilateralWeight = ComputeBilateralWeight(IntermediaryResult.Filtered.CocRadius, History.CocRadius); with float BilateralWeight = ComputeBilateralWeight(IntermediaryResult.Filtered.CocRadius, PreClampingHistoryColor.CocRadius); and save the changes.
2. Enter console command RecompileShaders changed or restart the editor.
3. The ghosting issue is solved.
(see WithUnclampedHistory.gif)
The effect of using unclamped history can be clearly seen in the image below (DOF’s TAA output UAV texture)
[Image Removed]
Is it possible that PreClampingHistoryColor.CocRadius should be used insted of clamped history? Is this a bug or there’s something I’m not considering?
Thanks in advance for your help.
Best regards,
Leone