Created
June 15, 2017 20:47
-
-
Save phest/016e6454e8f4305b618f09762bae3755 to your computer and use it in GitHub Desktop.
unity standard shader modified to display vertex colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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