Hello!
I have the following shader for CrossFading:
Shader "Custom/CrossFadingLod (Dither)"
{
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"="TransparentCutout" "Queue"="AlphaTest" }
LOD 200
CGPROGRAM
#pragma multi_compile _ LOD_FADE_CROSSFADE
#pragma surface surf Standard vertex:vert
#pragma target 3.0
sampler2D _MainTex;
struct Input
{
float2 uv_MainTex;
UNITY_DITHER_CROSSFADE_COORDS
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
void vert(inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input, o);
UNITY_TRANSFER_DITHER_CROSSFADE(o, v.vertex);
}
void surf(Input IN, inout SurfaceOutputStandard o)
{
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
#ifdef LOD_FADE_CROSSFADE
UNITY_APPLY_DITHER_CROSSFADE(IN);
#endif
}
ENDCG
}
FallBack "Diffuse"
}
How to work with it without LodGroup?
I tried to send unity_LODFade in the shader
obj.gameObject.GetComponent<MeshRenderer>().sharedMaterial.SetVector("unity_LODFade", new Vector4(znachenie, 1,1,1));
but received a warning:
Trying to set builtin parameter "unity_LODFade". Will be ignored.
Help me please!