- Home /
How to have sorting order/layers used when Z depth is the same?
I've got a shader which is simply based off the standard shader with a few tweaks here and there for use with 2D sprites in a 3D environment. My goal is to allow depth rendering (so Zwrite is on and ZTest Less) however, when it comes to armour and layered body parts I would prefer not to offset the armour for it to render in proper layers.
Currently, the sprites and armour just clip as they are in the same plane, whereas with ZTest off, the layering works but the depth does not (obviously). Ideally I'd like it to use sorting layers to render things when two sprites have the same depth. Is there anyway I can achieve this effect? Hopefully I was coherent enough describing the problem. Thanks!
Answer by Daedalus216 · Jun 22, 2017 at 08:40 PM
One option would be to add 'Offset' to the shader, and make multiple versions for skin, boots, helmet, etc with varying offsets to correspond with the order I want them in, but that seems overly convoluted. There must be a simpler way.
Your answer
Follow this Question
Related Questions
ZTest, and ZWrite Problem rendering a Cluster of Quads 2 Answers
Drawing objects based only on layer order with no overdraw 1 Answer
Character behind obstacles shader, multiple Pass issue 0 Answers
URP – Order Independent Transparency 0 Answers
Can Unity Indie Use ZTest and ZWrite Shader Functions? 1 Answer