Godot Version
4.4
Question
I am having trouble getting my rain texture to repeat for the shader I am developing.
shader_type canvas_item;
uniform sampler2D rain_texture : source_color;
void fragment()
{
vec2 uv = SCREEN_UV * 3.0; // tile for visibility
COLOR = texture(rain_texture, uv);
}
I have loaded a rainy texture into rain_texture, but it rather than repeating across the whole display, things get weird.
You can see the correct rain texture in the top left.
I assumed I would need to enable texture Repeat, but in Godot 4.x, this property is accessed via the texture’s parent. So I enabled it in the ColorRect I was using.
But then I realised that it was the shader, not the rain texture, that was attached to the ColorRect. The rain texture is loaded via the shader parameter rain_texture.
So I have three related questions.
- Is the weird output due to the texture not repeating?
- Am I right in thinking that because the rain texture does not belong to the ColorRect, setting Texture → Repeat = Enabled within ColorRect won’t affect the rain texture?
- How do I get it so that the rain texture is shown across the whole screen, instead of these graphical artifacts?