1 Shader "Hidden/LensFlareCreate" {
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[
4] : TEXCOORD0;
13     };
14         
15     fixed4 colorA;
16     fixed4 colorB;
17     fixed4 colorC;
18     fixed4 colorD;
19     
20     sampler2D _MainTex;
21         
22     v2f vert( appdata_img v ) {
23         v2f o;
24         o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
25
26         o.uv[
0] = ( ( v.texcoord.xy - 0.5 ) * -0.85 ) + 0.5;
27         o.uv[
1] = ( ( v.texcoord.xy - 0.5 ) * -1.45 ) + 0.5;
28         o.uv[
2] = ( ( v.texcoord.xy - 0.5 ) * -2.55 ) + 0.5;
29         o.uv[
3] = ( ( v.texcoord.xy - 0.5 ) * -4.15 ) + 0.5;
30         
return o;
31     }
32     
33     fixed4 frag(v2f i) : SV_Target {
34         fixed4 color = float4 (
0,0,0,0);
35         color += tex2D(_MainTex, i.uv[
0] ) * colorA;
36         color += tex2D(_MainTex, i.uv[
1] ) * colorB;
37         color += tex2D(_MainTex, i.uv[
2] ) * colorC;
38         color += tex2D(_MainTex, i.uv[
3] ) * colorD;
39         
return color;
40     }
41
42     ENDCG
43     
44 Subshader {
45  Blend One One
46  Pass {
47       ZTest Always Cull Off ZWrite Off
48
49       CGPROGRAM
50
51       #pragma vertex vert
52       #pragma fragment frag
53
54       ENDCG
55   }
56 }
57     
58 Fallback off
59
60 }
// shader


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