使用顶点色
ColorMaterial也可以配合Emission,从而使用顶点色作为自发光的色彩。
Shader "Custom/ColorMaterial" {
Properties {
_Color ("Main Color", Color) = (1, 1, 1, 1)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Pass {
//使用顶点色代替Material块中的漫反射和环境色
ColorMaterial AmbientAndDiffuse
Material {
Ambient [_Color]
Diffuse [_Color]
}
Lighting On
SetTexture [_] {
constantColor [_Color]
combine primary * constant double
}
}
}
FallBack "Diffuse"
}
运行效果