Weird sorting issues

I created a bunch of quads on a sphere with the same material but the ones in the back sometimes get drawn on top.
[Edit] I’m dawing the quads using DrawMeshInstanced and I guess that treats the quads as one mesh so maybe that’s why? How can I fix sorting of polygons on the same object?

3187118--243239--SortingIssues.gif

Here’s the shader nodes.

And the code.

Shader "Custom/Unlit/TextureInstanced"
{
    Properties
    {
        [HideInInspector] __dirty( "", Int ) = 1
        _Texture("Texture", 2D) = "white" {}
        _Tint("Tint", Color) = (1,1,1,1)
        [HideInInspector] _texcoord( "", 2D ) = "white" {}
    }

    SubShader
    {
        Tags{ "RenderType" = "Transparent"  "Queue" = "Transparent+0" "IgnoreProjector" = "True" "IsEmissive" = "true"  }
        Cull Off
        CGPROGRAM
        #include "UnityPBSLighting.cginc"
        #pragma target 3.0
        #pragma surface surf StandardCustomLighting alpha:fade keepalpha noshadow
        struct Input
        {
            float2 uv_texcoord;
        };

        struct SurfaceOutputCustomLightingCustom
        {
            fixed3 Albedo;
            fixed3 Normal;
            half3 Emission;
            half Metallic;
            half Smoothness;
            half Occlusion;
            fixed Alpha;
            Input SurfInput;
            UnityGIInput GIData;
        };

        uniform float4 _Tint;
        uniform sampler2D _Texture;
        uniform float4 _Texture_ST;

        inline half4 LightingStandardCustomLighting( inout SurfaceOutputCustomLightingCustom s, half3 viewDir, UnityGI gi )
        {
            UnityGIInput data = s.GIData;
            Input i = s.SurfInput;
            half4 c = 0;
            float2 uv_Texture = i.uv_texcoord * _Texture_ST.xy + _Texture_ST.zw;
            float4 temp_output_5_0 = ( _Tint * tex2D( _Texture, uv_Texture ) );
            c.rgb = temp_output_5_0.rgb;
            c.a = temp_output_5_0.a;
            return c;
        }

        inline void LightingStandardCustomLighting_GI( inout SurfaceOutputCustomLightingCustom s, UnityGIInput data, inout UnityGI gi )
        {
            s.GIData = data;
        }

        void surf( Input i , inout SurfaceOutputCustomLightingCustom o )
        {
            o.SurfInput = i;
        }

        ENDCG
    }
    CustomEditor "ASEMaterialInspector"
}

Thanks, I didn’t fully understand the jargon, but it seems like I’ve hit the limit of Amplify Shader Editor?

You’ve hit the limit of realtime transparency rendering to a degree. But also yes, the work arounds are mostly outside the realm of ASE’s current functionality. FYI, this is also outside the realm of pretty much any node based shader editor.

1 Like

Gotcha, thanks :slight_smile: