原高光贴图参数放入颜色贴图的alpha通道中
Posted hengsoft
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了原高光贴图参数放入颜色贴图的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
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
#pragma surface surf BlinnPhong
sampler2D _MainTex;
float _SpecularPower;
float _Gloss;
float _Spec;
float4 _MainColor;
float _SpecularPower;
float _Gloss;
float _Spec;
float4 _MainColor;
struct Input {
float2 uv_MainTex;
};
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"
}
float4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Specular = c.a;
o.Gloss = _Gloss;
o.Albedo = c.rgb * _MainColor.rgb;
}
ENDCG
}
FallBack "Diffuse"
}
以上是关于原高光贴图参数放入颜色贴图的alpha通道中的主要内容,如果未能解决你的问题,请参考以下文章