Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Unlit/GreyShader"
- {
- Properties
- {
- _ColorMultiplier ("ColorMultiplier", Vector) = (1,1,1,1)
- _Luminosity ("Luminosity", Float) = 0.5
- _Blend ("Blend", Float) = 0.5
- }
- SubShader
- {
- Tags { "RenderType"="Transparent" "IgnoreProjector"="True" "Queue"="Overlay"}
- ZTest Always
- ZWrite Off
- LOD 100
- //Blend SrcAlpha One
- GrabPass
- {
- "_GrabTexture"
- }
- Pass
- {
- Cull Off
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #include "UnityCG.cginc"
- struct appdata
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- float4 color : COLOR;
- };
- struct v2f
- {
- float4 grabPassUV : TEXCOORD2;
- float4 vertex : SV_POSITION;
- float4 color : COLOR;
- };
- sampler2D _GrabTexture;
- float4 _ColorMultiplier;
- float _Luminosity;
- float _Blend;
- v2f vert (appdata v)
- {
- v2f o;
- o.vertex = UnityObjectToClipPos(v.vertex);
- o.grabPassUV = ComputeGrabScreenPos(o.vertex);
- o.color = v.color;
- return o;
- }
- fixed4 frag (v2f i) : SV_Target
- {
- fixed4 col = tex2Dproj(_GrabTexture, i.grabPassUV);
- col.xyz *= _ColorMultiplier;
- float target = (col.x+col.y+col.z)*_Luminosity/3.0;
- col = lerp(col, float4(target, target, target,col.w), _Blend);
- return col;
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment