Skip to content

Instantly share code, notes, and snippets.

@mikedolan03
Forked from jhorikawa/VertexColor.shader
Last active March 19, 2019 03:09
Show Gist options
  • Save mikedolan03/b5ac3f6a5f2120c1c7d959fd5a423e28 to your computer and use it in GitHub Desktop.
Save mikedolan03/b5ac3f6a5f2120c1c7d959fd5a423e28 to your computer and use it in GitHub Desktop.
Unity Shader to visualize vertex color.
Shader "Custom/VertexColorT" {
SubShader{
Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:vert alpha
#pragma target 3.0
struct Input {
float4 vertColor;
};
void vert(inout appdata_full v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input, o);
o.vertColor = v.color;
}
void surf(Input IN, inout SurfaceOutput o) {
o.Albedo = IN.vertColor.rgb;
o.Alpha = .5;
}
ENDCG
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment