Advertisement
Guest User

SurfaceShaderVertexColor

a guest
Aug 30th, 2018
1,483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. Shader "Custom/SurfaceShaderVertexColor" {
  2. Properties {
  3.  
  4. }
  5. SubShader {
  6. Tags { "RenderType"="Opaque" }
  7. LOD 200
  8.  
  9. CGPROGRAM
  10. // Physically based Standard lighting model, and enable shadows on all light types
  11. #pragma surface surf Standard fullforwardshadows
  12.  
  13. // Use shader model 3.0 target, to get nicer looking lighting
  14. #pragma target 3.0
  15.  
  16. sampler2D _MainTex;
  17.  
  18. struct Input {
  19. float4 vertexColor: COLOR; // vertex color
  20. };
  21.  
  22.  
  23. // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  24. // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  25. // #pragma instancing_options assumeuniformscaling
  26. UNITY_INSTANCING_BUFFER_START(Props)
  27. // put more per-instance properties here
  28. UNITY_INSTANCING_BUFFER_END(Props)
  29.  
  30. void surf (Input IN, inout SurfaceOutputStandard o) {
  31. // Albedo comes from a texture tinted by color
  32. o.Albedo = IN.vertexColor.rgb; // vertex color
  33. // Metallic and smoothness come from slider variables
  34.  
  35. o.Alpha = c.a;
  36. }
  37. ENDCG
  38. }
  39. FallBack "Diffuse"
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement