1 Shader "Hidden/ColorCorrectionCurvesSimple" {
2     Properties {
3         _MainTex (
"Base (RGB)", 2D) = "" {}
4         _RgbTex (
"_RgbTex (RGB)", 2D) = "" {}
5     }
6     
7     
// Shader code pasted into all further CGPROGRAM blocks
8     CGINCLUDE
9
10     #include
"UnityCG.cginc"
11     
12     
struct v2f {
13         float4 pos : SV_POSITION;
14         half2 uv : TEXCOORD0;
15     };
16     
17     sampler2D _MainTex;
18     sampler2D _RgbTex;
19     
fixed _Saturation;
20     
21     v2f vert( appdata_img v )
22     {
23         v2f o;
24         o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
25         o.uv = v.texcoord.xy;
26         
return o;
27     }
28     
29     fixed4 frag(v2f i) : SV_Target
30     {
31         fixed4 color = tex2D(_MainTex, i.uv);
32         
33         fixed3 red = tex2D(_RgbTex, half2(color.r,
0.5/4.0)).rgb * fixed3(1,0,0);
34         fixed3 green = tex2D(_RgbTex, half2(color.g,
1.5/4.0)).rgb * fixed3(0,1,0);
35         fixed3 blue = tex2D(_RgbTex, half2(color.b,
2.5/4.0)).rgb * fixed3(0,0,1);
36         
37         color = fixed4(red+green+blue, color.a);
38
39         
fixed lum = Luminance(color.rgb);
40         color.rgb = lerp(fixed3(lum,lum,lum), color.rgb, _Saturation);
41         
return color;
42     }
43
44     ENDCG
45     
46 Subshader {
47  Pass {
48       ZTest Always Cull Off ZWrite Off
49
50       CGPROGRAM
51       #pragma vertex vert
52       #pragma fragment frag
53       ENDCG
54   }
55 }
56
57 Fallback off
58     
59 }
// shader


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