Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save phest/016e6454e8f4305b618f09762bae3755 to your computer and use it in GitHub Desktop.
Save phest/016e6454e8f4305b618f09762bae3755 to your computer and use it in GitHub Desktop.
unity standard shader modified to display vertex colors
Shader "Custom/StandardSurfaceShaderWithVertexColor" {
Properties {
_MainTint("Global Color Tint", Color) = (1,1,1,1)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:vert
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
float4 _MainTint;
struct Input {
float2 uv_MainTex;
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 * _MainTint.rgb;
}
ENDCG
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment