Can we not apply a decal to a single actor?

Greetings! I come from the UE2/3 era where you could spawn a decal and “attach” it to a specific actor to make the decal only project on that actor.

In UE4, I can’t seem to find a way to do this. I’m spawning tire track decals and attaching them to the mesh that represents my terrain, but when I drive over them, they project onto the wheels of my vehicle as well. Searching forums/answerhub, I see similar complaints going back years of people having problems like bullet decals projecting onto characters when they get close to a wall.

The recommended solution seems to always be to turn off “receive decals” on the mesh you don’t want decals to project onto. This should work for my specific case right now.

But I’m wondering for later on: say I wanted to support applying other decals to my vehicle. Is there no way at all to attach a decal to an actor to make it only project on that actor? Is this a side-effect of deferred decals? Or is the engine just lacking in this area right now?

Thanks!

Edit: see Decal blacklist/whitelist - apply decal not to everything - Feedback for Unreal Engine team - Unreal Engine Forums for a discussion of this topic over 3 years ago. Is this still the case?

You can by using the CustomStencil to mask the decal so it only affects objects with a specific CustomDepth stencil value. Any other actors with “Render CustomDepth Pass” enabled and a different stencil value won’t be affected by the decal. This way you can have multiple decal materials, each one targeting a different stencil value:

masked_decal.jpg

Remember to set r.customdepth.order to 0 in your DefaultEngine.ini file if you’re using dbuffer decals, otherwise they won’t read the correct customStencil values.

Hey Guys,

i also ran into the issue and there is one more important setting you need to setup.

Go to project settings and change Custom Depth Stencil Pass to: EnabledWithStencil and then RESTART the editor (that is important too).

greetz and thanks!
Phil and Irakli

Guys I can’t get it working please help me out here.

You must reorder the node succession. Check screenshot for ref. First add the value from the Divide node to the Bitmask input, then the result of the bitmask to the B input of the Multiply node (the one that doesnt have connection), and lastly drag the result from the Multiply node to the Opacity input.

Your image is missing after Epic moved the answer hub. Any chance you could post it again?

Facing the same issue myself - no luck in getting decals to apply to a single actor using custom depth stencil passes. Anyone able to do it in U5?