【原】高光贴图参数放入颜色贴图的alpha通道中

今天美术想把高光贴图参数合成到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"
}

猜你喜欢

转载自www.cnblogs.com/hengsoft/p/10250910.html