ZED_Surface_PostProcessing.shader 1.7 KB

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