Sorting bug with Mesh Decals (decal proj


when using decal shaders on mesh projector, they act normally. However, when placed on meshes, they have sorting bugs: the mesh decals go on top of standard meshes as your camera gets a little bit farther away.

In unreal 4, a workaround was using Flat Tesselation to fix this, but tesselation does not exist in UE5.

Is there a real solution to prevent this from happening? I’m trying with nodes that measure camera distance to try and offset this, but is works poorly. I’d need a precise formula for it to compensate properly.

Thank you

Hello, I found an old thread with the solution!

In the meshdecals.usf file, located in C:\Program Files\Epic Games\UE_5.0EA\Engine\Shaders\Private,
either comment out (with //) or massively reduce the number in '“Output.Position.z += 0.0001f * Output.Position.w;” (change it from 0.0001f to something like 0.0000001f)

This is supposed to prevent zfighting at a distance, so removing it completely might zfight.

Try this console command and some small value:

By default it is 0.005.
Works in UE 5.2.