How can I handle this Depth Of field foreground issue?

Hi Guys!
I started learning Unreal about a month ago, but I’m having a weird issue with Actors / Foliage in the foreground when I use a strong Depth Of Field and the camera is close to the foreground. I really tried everything, I’ve been trying to find a solution for it on the net for a week, I’ve looked at a tons of tutorials, searched forums, but nothing that works unfortunately. I’ve tried several lighting techniques, UE4 to UE5, all kinds of Camera and Post Process settings, Console Variables, World and Project Settings, Materials, Engine Scalability Settings, copying from one Scene to another, but nothing… I have a reference scene, the Quixel Megascans Abandoned Apartment Scene where for some reason the foreground Dof works quite well, but if I copy all the settings from there, somehow it doesn’t. Please help me!

And here are 2 more e!xamples from Quixel’s Abandoned Apartment Scene where it’s almost looks correct.

[alt text][2]

I am having the same issue, and cannot find any information about how to solve it.

352432-dof-issue.png

Anyone figure out a solution to this? :frowning:

It’s another case of temporal upsampling!

r.TemporalAA.Upsampling=0`

:wink:

1 Like

This didn’t resolve it for me. Are there other settings that need to be paired with this in order for it to work?

Hello try the following commands:

r.MotionBlurQuality 4
r.MotionBlurSeparable 1
r.DepthOfFieldQuality 4
r.ForceLOD 0
r.TemporalAA.Upsampling 0
foliage.ForceLOD 0

Also have in mind there is a bunch of possible causes, for example the Current Aperture of the camera perhaps is too low:

If I increase:

Another possible reason is the material is using embed alpha instead a proper independent opacity map, which causes it loads twice the texture, or configuration itself is not good:

Hope it helps!

Having this issue also, and it looks bad, seems to be on masked materials, though I’d have to test it fully to find out if thin static meshes also have the issue.

Why would having a separate texture for the alpha make a difference? Is it because the texture uses different compression settings? As that’s a lot of work to create new textures and recreate materials especially when using megascns, so if I were to do that, I’d like more info.

One thing I found that improves it in the editor, is bumping up the screen percentage, though this shouldn’t make a difference to movie renders as it’s already bumped up.

I tried all the console commands related to depth of field and nothing made a difference. The AA setting in UE5.4 makes no difference, it uses TSR anti aliasing by default anyway, but if you do change the anti aliasing to AA it doesn’t seem to do anything.

I ended up deleting any bad looking foliage close to the camera as I couldn’t find a solution.

@Origenic you’re right and a better and proper explanation is needed.

Why would having a separate texture for the alpha make a difference? Is it because the texture uses different compression settings?

Using separate textures for the alpha channel can significantly impact performance and quality. In master materials, a key optimization is the reuse of shared textures across multiple material instances. This minimizes memory usage and increases rendering efficiency.

For example, let’s say you have a wall material shared across multiple walls in a scene. With a master material, you can adjust properties like roughness, color tint, or detail normals in the material instances to introduce subtle variations. This prevents the scene from looking repetitive without the need to load entirely new textures for each wall. In this case, the master material approach is highly efficient because it loads the textures only once, and all variations are applied via parameters.

However, when the material requires opacity and we are using same one, this efficiency breaks down. If the alpha channel is embedded within a texture (e.g., RGBA), the same texture must be sampled multiple times for different channels (diffuse, specular, metallic, opacity, etc.), leading to redundant fetches. Using a separate grayscale mask for opacity reduces texture fetches, optimizes GPU bandwidth, and typically results in better compression quality for the alpha-specific task. Dedicated masks are also more predictable for quality control, especially in tasks like anti-aliasing or edge blending.


One thing I found that improves it in the editor, is bumping up the screen percentage, though this shouldn’t make a difference to movie renders as it’s already bumped up.

Increasing the screen percentage can indeed improve visual quality in the editor, but it comes at the cost of performance. For Metahumans, for instance, it’s common to set the screen percentage to 150 for higher fidelity in renders. However, the tradeoff is a heavier load on the GPU, which might not be suitable for real-time applications or lower-end hardware.


I tried all the console commands related to depth of field, and nothing made a difference. The AA setting in UE5.4 makes no difference; it uses TSR anti-aliasing by default anyway. If you do change the anti-aliasing to AA, it doesn’t seem to do anything.

Issues with depth of field or aliasing, artifacts… are rare for me, I’ve seen them happen under certain conditions. As shown in my example screenshot, the foliage renders beautifully even at close range.

Below are some of the console variables that I typically use to achieve optimal results for cinematic:

Suggested Console Variables and Values:

Console Variable Name Value
r.AmbientOcclusion.Denoiser.TemporalAccumulation 0
r.DiffuseIndirect.Denoiser 0
r.Reflections.Denoiser 0
r.Shadow.Denoiser 0
r.Shadow.Denoiser.TemporalAccumulation 0
r.GlobalIllumination.Denoiser.TemporalAccumulation 0
r.Reflections.Denoiser.TemporalAccumulation 0
r.ScreenPercentage 150.0
r.RayTracing.SkyLight.Denoiser 0
r.RayTracing.GlobalIllumination.Denoiser 0
r.RayTracing.GlobalIllumination 1
r.RayTracing.GlobalIllumination.MaxBounces 5
r.RayTracing.Reflections.MaxRoughness 1.0
r.RayTracing.Reflections.MaxBounces 2
r.RayTracing.Reflections.Shadows 2
r.RayTracing.GlobalIllumination.EvalSkyLight 1
r.RayTracing.Reflections.RayTraceSkyLightContribution 1
r.RayTracing.Geometry.InstancedStaticMeshes.Culling 0
r.RayTracing.AmbientOcclusion.SamplesPerPixel 8
r.RayTracing.GlobalIllumination.FireflySuppression 1
r.Lumen.ScreenProbeGather.RadianceCache.ProbeResolution 64
r.TemporalAA.Upsampling 0
r.TemporalAACurrentFrameWeight 0.1
foliage.ForceLOD 0
r.Tonemapper.Quality 4
r.MotionBlurQuality 4
r.MotionBlurSeparable 3
r.DepthOfFieldQuality 4
r.Tonemapper.Sharpen 1.2
r.ForceLOD 0
r.Shadow.DistanceScale 5.0
r.HairStrands.Visibility.SortByDepth 1
r.AmbientOcclusion.Method 1
r.AmbientOcclusion.Denoiser 0
r.AmbientOcclusion.Denoiser.TemporalAccumulation 0
r.DiffuseIndirect.Denoiser 0
r.Reflections.Denoiser 0
r.Shadow.Denoiser 0
r.Shadow.Denoiser.TemporalAccumulation 0

For additional testing, if you’re not using Nanite, you can also try r.RayTracing.ForceAllRayTracingEffects 1 to evaluate how it affects the scene.

For a detailed description of each console variable you can take a look to:

I hope it helps!

1 Like

Maybe try

r.DOF.Kernel.MaxForegroundRadius 0

1 Like

This just seems to disable DOF

I tried recreating the material with a single mask texture for opacity but it made no difference, performance isn’t the issue here. I’ve had other levels where I’ve not noticed any issues with DOP where as other times it just looks bad, perhaps the lighting direction and fog are contributing factors and also focal length, this shot is towards the wider range, i.e. 25mm.

Here’s an example

I’ve just noticed the DOP seems to be fine when there’s nothing behind the grass, i.e. just sky, check the blade in the middle of the shot

compared with

As an experiment, I changed the material to translucent and used the opacity mask for the translucency and set translucency pass to before DOP and the results at first seemed lot better, not ideal due to performance but maybe ok for doing a movie render… check it…

Though, in this case it seems to only look good from specific angles, and a lot of the time it looks there is no DOP blurring, also translucency doesn’t shadow or respond to lighting well so not really an option.

At this point, I suggest creating a new project and adding this content to it.[https://fab.com/s/0c488c6f4347](https://fab.com/s/0c488c6f4347)

This will likely help determine if the issue is related to configuration.
It’s the one I was using in here:


I’m attaching the recommended Default.ini they suggested time ago:

[/Script/WindowsTargetPlatform.WindowsTargetSettings]
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
-D3D12TargetedShaderFormats=PCD3D_SM5
+D3D12TargetedShaderFormats=PCD3D_SM6
-D3D11TargetedShaderFormats=PCD3D_SM5

[/Script/Engine.VirtualTexturePoolConfig]
DefaultSizeInMegabyte=1024
+Pools=(SizeInMegabyte=1024, bAllowSizeScale=False, bEnableResidencyMipMapBias=False)

[/Script/Engine.Engine]
bSmoothFrameRate=False
MinDesiredFrameRate=60.000000

[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
AppliedTargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
AppliedDefaultGraphicsPerformance=Maximum

[/Script/Engine.RendererSettings]
r.EarlyZPass=2
r.EarlyZPassOnlyMaterialMasking=True
r.Streaming.PoolSize=8000
r.TranslucencyLightingVolumeOuterDistance=50000
r.CustomDepth=0
r.TemporalAA.Upsampling=False
r.AllowStaticLighting=False
r.DiscardUnusedQuality=True
r.GenerateMeshDistanceFields=True
r.GenerateLandscapeGIData=False
r.DefaultFeature.AutoExposure.Method=0
r.DefaultFeature.LightUnits=2
r.Shadow.Virtual.Enable=1
r.ReflectionMethod=1
r.DynamicGlobalIlluminationMethod=1
r.Lumen.TraceMeshSDFs=1
r.VelocityOutputPass=1
r.Velocity.EnableVertexDeformation=1
r.AntiAliasingMethod=4
r.Shadow.CSMCaching=True
r.VirtualTextures=True
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
r.Lumen.TranslucencyReflections.FrontLayer.EnableForProject=True
r.SkinCache.CompileShaders=True
r.RayTracing=False
r.RayTracing.Shadows=False
r.RayTracing.Skylight=False
r.RayTracing.UseTextureLod=False
r.Lumen.HardwareRayTracing=True
r.Lumen.HardwareRayTracing.LightingMode=2
r.PathTracing=False
r.Shadow.Virtual.Cache.MaxMaterialPositionInvalidationRange=2500
r.GBufferFormat=1
r.Tonemapper.Sharpen=0.5
r.Nanite.Streaming.StreamingPoolSize=1024
r.Nanite.CoarseStreamingMeshMemoryPoolSizeInMB=500
r.Nanite.MaxNodes=4194304
r.RayTracing.Geometry.LandscapeGrass=1

Additionally, here are some fixes for common issues across Unreal Engine versions they share:

Unreal Engine 5.4.x

  • Landscape Material Displays Heavy Ghosting Effect:
    • Fix: Select the landscape and enable “Nanite” in its details. Run “Build Data” under the Nanite tab. This cannot be enabled by default as the assets are authored in UE5.2, which lacks Nanite landscape support.

Unreal Engine 5.3.x

  1. PCG Performance with Large Maps is Poor:

    • PCG tools are experimental and not yet production-ready. Procedural Foliage Volumes (PFV) and Landscape Grass Types (LGT) are recommended instead.
  2. TSR Anti-Aliasing Flickering with Complex Foliage:

    • Fix: Use Nvidia’s DLSS plugin for better results, including reduced flickering and RTX 40 series frame generation support.

Unreal Engine 5.1.x

  1. Virtual Shadow Maps Flickering or Disappearing:

    • Avoid strong wind effects that deform meshes heavily.
  2. Nanite World Position Offset Disappearing Triangles:

    • Strong WPO deforms mesh bounds. Adjust max WPO distance but be aware of performance impacts.

Unreal Engine 5.0.x

  • MovieRenderQueue Crashes with Large Complex Maps:
    • Fix: Disable “Flush Grass Streaming” in MRQ settings and enable “Render Warm Up Frames” under Anti-aliasing. Adjust Engine Warm Up Count to ensure grass is built before rendering starts.

For large scenes with significant grass or Nanite assets, increase pool sizes in your DefaultEngine.ini:

r.Nanite.MaxVisibleClusters=10485760
r.Nanite.MaxCandidateClusters=16777216
r.Nanite.MaxNodes=10485760
r.Nanite.Streaming.StreamingPoolSize=1024
r.Nanite.CoarseStreamingMeshMemoryPoolSizeInMB=500
grass.culldistancescale=3

I really hope it helps!

:thinking: only Screen Space Traces can handle alpha masked surfaces.

Thanks for this, I’ll check it out soon when I get more time!

1 Like