DOF CoC radius unit mismatch produces pixelated bloom-like artifacts at low screen percentage

Hi,

In our project, depth of field produces pixelated, bloom-like artifacts when rendering at a reduced screen percentage (r.ScreenPercentage/sg.ResolutionQuality) with temporal upscaling. The artifacts are absent near native resolution and grow more severe as the resolution scale drops.

We are having this problem with 5.7.4 but by testing with a sample project, it also seems to happen with the most recent official version of Unreal.

To reproduce: open the attached sample project, set r.ScreenPercentage or sg.ResolutionQuality to 33, and an artifact as the following should appear: [Image Removed] Setting it back to 100 removes the artifact: [Image Removed]

In our own project using TSR, we start seeing mild artifacts around 50% and much stronger ones at 33%, which is a scale we currently need on some target platforms.

Comparing matched pixel neighborhoods at 33% vs. 100% at the border where the problem start appearing, we traced the artifacts to the opacity mask calculation in DOFRecombine.usf, which uses CoCRadius in physical pixel units instead of converting it to scaling-independent encoded units — a mismatch also flagged by an existing TODO comment in that file.

Applying a scaling factor (the inverse of the encoded units) to CoCRadius at a few points in the shader removes the artifacts in our testing. We’re not fully confident this is the complete or correct fix, since we’re unsure whether other consumers of CoC radius elsewhere in the DOF pipeline also assume physical-pixel units. Guidance on the proper approach would be appreciated.

Attached is a single zip containing the sample project, a Changes\original_5.7.4 folder with the unmodified code showing the bug, and a Changes\fixed_5.7.4 folder with our attempted fix for easy diffing.

Is this a known issue, and could you advise on the correct fix for the CoC unit mismatch in DOFRecombine.usf?

Cheers,

Antoine

[Attachment Removed]

I’m not sure if this is publicly visible but here are the changes I did in 5.7.4 to fix this.

[Attachment Removed]

Hi, thanks for reporting this issue and providing a repro case and proposed fix. I will take a closer look shortly.

Note that this issue should have been fixed with a recent change (CL 55318850, git commit 3a47d66938d34ae1ef44076baad9a61e5d5727f3)

This change was submitted end of June, and so may not have been included in the versions you have tried.

[Attachment Removed]