Rendering with Replaced Shaders

Hello. I ask for help. I need to write a replacement shader for one of the cameras in the scene. I never wrote shaders, so I’m experiencing serious difficulties, almost flour))). There are 2 cameras in the scene: one shows a normal picture, the other a black and white thermal imager. I use the function in the camera script
void OnValidate ()
{
GetComponent () .SetReplacementShader (replacementShader, replacementTag);
}
I got it like in the picture.


What should I write in my replacement shader so that the leaves on the trees display normally? Trees use shader SpeedTree. Now they are, as you see, with opaque alpha. Here is my replacement shader:

Shader "Custom/NewSurfaceShader"
{
    Properties
    {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Glossiness ("Smoothness", Range(0,1)) = 0.5
        _Metallic ("Metallic", Range(0,1)) = 0.0

    }
  
        SubShader
        {
            Tags { "RenderType" = "Opaque"  }
            LOD 400

            CGPROGRAM
          
            #pragma surface surf Standard fullforwardshadows
           
            #pragma target 3.0

            sampler2D _MainTex;

            struct Input
            {
                float2 uv_MainTex;
                float3 worldPos;
            };

            half _Glossiness;
            half _Metallic;
            fixed4 _Color;

            UNITY_INSTANCING_BUFFER_START(Props)
               
            UNITY_INSTANCING_BUFFER_END(Props)

            void surf(Input IN, inout SurfaceOutputStandard o)
            {
               
                fixed4 texColor = tex2D(_MainTex, IN.uv_MainTex) *_Color;
                float d = (texColor.r + texColor.b + texColor.g) / 1.5;               

                texColor = fixed4(d, d, d, 1);

                o.Albedo = texColor.rgb;               
                o.Metallic = _Metallic;
                o.Smoothness = _Glossiness;
                o.Alpha = texColor.a;
            }

            ENDCG
        }


        SubShader
        {
            Tags { "RenderType" = "Cube"  }
            LOD 200

            CGPROGRAM
           
            #pragma surface surf Standard fullforwardshadows          
            #pragma target 3.0

            sampler2D _MainTex;

            struct Input
            {
                float2 uv_MainTex;
            };

            half _Glossiness;
            half _Metallic;
            fixed4 _Color;
           
            UNITY_INSTANCING_BUFFER_START(Props)
               
            UNITY_INSTANCING_BUFFER_END(Props)

            void surf(Input IN, inout SurfaceOutputStandard o)
            {
               
                fixed4 texColor = tex2D(_MainTex, IN.uv_MainTex) * _Color;   

                float d = (texColor.r + texColor.b + texColor.g)/ 0.4;

                texColor = fixed4(d, d, d, 1);

                o.Albedo = texColor.rgb;               
                o.Metallic = _Metallic;
                o.Smoothness = _Glossiness;
                o.Alpha = texColor.a;
            }
            ENDCG
        }

    FallBack "Diffuse"
}

Hi! Did you manage to solve the issue? i have similar problem and also need to implement thermal camera. It works but only with manually put objects. Didyou manage to make it work with painted trees?

Thanks in advance!