一、显示纯颜色物体
Shader "Example/FixedSolidColor" {
Properties{
_Color("MainColor (RGB)", Color) = (1,1,1,1)
}
SubShader{
pass {
Lighting on
Material{
Diffuse[_Color]
}
}
}
FallBack "Diffuse"
}
二、各种颜色通道
Shader "Example/FixedFullColor" {
Properties{
_Color("Main Color", Color) = (1,1,1,0.5)
_SpecColor("Spec Color", Color) = (1,1,1,1)
_Emission("Emmisive Color", Color) = (0,0,0,0)
_Shininess("Shininess", Range(0.01, 1)) = 0.7
}
SubShader{
Pass{
Lighting On
SeparateSpecular On
Material{
Diffuse[_Color]
Ambient[_Color]
Shininess[_Shininess]
Specular[_SpecColor]
Emission[_Emission]
}
}
}
}
三、显示一张贴图
Shader "Example/FixedOnePic" {
Properties{
_Color("MainColor(RGB)",Color) = (1,1,1,1)
_MainTex("Base (RGB)", 2D) = "white" {}
}
SubShader{
Pass{
Lighting on
Color(1,1,0,1)
Material{
Diffuse[_Color]
}
SetTexture[_MainTex]{
//材质 * 定点颜色
Combine texture * primary DOUBLE
}
}
}
FallBack "Diffuse"
}
四、多张贴图叠加
Shader "Example/FixedMulPic" {
Properties{
_Color("MainColor(RGB)",Color) = (1,1,1,1)
_MainTex("Base (RGB)", 2D) = "white" {}
_MainTex2("Base2 (RGB)", 2D) = "white" {}
_MainTex3("Base3 (RGB)", 2D) = "white" {}
}
SubShader{
Pass{
Lighting on
Color(1,1,0,1)
Material{
Diffuse[_Color]
}
SetTexture[_MainTex]{
//第一张材质 * 定点颜色
Combine texture * primary DOUBLE
}
SetTexture[_MainTex2]{
//材质 * 之前累积(这里即第一张材质)
Combine texture * previous DOUBLE
}
SetTexture[_MainTex3]{
//材质 *
之前累积
Combine texture * previous DOUBLE
}
}
}
FallBack "Diffuse"
}
五、透明通道贴图+双面显示
Shader "Example/FixedAlphaCull" {
Properties{
_Color("MainColor(RGB)",Color) = (1,1,1,1)
_MainTex("Base (RGB)", 2D) = "white" {}
}
SubShader{
Pass{
Blend SrcAlpha OneMinusSrcAlpha
Cull off
Lighting on
Color(1,1,0,1)
Material{
Diffuse[_Color]
}
SetTexture[_MainTex]{
Combine texture * primary DOUBLE
}
}
}
FallBack "Diffuse"
}