Skip to content

Instantly share code, notes, and snippets.

@Stektpotet
Created January 18, 2017 22:03
Show Gist options
  • Save Stektpotet/81a9dd68c09b2675e5e702cb8c4bfa64 to your computer and use it in GitHub Desktop.
Save Stektpotet/81a9dd68c09b2675e5e702cb8c4bfa64 to your computer and use it in GitHub Desktop.
Shader "Custom/StandardVertex" {
Properties {
_Color ("ColorTint", Color) = (1,1,1)
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard vertex:vert fullforwardshadows
#pragma target 3.0
struct Input {
float4 vertexColor; // Vertex color
};
void vert (inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input,o);
o.vertexColor = v.color; // Save the Vertex Color in the Input for the surf() method
}
fixed3 _Color;
half _Glossiness;
half _Metallic;
void surf (Input IN, inout SurfaceOutputStandard o)
{
o.Albedo = _Color.rgb * IN.vertexColor; // Combine normal color with the vertex color
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
}
ENDCG
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment