Unity Shader Example 25 (在ShaderLab Surface 添加顶点颜色与透明效果)

Shader "Test" {
Properties {
	_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
	Tags { "RenderType"="Opaque" }
	LOD 150
	ZWrite On 
	Blend SrcAlpha OneMinusSrcAlpha

CGPROGRAM
//#pragma surface surf Lambert noforwardadd
#pragma surface surf Lambert noforwardadd keepalpha

sampler2D _MainTex;

struct Input {
	float2 uv_MainTex;
	float4 vertexColor : COLOR;
};

void surf (Input IN, inout SurfaceOutput o) {
	fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.vertexColor;
	o.Albedo = c.rgb;
	o.Alpha = c.a;
}
ENDCG
}

Fallback "Mobile-VertexLit"
}

你可能感兴趣的:(unity3d,shader)