今天美术想把高光贴图参数合成到Main贴图中,减少贴图数,挺好,知道省内存了。
于是简单改了改surface着色器。
Shader "Custom/HighLightByAlphaPass" {
    Properties {
         _MainTex ("Base (RGBA A--HighLight)", 2D) = "white" {}
         _MainColor("Diffuse",Color) = (1,1,1,1)
         _SpecColor("Specular Color", Color) = (1, 1, 1, 1)
    _Gloss("Gloss", Range(0.01, 10)) = 0.5
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200
        CGPROGRAM
        #pragma surface surf BlinnPhong
        sampler2D _MainTex;
        float _SpecularPower;
     float _Gloss;
       float _Spec;
       float4 _MainColor;
        struct Input {
            float2 uv_MainTex;
        };
        void surf (Input IN, inout SurfaceOutput o) {
            float4 c = tex2D (_MainTex, IN.uv_MainTex);
            o.Specular = c.a;
       o.Gloss = _Gloss;
            o.Albedo = c.rgb * _MainColor.rgb;
        }
        ENDCG
    } 
    FallBack "Diffuse"
}

 

版权声明:本文为hengsoft原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/hengsoft/p/10250910.html