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

This is a continuation of a closed post: UE4.27 How make certain Decals ignore Player mesh?

That post dealt entirely with UE 4.27. The UE5 system appears to be much different and there is little to no documentation that I can find to answer my current problem.

image

In the image, the player mesh has a Decal component that renders a material that shows a green ring as you see.

However, this green ring will bleed over onto the mesh’s feet. There is an option on the mesh to Ignore decals which fixes this problem. However, it ignores all decals at that point and so if you wanted to use blood decals you could not.

In UE4.27 there is a way to put some decals on a DBuffer channel and then some decals Translucent, where the DBuffer channel could be ignored by the player mesh, but the translucent decals still showed up. I cannot find the workflow to make that happen in UE5.

I note in the material
image

There is a Decal Response but it is greyed out and hard coded to be set to this.

What is the workflow to disable certain decals on a player mesh but allow for it to take blood decals in UE5?

2 Likes

Hey @Auticus.Daerk!

Looking through another post I think I may have found a solution for you. Give it a good look over and see if what they posted helps you! Anything after that in the topic as well, you’ll want to look at, especially if you’re using Megascans.

1 Like

I saw this exact thread on Reddit actually :slight_smile: I have a lot to unpack. It assumes knowledge of editing material attributes for the surface materials, so I deduce I need to figure out how to get into the material editor now and set properties how I need.

A tutorial on this would be immensely helpful; when I get my head wrapped around it I will do up a youtube on it.

Thank for the reply.

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

Thats a great response. A whole lot in there.

“though using decals on skeletal meshes for blood is still not a great idea, but I digress” → this seems to be the standard that I see pretty much everywhere (using decals for blood and injuries). What would you recommend? That is related to this topic since it can change how I go about my selection icon process.

Do you have any material / links / tutorials . examples that go into more depth with your response that I could look at?

The reason it’s not generally recommended is because UE doesn’t project decals onto skinned meshes in a sensible way; you can attach them to a bone, but because they project in world space, they’ll “leak” as the skin of the mesh moves relative to the decal-bone system.

You can see the issue and one possible solution discussed. There are Marketplace solutions as well (see Skinned Mesh Decal, though it’s pricy). The long and somewhat unhelpful answer is “in order to render wounds on characters, you need to find a way to create the wound effect as a mask/projection on the material OF the character, rather than applying a decal in post”. The reason for this is that the material of the character will deform as the mesh deforms, so in order for the wound to follow the mesh, the wound needs to be in a mesh-applied material, rather than a rigid box that exists in the world on top of the character mesh.

There are multiple ways to do that using sphere masks, RenderTargets, vertex painting, and others, none of which is simple or easy and very few of which are performant AND highly extensible.

2 Likes

I agree. The decals aren’t the best. The project I am working on here is a mass combat game so decals may not have been the best choice anyway for blood since there will be a lot of actors on the screen potentially, and I read that that can hurt performance.

I read about the Skinned Mesh Decal package and it looks cool but he has that little matrix graphic that shows its not the best for a lot of renderings either.

However I’ll cross that proverbial bridge when I need to. Right now it was just simply getting the icon to render as a decal without bleeding onto my mesh but allowing other decals to still work for me. The information here has been useful and I will be hacking away at some examples.