Quantcast
Channel: Questions in topic: "shader programming"
Viewing all articles
Browse latest Browse all 169

Shader: How to write a shader that respects sorting order first and then depth

$
0
0
I am very new to shaders. I have created a custom editor for MeshRenderer in order for me to edit their sorting order. I want to modify Unity's built-in mobile unlit shader (https://github.com/TwoTailsGames/Unity-Built-in-Shaders/blob/master/DefaultResourcesExtra/Mobile/Mobile-Lightmap-Unlit.shader) to respect the sorting order first and then depth second. If I have objA with sorting order of 100 and objB with sorting order of 0, the objA should be drawn on top of objB, regardless of the depth. However, if they have the same sorting order, then the drawing order should be determined by the depth. However, it seems like the shader is disregarding the sorting order right now. Any help would be appreciated.

Viewing all articles
Browse latest Browse all 169

Latest Images

Trending Articles



Latest Images