Godot Version
4.2.2
Question
I have a functional water shader that uses different noise textures to make the water texture move according to the noise maps. The issue is that this only modifies the given water texture, and I want it to distort everything behind the mesh as well. I already know how to achieve the effect individually, that is, without a mesh texture already applied:
The problem is that I don’t know how to achieve this distortion with the water texture applied. I tried different approaches, but I could only distort the water texture, and not the actual screen_texture
Here’s part of the shader code for the water:
void fragment() {
//Set time variables to match the wave direction
vec2 time = (TIME *wave_direction) * time_scale;
vec2 time2 = (TIME *wave_direction2) * time_scale;
//Blend
vec3 blend_normals = mix(texture(normal_map, UV + time).rgb, texture(normal_map2, UV + time2).rgb, 0.5);
//Albedo vec3 conversion
vec3 albedo_text = texture(albedo, (UV+time) * vec2(3.0, 3.0)).rgb; //Last vec2 scales the texture
ALBEDO = albedo_text*vec3(1.27, 1.1, 0.73); //Multiplied by a vec3, which basically changes the color (BLUE)