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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
 
Shader "Environment/Water_2" {
 
    Properties
    {
        _MainCol("_MainCol", Color) = (.5,.5,.5,1)
        _MainTex("_MainTex", 2D) = "black" {}
        _MaskTex("_MaskTex", 2D) = "black" {}
 
        _Speed("_Speed", Vector) = (0,6,0,6)
        _Disturbance("_Disturbance", Range(0,5)) = 0.6
    }
 
        SubShader
    {
        Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" }
        Blend SrcAlpha OneMinusSrcAlpha
        ColorMask RGB
        Cull Off Lighting Off ZWrite Off
 
        Pass
    {
        CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#pragma multi_compile_particles
#pragma multi_compile_fog
#include "UnityCG.cginc"
        float4 _MainCol;
    sampler2D _MainTex;
    sampler2D _MaskTex;
    sampler2D _WhiteWaterTex;
    struct appdata_t
    {
        float4 vertex : POSITION;
        float2 texcoord : TEXCOORD0;
    };
 
    struct v2f
    {
        float4 vertex : POSITION;
        float2 texcoord : TEXCOORD0;
        float2 texcoordM : TEXCOORD1;
        UNITY_FOG_COORDS(2)
    };
 
    float4 _MainTex_ST;
    float4 _MaskTex_ST;
    float4 _Speed;
    float _Disturbance;
    v2f vert(appdata_t v)
    {
        v2f o;
        o.vertex = UnityObjectToClipPos(v.vertex);
        o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
        o.texcoordM = TRANSFORM_TEX(v.texcoord, _MaskTex);
 
        UNITY_TRANSFER_FOG(o,o.vertex);
        return o;
    }
 
    fixed4 frag(v2f i) : COLOR
    {
        half2 distortOffset = i.texcoord + (_Time.zw * _Speed.xy * 0.05 + _Time.wz * _Speed.zw * 0.1) * _Disturbance;
        half4 col = tex2D(_MainTex, distortOffset);
        float2 uv = i.texcoord + _Speed * _Time.x + col.rg * _Disturbance;
        half4 mask = tex2D(_MaskTex, i.texcoordM);
 
        col = tex2D(_MainTex,uv)* _MainCol;
 
        col.a = mask.r * _MainCol.a;
        UNITY_APPLY_FOG(i.fogCoord, col);
        return col;
    }
        ENDCG
    }
 
    }
}