SHADERS

[Shader] Transparent single color shader

Human
November 15, 2013
0 Comments
Home
SHADERS
[Shader] Transparent single color shader


This shader can give the object a solid color. And the alpha value can be adjusted by adjusting transparency.

In Unity4.0 test without any problems. . .

Shader "Custom / TransparentSingleColorShader" { 
Properties { 
_Color ("Color", Color) = (1.0, 1.0, 1.0, 1.0) 

SubShader { 
Tags {"RenderType" = "Transparent" "Queue" = "Transparent"} 
Blend SrcAlpha OneMinusSrcAlpha 
cull Off 
LOD 200
CGPROGRAM 
# pragma Surface Surf Lambert
fixed4 _Color;
/ / Note: pointless Texture coordinate. I Could not GET Unity (or Cg) 
/ / to accept an empty or omit the Inputs Input Structure. 
struct Input { 
float2 uv_MainTex; 
};
void Surf (Input IN, inout SurfaceOutput O) { 
o.Albedo = _Color.rgb; 
o.Emission = _Color.rgb; / / * _Color.a; 
o.Alpha = _Color.a; 

ENDCG 

FallBack "Diffuse" 
}

Blog authors

No comments