Синтаксис:
Используется csharp
Shader "AlphaColor" {
Properties {
_Color ("Main Color", Color) = (1,1,1,0)
_Color2 ("Alpha Color", Color) = (1,1,1,0)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
_BumpMap ("Bumpmap", 2D) = "bump" {}
}
SubShader {
Pass {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting On
SeparateSpecular On
// 1. combiner: fade RGB from texture to color2 using texture's alpha
SetTexture [_MainTex] {
combine texture lerp (texture) constant
constantColor [_Color2]
}
// SetTexture [_MainTex] {
// Combine texture * primary DOUBLE, texture * primary
// }
// 2. combiner: get the color calculated above(previous) and multiply that with lighting (primary)
SetTexture [_MainTex] {
combine primary * previous
}
}
}
// Tell this shader to fall back to vertex lit if the user can't run it
FallBack " VertexLit"
}
Properties {
_Color ("Main Color", Color) = (1,1,1,0)
_Color2 ("Alpha Color", Color) = (1,1,1,0)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Emission ("Emmisive Color", Color) = (0,0,0,0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
_BumpMap ("Bumpmap", 2D) = "bump" {}
}
SubShader {
Pass {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting On
SeparateSpecular On
// 1. combiner: fade RGB from texture to color2 using texture's alpha
SetTexture [_MainTex] {
combine texture lerp (texture) constant
constantColor [_Color2]
}
// SetTexture [_MainTex] {
// Combine texture * primary DOUBLE, texture * primary
// }
// 2. combiner: get the color calculated above(previous) and multiply that with lighting (primary)
SetTexture [_MainTex] {
combine primary * previous
}
}
}
// Tell this shader to fall back to vertex lit if the user can't run it
FallBack " VertexLit"
}