Problem to solve Z-Fighting with Offset shader, how can I do it works?

So, I have a 2.5d game with 2d sprites in a 3d world, that sprites are divided in two parts, color and line. The color and line stays in the same position, because of that they starts z-fighting. I tried build a shader to set an offset to the line renderer, to make her stay always in front of color renderer, and it works in the majority times, but depending of the position of the color sprite, that renderer is completly hided by the line sprite…173793-20210107-182037.gif

I’m a newby making shaders, so I create my shader with shader graph and then copy the source code and replaced in the Unlit shader, after make that I turned on the ZWrite and modified the offset “property”

Finaly, how can I solve that hiding bug?

If you’re using a SpriteRenderer for your objects, you can adjust the SortingLayer on your Renderer to set which order they will render in. This will solve any z-fighting issues between them.

hi. (and not a year has passed)

maybe you need this:

Tags { "RenderType"="Opaque" "Queue" = "Transparent" }
Blend One OneMinusSrcAlpha
AlphaToMask On

it helps me in the similar situation