Search Unity

Easy Water 2.0 - Mobile Compatible [RELEASED]

Discussion in 'Assets and Asset Store' started by Grespon, May 3, 2012.

  1. Grespon

    Grespon

    Joined:
    Apr 13, 2012
    Posts:
    388
    Hi,

    Try this shader please!

    Code (CSharp):
    1. Shader "Caustics"
    2. {
    3.     Properties
    4.     {
    5.         _Color("Main Color", Color) = (1,1,1,1)
    6.         _Caustics("Caustics Tex", 2D) = "white" {}
    7.         _Speed("_Speed", Float) = 1
    8.         _Intensity("_Intensity", Float) = 1
    9.         _Tile("_Tile", Float) = 5
    10.         _FadeRange("Fade Range", Range(0.0, 20.0)) = 1
    11.     }
    12.         SubShader
    13.     {
    14.             Tags{ "Queue" = "Transparent" }
    15.      
    16.         LOD 200
    17.         Pass
    18.     {
    19.         Blend One One
    20.         ZWrite Off
    21.         CGPROGRAM
    22. #include "UnityCG.cginc"
    23. #pragma vertex vert
    24. #pragma fragment frag
    25. #pragma fragmentoption ARB_precision_hint_fastest
    26.  
    27.         uniform sampler2D _Caustics;
    28.         float _Speed;
    29.         float _Intensity;
    30.         float _Tile;
    31.  
    32.     uniform fixed4 _Color;
    33.     uniform float _FadeRange;
    34.  
    35.     // Projector-specific uniforms
    36.     uniform float4x4 unity_Projector; // transformation matrix
    37.     // from object space to projector space
    38.  
    39.     // Used for computing the texture
    40.     float4 _Caustics_ST;
    41.  
    42.     struct input
    43.     {
    44.         float4 vertex : POSITION;
    45.         float3 texcoord : TEXCOORD0;
    46.         float4 normal : NORMAL;
    47.         fixed4 color : COLOR;
    48.     };
    49.  
    50.     struct v2f
    51.     {
    52.         float4 position : POSITION;
    53.         float4 uv : TEXCOORD0;
    54.         fixed4 vcolor : COLOR;
    55.     };
    56.  
    57.     v2f vert(input v)
    58.     {
    59.         v2f o;
    60.  
    61.         o.position = UnityObjectToClipPos(v.vertex);
    62.  
    63.         float3 vertexToCamDir = ObjSpaceViewDir(v.vertex);
    64.  
    65.         o.uv.xy = mul(unity_Projector, v.vertex);
    66.  
    67.         o.uv.z = 1 - abs(dot(normalize(vertexToCamDir), v.normal));
    68.         o.vcolor = v.color;
    69.         return o;
    70.     }
    71.  
    72.     fixed4 frag(v2f i) : COLOR
    73.     {
    74.  
    75.         float texPos = _Speed * _Time;
    76.  
    77.         float4 tex = tex2D(_Caustics, (float2(i.uv.xy) * _Tile / i.uv.w) + texPos);
    78.         float4 tex2 = tex2D(_Caustics, (float2(i.uv.x, i.uv.y + (2.5 * _Tile)) *_Tile / i.uv.w) - texPos);
    79.  
    80.         float fade = pow((1 - i.uv.z), _FadeRange);
    81.  
    82.         float4 finalTex = (tex * tex2) * _Intensity * fade;
    83.  
    84.      
    85.         return finalTex;
    86.     }
    87.         ENDCG
    88.     }
    89.     }
    90.         FallBack "Diffuse"
    91. }
     
  2. Custard1

    Custard1

    Joined:
    Aug 14, 2012
    Posts:
    10
    Sorry for the delayed response. Thanks very much for looking at this.
     
  3. spampinato

    spampinato

    Joined:
    Jun 1, 2016
    Posts:
    2
    I am having issues converting the easy water material to the new lightweight render pipeline. Will there be an update to allow for the conversion to work. THis is the error I get.

    EasyWater_Pool_material was not upgraded. There's no upgrader to convert EWater/Reflective/EasyWater14_C2TBDOR shader to selected pipeline
    UnityEditor.Rendering.LWRP.LightweightRenderPipelineMaterialUpgrader:UpgradeSelectedMaterials()