#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)
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
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
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?
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
umm so like I cannot use z as depth with default shaders in unity right?
https://docs.unity3d.com/6000.2/Documentation/Manual/2d-renderer-sorting.html
Better to just read that