1 Shader "Hidden/ColorCorrectionSelective" {
2     Properties {
3         _MainTex (
"Base (RGB)", 2D) = "" {}
4     }
5     
6     CGINCLUDE
7     
8     #include
"UnityCG.cginc"
9     
10     
struct v2f {
11         float4 pos : SV_POSITION;
12         float2 uv : TEXCOORD0;
13     };
14     
15     sampler2D _MainTex;
16     
17     float4 selColor;
18     float4 targetColor;
19     
20     v2f vert( appdata_img v ) {
21         v2f o;
22         o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
23         o.uv = v.texcoord.xy;
24         
return o;
25     }
26     
27     fixed4 frag(v2f i) : SV_Target {
28         fixed4 color = tex2D (_MainTex, i.uv);
29     
30         
fixed diff = saturate (2.0 * length (color.rgb - selColor.rgb));
31         color = lerp (targetColor, color, diff);
32         
return color;
33     }
34
35     ENDCG
36     
37 Subshader {
38  Pass {
39       ZTest Always Cull Off ZWrite Off
40
41       CGPROGRAM
42       
43       #pragma vertex vert
44       #pragma fragment frag
45       
46       ENDCG
47   }
48 }
49
50 Fallback off
51     
52 }


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