Shader "SShader/BlendShader" { Properties { _Layer1("Base (RGB) Gloss (A)", 2D) = "white" {} _Layer2("Base (RGB) Gloss (A)", 2D) = "white" {} _Slider("_Slider", Range(0,1) ) = 0.5 } SubShader { Tags { "Queue"="Geometry" "IgnoreProjector"="False" "RenderType"="Opaque" } Cull Back ZWrite On ZTest LEqual ColorMask RGBA Fog{} CGPROGRAM #pragma surface surf BlinnPhongEditor dualforward #pragma target 2.0 sampler2D _Layer1; sampler2D _Layer2; float _Slider; struct EditorSurfaceOutput { half3 Albedo; half3 Normal; half3 Emission; half3 Gloss; half Specular; half Alpha; half4 Custom; }; inline half4 LightingBlinnPhongEditor_PrePass (EditorSurfaceOutput s, half4 light) { return float4( s.Albedo.x, s.Albedo.y, s.Albedo.z, 1.0 ); } inline half4 LightingBlinnPhongEditor (EditorSurfaceOutput s, half3 lightDir, half3 viewDir, half atten) { half3 h = normalize (lightDir + viewDir); half diff = max (0, dot ( lightDir, s.Normal )); float nh = max (0, dot (s.Normal, h)); float spec = pow (nh, s.Specular*128.0); half4 res; res.rgb = _LightColor0.rgb * diff; res.w = spec * Luminance (_LightColor0.rgb); res *= atten * 2.0; return LightingBlinnPhongEditor_PrePass( s, res ); } inline half4 LightingBlinnPhongEditor_DirLightmap (EditorSurfaceOutput s, fixed4 color, fixed4 scale, half3 viewDir, bool surfFuncWritesNormal, out half3 specColor) { UNITY_DIRBASIS half3 scalePerBasisVector; half3 lm = DirLightmapDiffuse (unity_DirBasis, color, scale, s.Normal, surfFuncWritesNormal, scalePerBasisVector); half3 lightDir = normalize (scalePerBasisVector.x * unity_DirBasis[0] + scalePerBasisVector.y * unity_DirBasis[1] + scalePerBasisVector.z * unity_DirBasis[2]); half3 h = normalize (lightDir + viewDir); float nh = max (0, dot (s.Normal, h)); float spec = pow (nh, s.Specular * 128.0); specColor = lm * _SpecColor.rgb * s.Gloss * spec; return half4(lm, spec); } struct Input { float2 uv_Layer1; float2 uv_Layer2; }; void surf (Input IN, inout EditorSurfaceOutput o) { o.Normal = float3(0.0,0.0,1.0); float4 Sampled2D0=tex2D(_Layer1,IN.uv_Layer1.xy); float4 Sampled2D1=tex2D(_Layer2,IN.uv_Layer2.xy); float4 Lerp0=lerp(Sampled2D0,Sampled2D1,_Slider.xxxx); o.Albedo = Lerp0; o.Normal = normalize(o.Normal); } ENDCG } Fallback "Diffuse" }