DoubleSided.shader 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. Shader "Custom/DoubleSided"
  2. {
  3. Properties
  4. {
  5. _Color ("Color", Color) = (1,1,1,1)
  6. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  7. _Glossiness ("Smoothness", Range(0,1)) = 0.5
  8. _Metallic ("Metallic", Range(0,1)) = 0.0
  9. }
  10. SubShader
  11. {
  12. Tags { "RenderType"="Opaque" }
  13. LOD 200
  14. Cull Off
  15. CGPROGRAM
  16. // Physically based Standard lighting model, and enable shadows on all light types
  17. #pragma surface surf Standard fullforwardshadows
  18. // Use shader model 3.0 target, to get nicer looking lighting
  19. #pragma target 3.0
  20. sampler2D _MainTex;
  21. struct Input
  22. {
  23. float2 uv_MainTex;
  24. };
  25. half _Glossiness;
  26. half _Metallic;
  27. fixed4 _Color;
  28. // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  29. // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  30. // #pragma instancing_options assumeuniformscaling
  31. UNITY_INSTANCING_BUFFER_START(Props)
  32. // put more per-instance properties here
  33. UNITY_INSTANCING_BUFFER_END(Props)
  34. void surf (Input IN, inout SurfaceOutputStandard o)
  35. {
  36. // Albedo comes from a texture tinted by color
  37. fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  38. o.Albedo = c.rgb;
  39. // Metallic and smoothness come from slider variables
  40. o.Metallic = _Metallic;
  41. o.Smoothness = _Glossiness;
  42. o.Alpha = c.a;
  43. }
  44. ENDCG
  45. }
  46. FallBack "Diffuse"
  47. }