I have this problem when I try to use the new 4.13 mesh decals and I see the decals from distance :
The decals ends up being rendered on top of every object when moving far enough.
I activated Dbuffer, early Z-pass “Opaque and Masked meshes” and Movable in early Z-pass.
My decal is in Dbuffer translucent color blend mode.
Did I miss something ? Is there a way to avoid this problem ?
We have also come across this problem on our PS4 build as well and are looking for a good solution. Not sure whether it is related to any LODs or the materials that the decal is then drawing onto.
the shader is pushing the geometry towards the camera based on depth, to avoid Z-fighting issues. it even has a “TODO refine or expose” on it :eek:
No way to avoid the prob for the time being then… Thanks for the info.
actually I don’t really know how they plan to fix this
if you remove this part of the shader code you get a lot of Z-fighting (tried it). if they expose the value of “how much to push towards the camera” then the users will be caught up in choosing between Z-fighting or decals going on top of other things… or both
this all comes because mesh decals don’t really behave like decals. not in the way of being “projected” like a regular decal (which is very non trivial to do)
all they are, are meshes that get rendered on the decal pass and as such benefit from a few of its features
If you want to play with the offset you can find it in MeshDecals.usf
Line (106) responsible for it:
When I played with this, I did not find a value that would be satisfying.
Did you try using deferred decal instead?
Thanks vebski ! I’ve removed “Output.Position.z += 0.0001f * Output.Position.w;” Now it seems to work perfectly for what I need.
Here’s an exemple of great mesh decals in Blizzard Overwatch :
As you can see, they have big offsets probably to avoid Z-fighting but in game you don’t see it if you don’t look really close.
To get over this issue a formula has to be figured out, which would replace
with a value, that depends on distance to the cam. Constant value won’t do.
EDIT: Lowering the offset value to 0.000025 actually helped for most of the decals while not producing any visible Z-Fighting.
if a mesh looks bad at a distance, use an LOD.
…Okay, so this is an old one here, but I ran into that issue my self now,… using mesh decals on big meshes, hiding transitions and stuff…, here is a example where I generate the graphics on the runway with actual geometry, this geo hovers only 1cm above the Runway, quite close
so, at first it looked like this when looking from a distance:
Then, going into the Material and changing the Decal blendmode to “Dbuffer…”:
and voila, no decal ghosting through the other meshes…at any distance…
and in motion everything’s fine now
Okay to be Honest, this is in UE5 EA … Gotta check out if this also applies to UE4…
I found a way to mitigate this greatly.
It’s all in the Camera near clip value!
Here’s a value of 0.01:
With a value of 10.0 the artifact is only visible when the decal is far enough from the camera that only the most attentive users will notice
Of course this might cause problems if you have objects that clip into the camera, it’s all about finding a sweet spot for your project.
The tessellation workaround didn’t work for me because it broke decal rendering in VR, and I wouldn’t be surprised if it has a performance cost too.
PS: you need to restart the editor for changes to take effect.