Decals are one of the best ways to add additional detail via stains, leaks, dirt, splatter, stenciled numbers/letters or posters onto already placed Static Meshes in the level.
But what if decals you added are not rendering in shadow or in indirectly lit areas like so:
Your decals work with dynamic lighting. Lights that are set to Stationary and Moveable:
But they do not work in indirect static lighting. This means around any light that is set to static:
Or in any lighting scenario where decals are not being directly lit by stationary and moveable lights:
Even using Unlit viewport mode makes decals disappear:
What's happening and what do you do to fix it?
Unreal Engine 4 features an updated decal rendering system that contains more predictable performance behavior and generally render faster. But this means by default and design decals do not render in indirect baked static lighting. All decals would need to be receiving dynamic lighting for them to show (any lights that are set to stationary or moveable type).
You have 3 options if you want decals to render in shadows and in indirect static lighting:
- Only use decals in areas where they are being affected by stationary and moveable light types
- Avoid having decals in indirectly lit areas (baked lighting in shadows and near static light types)
- Enable DBuffer which will turn on the ability to have decals work in any lighting situation
Here is how to enable third option.
Enable DBuffer Decals
In order to have decals to render in indirect lighting you need to enable DBuffer decal option. This is disabled by default because it does contain a slight CPU and memory cost.
There are two steps to this process.
First step is enabling DBuffer decals through Project Settings.
Second step is changing decal materials property to work with DBuffer setting.
Go to Edit > Project Settings:
Under Engine: Rendering, enable the following properties:
- DBuffer Decals: On
- Early Z-pass: Opaque and Masked Meshes
- Moveables early in Z-pass: On
Now open material editor for only those decals that you want to work in indirect static lighting. Not all decals you have may need to be updated.
Double click on the decal material to open Material Editor:
Inside Details tab in Material Editor, use drop down menu to select one of the following options for Decal Blend Mode:
- DBuffer Translucent Color, Roughness, Normal
- DBuffer Translucent Color
- DBuffer Translucent Color, Normal
- DBuffer Translucent Color, Roughness
- DBuffer Translucent, Normal
- DBuffer Translucent Normal, Roughness
- DBuffer Translucent Roughness
Choose one that uses those input material properties. So if your decal material contains Base Color and a Normal map input, then choose "DBuffer Translucent Color, Normal".
Apply Changes and Save the Material:
After making these changes, restart the editor.
All of the project's shaders may need to be rebuilt (this would happen automatically):
Rebuild your scene by clicking on Build:
You should now see decals work in indirect static lighting:
DBuffer or GBuffer (Default) Decals?
Use DBuffer option (those that work in indirect static lighting) for decals that need to be used in indirect static lit areas.
All other decals - use GBuffer option (default) by keeping Decal Blend Mode set to Translucent, Stain, Normal or Emissive. Note that they will NOT render in indirect lighting.
If decals need to be used in all lighting situations, change them to "DBuffer Translucent..." option.
If DBuffer Option Crashes Your Project/Editor
If enabling DBuffer decals in Project Settings crashes your project then here is how reset these settings.
ONLY do this if changing to DBuffer via Project Settings crashes your project.
Go to directory where your project is stored. This might be on C: drive or another drive. In my situation, I store all UE4 projects on E: drive.
Unreal Engine Launcher right-Click on the project icon to select "Show in Folder":
Go inside Config folder and open DefaultEngine.ini file:
Scroll down to the bottom and set r.DBuffer=False:
Save and close the DefaultEngine.ini file.
How to Create Custom Decals Series
Want to learn more about creating custom decals for UE4? Such as how to create dirt, stains, blood, and stenciled numbers decals?