SurfaceDarkenable.shader 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. Shader "Custom/SurfaceDarkenable" {
  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. _Brightness("Brightness Multiplier", Range(0,1)) = 1
  8. }
  9. SubShader {
  10. Tags { "RenderType"="Opaque" }
  11. LOD 200
  12. CGPROGRAM
  13. // Physically based Standard lighting model, and enable shadows on all light types
  14. #pragma surface surf Standard fullforwardshadows
  15. // Use shader model 3.0 target, to get nicer looking lighting
  16. #pragma target 3.0
  17. sampler2D _MainTex;
  18. struct Input {
  19. float2 uv_MainTex;
  20. };
  21. half _Glossiness;
  22. half _Metallic;
  23. fixed4 _Color;
  24. float _Brightness;
  25. void surf (Input IN, inout SurfaceOutputStandard o) {
  26. // Albedo comes from a texture tinted by color
  27. fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  28. c.rgb *= _Brightness;
  29. o.Albedo = c.rgb;
  30. // Metallic and smoothness come from slider variables
  31. o.Metallic = _Metallic;
  32. o.Smoothness = _Glossiness;
  33. o.Alpha = c.a;
  34. }
  35. ENDCG
  36. }
  37. FallBack "Diffuse"
  38. }