hch
10 小时以前 a4eae6a0e2fbb2c2e49c13d2963ad4541049ead8
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
 
Shader "DynamicShadowProjector/Blit/Blur" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
 
    CGINCLUDE
    #include "UnityCG.cginc"
    sampler2D _MainTex;
    half4 _MainTex_TexelSize;
    struct v2f_3tap
    {
        float4 pos : SV_POSITION;
        half2  uv0 : TEXCOORD0;
        half4  uv1 : TEXCOORD1;
    };
    struct v2f_5tap
    {
        float4 pos : SV_POSITION;
        half2  uv0 : TEXCOORD0;
        half4  uv1 : TEXCOORD1;
        half4  uv2 : TEXCOORD2;
    };
    struct v2f_7tap
    {
        float4 pos : SV_POSITION;
        half2  uv0 : TEXCOORD0;
        half4  uv1 : TEXCOORD1;
        half4  uv2 : TEXCOORD2;
        half4  uv3 : TEXCOORD3;
    };
    half4  _OffsetH;
    half4  _OffsetV;
    fixed4 _WeightH;
    fixed4 _WeightV;
 
    v2f_3tap vert_3tap_H(appdata_img v)
    {
        v2f_3tap o;
        o.pos = UnityObjectToClipPos(v.vertex);
           o.uv0 = v.texcoord.xy;
           o.uv1 = v.texcoord.xyxy + _MainTex_TexelSize.x * half4(_OffsetH.x, 0, -_OffsetH.x, 0);
           return o;
    }
    v2f_3tap vert_3tap_V(appdata_img v)
    {
        v2f_3tap o;
        o.pos = UnityObjectToClipPos(v.vertex);
           o.uv0 = v.texcoord.xy;
           o.uv1 = v.texcoord.xyxy + _MainTex_TexelSize.y * half4(0, _OffsetV.x, 0, -_OffsetV.x);
           return o;
    }
    fixed4 frag_3tap_H(v2f_3tap i) : COLOR
    {
        fixed4 color = _WeightH.x*tex2D(_MainTex, i.uv0);
        color += _WeightH.y*tex2D(_MainTex, i.uv1.xy);
        color += _WeightH.y*tex2D(_MainTex, i.uv1.zw);
        return color;
    }
    fixed4 frag_3tap_V(v2f_3tap i) : COLOR
    {
        fixed4 color = _WeightV.x*tex2D(_MainTex, i.uv0);
        color += _WeightV.y*tex2D(_MainTex, i.uv1.xy);
        color += _WeightV.y*tex2D(_MainTex, i.uv1.zw);
        return color;
    }
    v2f_5tap vert_5tap_H(appdata_img v)
    {
        v2f_5tap o;
        o.pos = UnityObjectToClipPos(v.vertex);
           o.uv0 = v.texcoord.xy;
           o.uv1 = v.texcoord.xyxy + _MainTex_TexelSize.x * half4(_OffsetH.x, 0, -_OffsetH.x, 0);
           o.uv2 = v.texcoord.xyxy + _MainTex_TexelSize.x * half4(_OffsetH.y, 0, -_OffsetH.y, 0);
           return o;
    }
    v2f_5tap vert_5tap_V(appdata_img v)
    {
        v2f_5tap o;
        o.pos = UnityObjectToClipPos(v.vertex);
           o.uv0 = v.texcoord.xy;
           o.uv1 = v.texcoord.xyxy + _MainTex_TexelSize.y * half4(0, _OffsetV.x, 0, -_OffsetV.x);
           o.uv2 = v.texcoord.xyxy + _MainTex_TexelSize.y * half4(0, _OffsetV.y, 0, -_OffsetV.y);
           return o;
    }
    fixed4 frag_5tap_H(v2f_5tap i) : COLOR
    {
        fixed4 color = _WeightH.x*tex2D(_MainTex, i.uv0);
        color += _WeightH.y*tex2D(_MainTex, i.uv1.xy);
        color += _WeightH.y*tex2D(_MainTex, i.uv1.zw);
        color += _WeightH.z*tex2D(_MainTex, i.uv2.xy);
        color += _WeightH.z*tex2D(_MainTex, i.uv2.zw);
        return color;
    }
    fixed4 frag_5tap_V(v2f_5tap i) : COLOR
    {
        fixed4 color = _WeightV.x*tex2D(_MainTex, i.uv0);
        color += _WeightV.y*tex2D(_MainTex, i.uv1.xy);
        color += _WeightV.y*tex2D(_MainTex, i.uv1.zw);
        color += _WeightV.z*tex2D(_MainTex, i.uv2.xy);
        color += _WeightV.z*tex2D(_MainTex, i.uv2.zw);
        return color;
    }
    v2f_7tap vert_7tap_H(appdata_img v)
    {
        v2f_7tap o;
        o.pos = UnityObjectToClipPos(v.vertex);
           o.uv0 = v.texcoord.xy;
           o.uv1 = v.texcoord.xyxy + _MainTex_TexelSize.x * half4(_OffsetH.x, 0, -_OffsetH.x, 0);
           o.uv2 = v.texcoord.xyxy + _MainTex_TexelSize.x * half4(_OffsetH.y, 0, -_OffsetH.y, 0);
           o.uv3 = v.texcoord.xyxy + _MainTex_TexelSize.x * half4(_OffsetH.z, 0, -_OffsetH.z, 0);
           return o;
    }
    v2f_7tap vert_7tap_V(appdata_img v)
    {
        v2f_7tap o;
        o.pos = UnityObjectToClipPos(v.vertex);
           o.uv0 = v.texcoord.xy;
           o.uv1 = v.texcoord.xyxy + _MainTex_TexelSize.y * half4(0, _OffsetV.x, 0, -_OffsetV.x);
           o.uv2 = v.texcoord.xyxy + _MainTex_TexelSize.y * half4(0, _OffsetV.y, 0, -_OffsetV.y);
           o.uv3 = v.texcoord.xyxy + _MainTex_TexelSize.y * half4(0, _OffsetV.z, 0, -_OffsetV.z);
           return o;
    }
    fixed4 frag_7tap_H(v2f_7tap i) : COLOR
    {
        fixed4 color = _WeightH.x*tex2D(_MainTex, i.uv0);
        color += _WeightH.y*tex2D(_MainTex, i.uv1.xy);
        color += _WeightH.y*tex2D(_MainTex, i.uv1.zw);
        color += _WeightH.z*tex2D(_MainTex, i.uv2.xy);
        color += _WeightH.z*tex2D(_MainTex, i.uv2.zw);
        color += _WeightH.w*tex2D(_MainTex, i.uv3.xy);
        color += _WeightH.w*tex2D(_MainTex, i.uv3.zw);
        return color;
    }
    fixed4 frag_7tap_V(v2f_7tap i) : COLOR
    {
        fixed4 color = _WeightV.x*tex2D(_MainTex, i.uv0);
        color += _WeightV.y*tex2D(_MainTex, i.uv1.xy);
        color += _WeightV.y*tex2D(_MainTex, i.uv1.zw);
        color += _WeightV.z*tex2D(_MainTex, i.uv2.xy);
        color += _WeightV.z*tex2D(_MainTex, i.uv2.zw);
        color += _WeightV.w*tex2D(_MainTex, i.uv3.xy);
        color += _WeightV.w*tex2D(_MainTex, i.uv3.zw);
        return color;
    }
    
    ENDCG
 
    SubShader {
        ZTest Always Cull Off ZWrite Off
        Fog { Mode Off }
 
        Pass {        
            CGPROGRAM
            #pragma vertex vert_3tap_H
            #pragma fragment frag_3tap_H
            ENDCG
        }
        Pass {        
            CGPROGRAM
            #pragma vertex vert_3tap_V
            #pragma fragment frag_3tap_V
            ENDCG
        }
        Pass {        
            CGPROGRAM
            #pragma vertex vert_5tap_H
            #pragma fragment frag_5tap_H
            ENDCG
        }
        Pass {        
            CGPROGRAM
            #pragma vertex vert_5tap_V
            #pragma fragment frag_5tap_V
            ENDCG
        }
        Pass {        
            CGPROGRAM
            #pragma vertex vert_7tap_H
            #pragma fragment frag_7tap_H
            ENDCG
        }
        Pass {        
            CGPROGRAM
            #pragma vertex vert_7tap_V
            #pragma fragment frag_7tap_V
            ENDCG
        }
    }
}