Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. Shader "Custom/StandardVertex" {
  2. Properties {
  3. _Color ("Color", Color) = (1,1,1,1)
  4. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  5. _Glossiness ("Smoothness", Range(0,1)) = 0.5
  6. _Metallic ("Metallic", Range(0,1)) = 0.0
  7. }
  8. SubShader {
  9. Tags { "RenderType"="Opaque" }
  10. LOD 200
  11.  
  12. CGPROGRAM
  13. #pragma surface surf Standard vertex:vert fullforwardshadows
  14. #pragma target 3.0
  15. struct Input {
  16. float2 uv_MainTex;
  17. float3 vertexColor; // Vertex color stored here by vert() method
  18. };
  19.  
  20. struct v2f {
  21. float4 pos : SV_POSITION;
  22. fixed4 color : COLOR;
  23. };
  24.  
  25. void vert (inout appdata_full v, out Input o)
  26. {
  27. UNITY_INITIALIZE_OUTPUT(Input,o);
  28. o.vertexColor = v.color; // Save the Vertex Color in the Input for the surf() method
  29. }
  30.  
  31. sampler2D _MainTex;
  32.  
  33. half _Glossiness;
  34. half _Metallic;
  35. fixed4 _Color;
  36.  
  37. void surf (Input IN, inout SurfaceOutputStandard o)
  38. {
  39. // Albedo comes from a texture tinted by color
  40. fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  41. o.Albedo = c.rgb * IN.vertexColor; // Combine normal color with the vertex color
  42. // Metallic and smoothness come from slider variables
  43. o.Metallic = _Metallic;
  44. o.Smoothness = _Glossiness;
  45. o.Alpha = c.a;
  46. }
  47. ENDCG
  48. }
  49. FallBack "Diffuse"
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement