Godot Version
4.2.1
Question
I have a mesh with a Texture2D applied to it (picture). The goal was to make the texture scroll through the mesh. However, when I apply the shader, the scrolling works but the texture is distorted (video).
I’m still learning how to use shaders so I believe I might be doing something wrong. Any help would be appreciated. Under Material
, I selected Next Pass
and created the shader:
shader_type spatial;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, repeat_enable;
void fragment() {
vec2 uv = UV;
float speed = 0.5; // Scrolling speed
uv += vec2(TIME * speed, -TIME * speed);
vec4 color = texture(SCREEN_TEXTURE, uv);
ALBEDO = color.rgb;
}
The code I used to batch import the .gltf meshes is below (the same distortion happens to all the meshes I imported this way, so maybe this is an issue with the import settings?)