Skip to content

Instantly share code, notes, and snippets.

@wtekteam
Last active October 27, 2015 14:17
Show Gist options
  • Save wtekteam/61a12932dc65f102ee74 to your computer and use it in GitHub Desktop.
Save wtekteam/61a12932dc65f102ee74 to your computer and use it in GitHub Desktop.
A simple vertex color shader using CG.
Shader "VertexColour"
{
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f
{
float4 pos : SV_POSITION;
float3 color : COLOR0;
};
v2f vert (appdata_full v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.color = v.color;
return o;
}
half4 frag (v2f i) : COLOR
{
return half4 (i.color, 1);
}
ENDCG
}
}
Fallback "VertexLit"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment