#How can I use the vertex Z value as depth (order in layer) in a Unity material/shader?

1 messages · Page 1 of 1 (latest)

fading raft
#

Should I create my own shader?

#

Or is there any other solutions?

limpid sand
#

Can you clarify what you're doing here

fading raft
# limpid sand Can you clarify what you're doing here

I’m rendering 2D isometric tiles using a Mesh with the Sprites/Default shader in Unity
I want the vertex Z value of each tile to control which tile appears in front of others
Currently, changing the Z value has no effect

#

So I'm wondering if I can do that with shader

limpid sand
#

When you say vertex do you mean pivot? If you're doing sprites it wouldn't make sense that you're having different z values along the same quads

fading raft
#

I understand that changing Z values doesn’t affect rendering order for Sprites/Default.
Is it possible to make a shader respect vertex Z values so that they control the depth of 2D sprites?
Or are there any other way to change depth of 2D sprites?

limpid sand
#

z does affect ordering but layering has priority here so unless there's a tie you'll usually be comparing against layer order

#

it's suggested just to use the layering, but otherwise if you keep all the sprites similar layering and render order then you can probably do it with the z value change on the transform

fading raft
#

umm so like I cannot use z as depth with default shaders in unity right?

limpid sand