UE5 - How to - player mesh ignore some decals but not others

A more robust (but complicated) solution for your use case is to replace the character decal (e.g. your ring) with the engine-provided static mesh “1x1x1_Box_Pivot_-XYZ”.

Then replace your decal material with a translucent material that implements the “StaticMeshDecal_Function”. This function essentially recomputes the math that decals use for projection using depth behind translucency (and relies on mesh scale dimensions to get its size and offset input, hence the need to use a specific 1x1x1 box mesh)

Why do this? Because now, you can multiply the “Combined Mask Output” by a Custom Stencil Buffer check to filter the decal for meshes in or out of a specific stencil buffer. Thus you can still use ordinary world decals for everything AND allow meshes to receive them (though using decals on skeletal meshes for blood is still not a great idea, but I digress), but use Custom Stencil channels to mask things like character highlight rings onto/off of specifically applicable meshes only.

This material function is worth learning because it also gives you much more control over decal blending; for example, it can be used to apply decals consistently to emissive materials, which is often a challenge with the DBuffer. It’s less performant than ordinary decals and cuts out a lot of the useful DecalActor functionality (e.g. automatic fade and pooling) but for cases like this, where you want something decal-like that is treated differently from “standard decals” it’s great.

2 Likes