Repository: godot
Issue: Vulkan: Water shader looks different between 3.x (GLES3) and 4.0
Labels: discussion,topic:rendering,needs testing,topic:3d

### Godot version

4.0 dev (e44a2f1680)

### System information

Linux, RTX3080, NVIDIA drivers

### Issue description

While porting my game prototype from 3.4 to 4.0 I noticed that the water shader I was using looks different.

The shader originaly comes from this [video](https://www.youtube.com/watch?v=5MfcliFqjnE), but I made some small modifications to it (see attached projects).

Here is what the sample project on 3.4 gives:
![low_poly_water_3_4](https://user-images.githubusercontent.com/14923636/180059050-f83077c9-36f2-474e-bce8-6cb78112c37d.png)

And the same with 4.0:
![low_poly_water_4_0](https://user-images.githubusercontent.com/14923636/180059081-547adf83-c695-4b46-9121-4206e8cb30fc.png)

I tried to match the environments as much as possible. All the shader parameters are the same in both versions.

To me there are two things wrong here:
 1. The transparency: With 3.4 there is some slight transparency around the boxes (easier to see when opening the project) and the plane below the water is not visible. With 4.0, the water is completely invisible when it is above the plane.
 2. The color: the final water color is not the same between the two versions and I think that with 3.4 the color is closer to what it should be (if you compare it to the material color param).

Here is the shader code (4.0 version but only the color hint is different):
```hlsl
shader_type spatial;

uniform vec4 out_color : source_color = vec4(0.0, 0.2, 1.0, 1.0);
uniform float amount : hint_range(0.2, 1.5) = 0.8;
uniform float beer_factor = 0.2;

float generateOffset(float x, float z, float val1, float val2, float time) {
	float speed = 1.0;
	
	float radiansX = ((mod(x + z * x * val1, amount) / amount) + (time * speed) * mod(x * 0.8 + z, 1.5)) * 2.0 * 3.14;
	float radiansZ = ((mod(val2 * (z * x + x * z), amount) / amount) + (time * speed) * 2.0 * mod(x, 2.0)) * 2.0 * 3.14;
	
	return amount * 0.5 * (sin(radiansZ) + cos(radiansX));
}

vec3 applyDistortion(vec3 vertex, float time) {
	float xd = generateOffset(vertex.x, vertex.z, 0.2, 0.1, time);
	float yd = generateOffset(vertex.x, vertex.z, 0.1, 0.3, time);
	float zd = generateOffset(vertex.x, vertex.z, 0.15, 0.2, time);
	return vertex + vec3(xd, yd, zd);
}

void vertex() {
	VERTEX = applyDistortion(VERTEX, TIME * 0.1);
}

void fragment() {
	NORMAL = normalize(cross(dFdx(VERTEX), dFdy(VERTEX)));
	METALLIC = 0.6;
	SPECULAR = 0.5;
	ROUGHNESS = 0.2;
	ALBEDO = out_color.rgb;
		
	float depth = texture(DEPTH_TEXTURE, SCREEN_UV).r;
	depth = depth * 2.0 - 1.0;
	depth = PROJECTION_MATRIX[3][2] / (depth + PROJECTION_MATRIX[2][2]);
	depth = depth + VERTEX.z;
	
	depth = exp(-depth * beer_factor);
	ALPHA = clamp(1.0 - depth, 0.0, 1.0);
}
```

### Steps to reproduce

See attached projects for reproduction

### Minimal reproduction project

[LowPolyWaterShader_3_4.zip](https://github.com/godotengine/godot/files/9153718/LowPolyWaterShader_3_4.zip)

[LowPolyWaterShader_4_0.zip](https://github.com/godotengine/godot/files/9153720/LowPolyWaterShader_4_0.zip)