leonard Wu
2018-08-02 8175a85734cf5ae2a2d26d913ff30a14c2377029
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
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
 
Shader "DynamicShadowProjector/Blit/Blit" {
    Properties {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
    }
    CGINCLUDE
    #include "UnityCG.cginc"
    struct v2f_blit
    {
        float4 pos : SV_POSITION;
        half4  uv0 : TEXCOORD0;
    };
    half _MipLevel;
    half _MipBias;
    sampler2D _MainTex;
    ENDCG
    SubShader {
        ZTest Always Cull Off ZWrite Off
        Fog { Mode Off }
        Pass {
            CGPROGRAM
            #pragma vertex vert_lod
            #pragma fragment frag_lod
            #pragma target 3.0
            v2f_blit vert_lod(appdata_img v)
            {
                v2f_blit o;
                o.pos = UnityObjectToClipPos(v.vertex);
                o.uv0.xy = v.texcoord.xy;
                o.uv0.zw = _MipLevel;
                return o;
            }
            fixed4 frag_lod(v2f_blit i) : COLOR
            {
                return tex2Dlod(_MainTex, i.uv0);
            }
            ENDCG
        }
    } 
    SubShader {
        ZTest Always Cull Off ZWrite Off
        Fog { Mode Off }
        Pass {
            CGPROGRAM
            #pragma vertex vert_bias
            #pragma fragment frag_bias
            v2f_blit vert_bias(appdata_img v)
            {
                v2f_blit o;
                o.pos = UnityObjectToClipPos(v.vertex);
                o.uv0.xy = v.texcoord.xy;
                o.uv0.zw = _MipBias;
                return o;
            }
            fixed4 frag_bias(v2f_blit i) : COLOR
            {
                return tex2Dbias(_MainTex, i.uv0);
            }
            ENDCG
        }
    } 
}