SurfaceShader_VC.shader 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Shader "Custom/SurfaceShader_VC" {
  2. Properties{
  3. _Color("Color", Color) = (1,1,1,1)
  4. _MainTex("Albedo (RGB)", 2D) = "white" {}
  5. _Normal("Normap Map", 2D) = "bump" {}
  6. }
  7. SubShader{
  8. Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
  9. LOD 200
  10. Blend One OneMinusSrcAlpha
  11. CGPROGRAM
  12. // Physically based Standard lighting model, and enable shadows on all light types
  13. #pragma surface surf Standard fullforwardshadows vertex:vert alpha:fade
  14. // Use shader model 3.0 target, to get nicer looking lighting
  15. #pragma target 3.0
  16. sampler2D _MainTex;
  17. sampler2D _Normal;
  18. struct Input {
  19. float2 uv_MainTex;
  20. float4 vertex : SV_POSITION;
  21. float4 color : COLOR;
  22. };
  23. void vert(inout appdata_full v, out Input o)
  24. {
  25. UNITY_INITIALIZE_OUTPUT(Input, o);
  26. o.color = v.color;
  27. }
  28. fixed4 _Color;
  29. void surf(Input IN, inout SurfaceOutputStandard o) {
  30. // Albedo comes from a texture tinted by color
  31. fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
  32. o.Albedo = c.rgb*IN.color;
  33. o.Normal = UnpackNormal(tex2D(_Normal, IN.uv_MainTex));
  34. o.Alpha = c.a*IN.color.a;
  35. }
  36. ENDCG
  37. }
  38. FallBack "Diffuse"
  39. }