标签:fallback 着色器 bsh 合成 nbsp out shader pass specular
今天美术想把高光贴图参数合成到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通道中
标签:fallback 着色器 bsh 合成 nbsp out shader pass specular
原文地址:https://www.cnblogs.com/hengsoft/p/10250910.html