Avoiding halo artifact around characters when using TSR or TAA along with Depth of Field on CineCamera

Hello,

We were wondering if there were any guidelines to reduce the DOF bleeding effect when using TSR or TAA as antialiasing method.

This artifact is particularly visible on moving cameras, used for in game cinematics.

We tried tweaking the TSR values, going as high as increasing screen percentage to 150% but the issue remains visible.

The only workaround we found was to drastically reduce the depth of field strength, which we would like to avoid doing.

Scene Depth and TSR visualizer appear to be behaving as expected but we may be missing some settings.

As this happens during cutscenes, we are looking for improvements in this particular context, where we may use dedicated settings.

Thanks!

Steps to Reproduce
Open the attached 5.6.1 project.

Open Lvl_ThirdPerson

Open LS_Repro

Attach to camera and play the sequence (with r.antialiasingmethod 4 and screen percentage 100%)

Hi,

thanks for the repro project. I’m not exactly sure what you mean by halo artifacts, but I assume it’s the parts I’ve circled in red on your screenshot. Can you please confirm that or point me to the problematic areas if I’m wrong?

[Image Removed]

If these are the artifacts you’re seeing, could you try changing either (or both) of the following CVars:

  • Set r.DOF.Scatter.BackgroundCompositing to 1: Compositing mode of the background hybrid scattering. 0: Disabled; 1: Additive; 2: Gather occlusion (default).
  • Set r.DOF.TAA.CoCBilateralFilterStrength to 1: If 1, a bilateral filter based on the circle-of-confusion is used to reject history in the pre-DoF TAA pass. If 0, this is disabled. When enabled, you may get stronger noise on edges of objects that separate foreground and background. When disabled, you may get stronger ghosting along those same edges.

Let me know if this works.

Sam

Hi Sam,

These are indeed the ones we’re looking to improve as when the scenes get busy and have camera movements, it gets very noticeable.

We already had r.DOF.Scatter.BackgroundCompositing to 1, but r.DOF.TAA.CoCBilateralFilterStrength to 1 did drastically improve the behavior, along with ensuring that r.DOF.Gather.PostfilterMethod is set to 1 (not 2).

Do these settings come with significant GPU cost?

If we notice any more issues, we will just lower the DOF strength.

Thanks for the help.

Hi,

glad that helped. As for performance, changing r.DOF.Scatter.BackgroundCompositing from 2 (default) to 1 should do less computation (additive mode keeps the gather quality low while occlusion mode raises the quality as can be seen at lines 2886-2897 in DiaphramDOF.cpp) and should be a faster.

Setting r.DOF.TAA.CoCBilateralFilterStrength to 1 does a few more calculations and should incur a negligeable performance cost (the relevant code is in ComputeBilateralWeigth() in TemporalAA.usf which is only a couple of instructions).

Setting r.DOF.Gather.PostfilterMethod to 1 (RGBMedian3x3) requires quite a few more calculations per pixel than setting this to 2 (RGBMax3x3), so it will be a bit slower. The relevant code is in DOFPostfiltering.usf and performs a a few min/max operations, these are very fast on GPUs but they can add up).

In this case it’s best to perform GPU performance profiling by testing each of these settings separately and in combination to compare the speed loss (or gain) between the old and new settings.

Hope that helps,

Sam