cybereality I already tried some variations of that, I can't get it to work. I actually asked here because it was the only place with a similar question that you responded.
void fragment() {
float depth_tex = texture(DEPTH_TEXTURE, SCREEN_UV,0.0).r;
float linear_depth = linearize_depth(depth_tex, 0.05, 100.0);
vec4 view = INV_PROJECTION_MATRIX * vec4(SCREEN_UV * 2.0 - 1.0, linear_depth, 1.0);
view.xyz /= view.w;
float prox = clamp(1.0 - smoothstep(view.z + edge_dis, view.z, VERTEX.z), 0.0, 1.0);
float blend = clamp(prox / edge_dis, 0.0, 1.0);
vec3 color = mix(edge_color.rgb, water, blend);
ALBEDO = vec3(color);
}

void fragment() {
float depth_tex = texture(DEPTH_TEXTURE, SCREEN_UV,0.0).r;
vec4 view = INV_PROJECTION_MATRIX * vec4(SCREEN_UV * 2.0 - 1.0, depth_tex, 1.0);
view.xyz /= view.w;
float linear_depth = linearize_depth(view.z, 0.05, 100.0);
float prox = clamp(1.0 - smoothstep(linear_depth + edge_dis, linear_depth, VERTEX.z), 0.0, 1.0);
float blend = clamp(prox / edge_dis, 0.0, 1.0);
vec3 color = mix(edge_color.rgb, water, blend);
ALBEDO = vec3(color);
}

void fragment() {
float depth_tex = texture(DEPTH_TEXTURE, SCREEN_UV,0.0).r;
vec4 view = INV_PROJECTION_MATRIX * vec4(SCREEN_UV * 2.0 - 1.0, depth_tex, 1.0);
view.xyz /= view.w;
float prox = clamp(1.0 - smoothstep(view.z + edge_dis, view.z, VERTEX.z), 0.0, 1.0);
float linear_depth = linearize_depth(prox, 0.05, 100.0);
float blend = clamp(linear_depth / edge_dis, 0.0, 1.0);
vec3 color = mix(edge_color.rgb, water, blend);
ALBEDO = vec3(color);
}
