Custom Transparent Material on AR Mesh

Once again I want to thank you for bearing with me here. I have excellent news! I was able to find a solution! Due to the mesh chunking, you can’t just apply the material to each chunk and expect the result you’re anticipating. You have to write a shader that draws your texture based on world space coordinates so you get something that covers the entire mesh. I’ve written a sample shader that accomplishes this and supports tiling and the alpha channel. You can use this as a reference for your own.

In my testing, my goal was to overlay a transparent texture of a basketball over the mesh.

Shader "Worldspace Shader" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _Scale ("Texture Scale", Float) = 1.0
    }

    SubShader {
        Tags { "RenderType"="Opaque" "Queue"="AlphaTest" }
        LOD 200

        Cull Off ZWrite On ZTest LEqual Blend One Zero

    CGPROGRAM
    #pragma surface surf Lambert alpha
    sampler2D _MainTex;
    fixed4 _Color;
    float _Scale;

    struct Input
    {
        float3 worldNormal;
        float3 worldPos;
    };

    void surf(Input IN, inout SurfaceOutput o)
    {
        float2 UV;
        fixed4 c;

        if (abs(IN.worldNormal.x) > 0.5)
        {
            UV = IN.worldPos.yz; // side
            c = tex2D(_MainTex, UV * _Scale);
        }
        else if(abs(IN.worldNormal.z) > 0.5)
        {
            UV = IN.worldPos.xy; // front
            c = tex2D(_MainTex, UV * _Scale);
        }
        else
        {
            UV = IN.worldPos.xz; // top
            c = tex2D(_MainTex, UV * _Scale);
        }

        o.Albedo = c.rgb * _Color;
        o.Alpha = tex2D(_MainTex, UV).a;
    }

    ENDCG
    }

Fallback "VertexLit"
}