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