I’d like to control mesh drawing order in 2D (Orthographic) camera.
At first, for example, I already know I can achieve following draw result with 3 Renderer objects (e.g., 3 Sprite Renderers) using Order in Layer.
But I’d like to achieve it with only “1 Renderer” as much as possible.
(It seems not to be problem when only 3 sprites like following example, but I’d like to draw it with only “1 Renderer” especially when many sprites are required in order to avoid the overhead of many GameObjects.)
For example, in above case, I’d like to set like as following.
- Order in Layer = 0 for vertex #0, 1, 2, 3.
- Order in Layer = 1 for vertex #4, 5, …, 10, 11.
But it seems each vertex parameter in mesh cannot have order in layer.
So I guess another method is required.
Is there any method to achieve it?
Simply changing Z is OK? But this is 2D - Is Z axis also available even if we use orthographic camera? Is it safe even if each quad plane have transparency textures?
Other detail conditions:
- Each quad plane is like as Sprite. So each vertex have also UV coords. The texture have alpha channel. Alpha blending required. (“ZWrite Off” and “Blend SrcAlpha OneMinusSrcAlpha” is required. So I concern that Z order sorting problem would be occurred due to transparent mesh …)
- I’d like to achieve it with URP.
- I’d like to achieve it with some SRP batcher compatible method. So I’d like to use SRP compatible macros if I need to write some shader.
- If I need to write shader, I’d like to manage it with ShaderLab (HLSL) code, not ShaderGraph.
- I’d like to achieve it with only 1 SRP batch as much as possible.
- I’d like to avoid Z fighting artifact when many sprites drawing required.