I recently watched a video talking about how to set up a simple water shader but it seems part of the code no longer exists as a function in Godot script? Saw a comment mentioning that shader_type is no longer a pre-defined term? The code according to the tutorial should look like this according to the tutorial:
1 shader_type canvas_item;
2
3 uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
4 uniform sampler2D noise : repeat_enable;
5 uniform vec2 scroll = vec2(0.05, 0.05);
6 uniform float distortion_strength : hint_range(-1,1) = 0.2;
7
8 void fragment() {
9 vec4 noise_col = texture(noise, UV + scroll * TIME);
10 vec4 screen_col = texture(SCREEN_TEXTURE, UV, SCREEN_UV);
11 SCREEN_UV + distortion_strength * noise_col.rr);
12 COLOR = screen_col;
13
14 }
15

line 3 was a recommendation in the comments to add to make this work but even with everything set up verbatim still no movement in the shader when i move around the scene... honestly in over my head and down to scrap it and learn from another tutorial but a lot of this is applicable for other shaders so I'm trying to understand the why behind the code.

Side note: I have a TileMapLayer set up appropriately in a 2D scene for context.

Help?.. lol
danyeweast

    this is chatgpt's solution but still doesn't work lol:
    shader {
    uniform sampler2D SCREEN_TEXTURE : hint_screen_texture;
    uniform sampler2D noise : repeat_enable;
    uniform vec2 scroll = vec2(0.05, 0.05);
    uniform float distortion_strength : hint_range(-1.0, 1.0) = 0.2;

    void fragment() {
        vec4 noise_col = texture(noise, UV + scroll * TIME);
        
        vec2 distorted_uv = UV + distortion_strength * noise_col.rr;
        
        vec4 screen_col = texture(SCREEN_TEXTURE, distorted_uv);
        
        COLOR = screen_col;
    }

    }

      If you and the tutorial are using different versions of Godot, the features may be different.

      The Godot documentation is here:
      https://docs.godotengine.org

      The dropdown menu at the bottom selects the Godot version.

      ChatGPT is often helpful, but it definitely doesn't keep up with the many changes in Godot features from version to version.