1. 程式人生 > >【原】高光貼圖參數放入顏色貼圖的alpha通道中

【原】高光貼圖參數放入顏色貼圖的alpha通道中

llb ceo -- shade struct surf render fall diffuse

今天美術想把高光貼圖參數合成到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"
}

【原】高光貼圖參數放入顏色貼圖的alpha通道中