1 Shader "Hidden/Sepiatone Effect" {
2 Properties {
3     _MainTex (
"Base (RGB)", 2D) = "white" {}
4 }
5
6 SubShader {
7     Pass {
8         ZTest Always Cull Off ZWrite Off
9                 
10 CGPROGRAM
11 #pragma vertex vert_img
12 #pragma fragment frag
13 #include
"UnityCG.cginc"
14
15 uniform sampler2D _MainTex;
16
17 fixed4 frag (v2f_img i) : SV_Target
18 {
19     fixed4 original = tex2D(_MainTex, i.uv);
20     
21     
// get intensity value (Y part of YIQ color space)
22     
fixed Y = dot (fixed3(0.299, 0.587, 0.114), original.rgb);
23
24     
// Convert to Sepia Tone by adding constant
25     fixed4 sepiaConvert = float4 (
0.191, -0.054, -0.221, 0.0);
26     fixed4 output = sepiaConvert + Y;
27     output.a = original.a;
28     
29     
return output;
30 }
31 ENDCG
32
33     }
34 }
35
36 Fallback off
37
38 }


Gõ tìm kiếm nhanh...