Decals on a non uniform surface

Hi, I am trying to apply a decal onto a shirt but it is not getting rendered properly. It looks like this

I am not able to understand why it is happening. Earlier i was dynamic textures to achieve the similar results it was working then. I wanted to achieve this using decals as it fits my use case better. Any Ideas how to fix this ?

You need to set a negative zOffset for the decal material to avoid z-fighting between the underlying mesh and the decal.

See line 22 in:

1 Like

Is there any way i could calculate the value of this negative offset at runtime instead of hardcoding it? Because i tried changing the value to -ve but it still cuts off at places.

No, that’s the problem with zOffset and one of the disadvantages of decal meshes compared to decal textures: you have to define a hard-coded value that depends on the underlying mesh.

Got it. Looks like i need to use decal textures only somehow. :sweat_smile: