Is this shader can exist in Unity?

‘Front’ and ‘back’ are all SpriteRenderer.

Do you have a Shader these things that will be present in the Unity?

One way you could do is

  • Loop all sprites renderers you want to sort
  • Get distance from each to main camera
  • Sort these distances and dont forget to store which distance points to which renderer.
  • Assign custom render queue (+1) for every next element
  • That way you can render first by closest or furtherest element

But i can already see some flaws with this as it does no take into account overall size, but only central pivot of the transform, but it’s just a thought.

A special situaltion is it : i spent a lot of time to implement 2D based isometric game.

as you know, this approach made a issues around z-order / z buffer.

the issues are vary and complexive related altitude and depth. (it’s a hard to tell)

so i hope to fix it by shader and blending, but it looks like impossible.

by the way, i solved this problem by some exceptional dirty codes.