Thanks, actually I figured it out lol.

So here’s my version of OceanPro shader:

```
Shader "Ocean/Pro/OceanShader"
{
Properties
{
_SunPow("SunPow", float) = 256
_SeaColor("SeaColor", Color) = (1,1,1,1)
_ShoreSeaColor("ShoreSeaColor", Color) = (1,1,1,1)
_SkyBox("SkyBox", CUBE) = "" {}
_FoamTexture("Foam texture ", 2D) = "black" {}
_WaterOffset ("Water offset", Vector) = (0,0,0,0)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 200
Blend SrcAlpha OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
Cull Off
CGPROGRAM
#pragma surface surf Lambert vertex:vert
#pragma target 3.0
#pragma glsl
#include "UnityCG.cginc"
uniform sampler2D _FresnelLookUp, _Map0, _Map1, _Map2;
uniform float4 _GridSizes;
uniform float3 _SunColor, _SunDir;
uniform float _MaxLod, _LodFadeDist;
uniform sampler2D _CameraDepthTexture;
sampler2D _FoamTexture;
float3 _ShoreSeaColor;
float4 _WaterOffset;
float _SunPow;
float3 _SeaColor;
samplerCUBE _SkyBox;
struct Input
{
float3 worldPos;
//float3 viewDir;
float3 worldRefl;
float4 screenPos;
float4 color : COLOR;
float2 uv_FoamTexture;
INTERNAL_DATA
};
void vert(inout appdata_full v)
{
v.tangent = float4(1,0,0,1);
float3 worldPos = mul(_Object2World, v.vertex).xyz;
float dist = clamp(distance(_WorldSpaceCameraPos.xyz, worldPos) / _LodFadeDist, 0.0, 1.0);
float lod = _MaxLod * dist;
float ht = 0.0;
ht += tex2Dlod(_Map0, float4(worldPos.xz/_GridSizes.x, 0, lod)).x;
ht += tex2Dlod(_Map0, float4(worldPos.xz/_GridSizes.y, 0, lod)).y;
v.vertex.y += ht;
}
float Fresnel(float3 V, float3 N)
{
float costhetai = abs(dot(V, N));
return tex2D(_FresnelLookUp, float2(costhetai, 0.0)).a * 0.7; //looks better scaled down a little?
}
float3 Sun(float3 V, float3 N)
{
float3 H = normalize(V+_SunDir);
return _SunColor * pow(abs(dot(H,N)), _SunPow);
}
void surf(Input IN, inout SurfaceOutput o)
{
float2 uv = IN.worldPos.xz;
float2 slope = float2(0,0);
slope += tex2D(_Map1, uv/_GridSizes.x).xy;
slope += tex2D(_Map1, uv/_GridSizes.y).zw;
slope += tex2D(_Map2, uv/_GridSizes.z).xy;
slope += tex2D(_Map2, uv/_GridSizes.w).zw;
float3 N = normalize(float3(-slope.x, 2.0, -slope.y)); //shallow normal
float3 N2 = normalize(float3(-slope.x, 0.7, -slope.y)); //sharp normal
float3 V = normalize(_WorldSpaceCameraPos-IN.worldPos);
float fresnel = Fresnel(V, N);
fixed testZ = UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(IN.screenPos)));
testZ = LinearEyeDepth(testZ) - IN.screenPos.w;
fixed coastal = (1-IN.color.a) * 0.35f;
coastal *= coastal;
o.Normal = N.xzy;//this is tangent space?
float4 skyColor = texCUBE(_SkyBox, WorldReflectionVector(IN, o.Normal));//*float3(-1,1,0.5f)).rgb;//flip x?
float dist = distance(_WorldSpaceCameraPos, IN.worldPos);
float seaColorFactor;
seaColorFactor = 1- saturate(testZ * 0.02f);
float3 waterColor = seaColorFactor * _ShoreSeaColor + (1 - seaColorFactor) * _SeaColor;
float edgeBlendHigh = 0.25f;
float edgeBlendHigh2 = 0.35f;
float edgeBlendLow = 0.1f;
float edgeBlend = edgeBlendLow;
if(dist < 300 dist > 50)
{
edgeBlend = edgeBlendLow + (300 - dist)/250f * (edgeBlendHigh - edgeBlendLow);
}
else if(dist <= 50)
{
edgeBlend = edgeBlendHigh + (50 - dist)/50f * (edgeBlendHigh2 - edgeBlendHigh);
}
float foamColorFactor = 1 - saturate(testZ * edgeBlend);
if(foamColorFactor < 0.3)
{
foamColorFactor *= 2;
}
else
{
foamColorFactor = 0;
}
fixed2 foampos1 = IN.worldPos.xz;
fixed2 foampos2 = IN.worldPos.xz;
fixed4 foam = lerp(
tex2D( _FoamTexture, foampos1 * 0.010f ),
tex2D( _FoamTexture, foampos2 * 0.050f ),
clamp( sin( _Time.z * 0.5f + (IN.worldPos.x + IN.worldPos.z) * 0.1f ) * 0.5f + 0.5f, 0, 1 )
) * 2f * foamColorFactor;
waterColor = foamColorFactor * foam + (1 - foamColorFactor) * waterColor;
o.Albedo = lerp(waterColor, skyColor, fresnel/1.5f) + Sun(V,N2);
o.Alpha = lerp(testZ * 0.15f + 0.02f, 1, coastal);
}
ENDCG
}
FallBack "Diffuse"
}
```