1 Shader "Hidden/BrightPassFilterForBloom"
2 {
3     Properties
4     {
5         _MainTex (
"Base (RGB)", 2D) = "" {}
6     }
7     
8     CGINCLUDE
9     
10     #include
"UnityCG.cginc"
11     
12     
struct v2f
13     {
14         float4 pos : SV_POSITION;
15         float2 uv : TEXCOORD0;
16     };
17     
18     sampler2D _MainTex;
19     
20     half4 threshhold;
21     half useSrcAlphaAsMask;
22         
23     v2f vert( appdata_img v )
24     {
25         v2f o;
26         o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
27         o.uv = v.texcoord.xy;
28         
return o;
29     }
30     
31     half4 frag(v2f i) : SV_Target
32     {
33         half4 color = tex2D(_MainTex, i.uv);
34         
//color = color * saturate((color-threshhold.x) * 75.0); // didn't go well with HDR and din't make sense
35         color = color * lerp(
1.0, color.a, useSrcAlphaAsMask);
36         color = max(half4(
0,0,0,0), color-threshhold.x);
37         
return color;
38     }
39
40     ENDCG
41     
42     Subshader
43     {
44         Pass
45         {
46               ZTest Always Cull Off ZWrite Off
47         
48               CGPROGRAM
49               
50               #pragma vertex vert
51               #pragma fragment frag
52         
53               ENDCG
54         }
55     }
56     Fallback off
57 }


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