Guest User

Untitled

a guest
Jan 27th, 2020
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. Shader "Unlit/GreyShader"
  2. {
  3. Properties
  4. {
  5. _ColorMultiplier ("ColorMultiplier", Vector) = (1,1,1,1)
  6. _Luminosity ("Luminosity", Float) = 0.5
  7. _Blend ("Blend", Float) = 0.5
  8. }
  9. SubShader
  10. {
  11. Tags { "RenderType"="Transparent" "IgnoreProjector"="True" "Queue"="Overlay"}
  12. ZTest Always
  13. ZWrite Off
  14. LOD 100
  15. //Blend SrcAlpha One
  16.  
  17. GrabPass
  18. {
  19. "_GrabTexture"
  20. }
  21.  
  22. Pass
  23. {
  24. Cull Off
  25. CGPROGRAM
  26. #pragma vertex vert
  27. #pragma fragment frag
  28.  
  29. #include "UnityCG.cginc"
  30.  
  31. struct appdata
  32. {
  33. float4 vertex : POSITION;
  34. float2 uv : TEXCOORD0;
  35. float4 color : COLOR;
  36. };
  37.  
  38. struct v2f
  39. {
  40. float4 grabPassUV : TEXCOORD2;
  41. float4 vertex : SV_POSITION;
  42. float4 color : COLOR;
  43. };
  44.  
  45. sampler2D _GrabTexture;
  46. float4 _ColorMultiplier;
  47. float _Luminosity;
  48. float _Blend;
  49.  
  50. v2f vert (appdata v)
  51. {
  52. v2f o;
  53. o.vertex = UnityObjectToClipPos(v.vertex);
  54. o.grabPassUV = ComputeGrabScreenPos(o.vertex);
  55. o.color = v.color;
  56. return o;
  57. }
  58.  
  59. fixed4 frag (v2f i) : SV_Target
  60. {
  61. fixed4 col = tex2Dproj(_GrabTexture, i.grabPassUV);
  62. col.xyz *= _ColorMultiplier;
  63. float target = (col.x+col.y+col.z)*_Luminosity/3.0;
  64. col = lerp(col, float4(target, target, target,col.w), _Blend);
  65. return col;
  66. }
  67. ENDCG
  68. }
  69. }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment