DOF - TAA pass ghosting

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

Steps to Reproduce
1. Open the attached project (AntighostCocRadius)

2. Open the Level /Game/NewWorld (should be the startup level)

3. Start PIE

4. Enter console command t.MaxFPS 15 to make ghosting artifacts more obvious

5. Enter console command r.DOF.TAA.CoCBilateralFilterStrength 1 to enable CoC Radius filtering for DOF’s TAA pass.

6. The actor in the foregroung ghosts on the blurred bg.

Thanks for reaching out about this issue. I reproduced these ghosting artifacts with the project you provided, so I appreciate you doing all of this setup work. I have created a Jira to get your proposed fix into the engine, which you can track here: Unreal Engine Issues and Bug Tracker (UE\-309768\). If you have any more questions, please feel free to contact me.

Cheers,

Tim

Hi Tim,

Any update on your side regarding the issue? Have you considered the proposed fix (pre-clamping history instead of clamped)?

Thanks,

Leone

Hi Leone,

The team has been caught up with some other projects, so they have not had the chance to review the changes. However, they are considering the changes for a 5.8 release, so it will likely take until next year for the changes to be integrated. I appreciate your patience until then. Feel free to let me know if you have any more questions.

Cheers,

Tim