鸟语天空
ColorMaterial
post by:追风剑情 2014-7-17 0:54

使用顶点色

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"
}

运行效果

顶点色运行效果.png

评论:
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容