Tiling the albedo texture in a shader

Godot Version

4.2.1

Question

So I have this shader in which I want to use an albedo texture which is defined by a uniform sampler 2D. The thing is that the mesh the shader is put on is pretty big, and I would like to tile the texture. I tried setting the sampler2D to repeat_enable but that didn’t do anything. What can I do? Here’s part of my code:

uniform sampler2D albedo : repeat_enable; //Variable that controls color
	//Albedo vec3 conversion 
	vec3 albedo_text = texture(albedo, UV).rgb;
	ALBEDO = albedo_text*vec3(0.5, 0.8, 0.45);  //vec 3 only gives another color to it

No shader-brain here, but iirc you multiply the UV coords to scale/repeat textures.

Here’s a link to Godot Shaders with a snippet which might help

Yeah that worked, how the heck didn’t I think of that before lmao
Here’s the code I implemented:

	vec3 albedo_text = texture(albedo, (UV+time) * vec2(2.0, 2.0)).rgb; //Last vec2 scales the texture
	ALBEDO = albedo_text*vec3(1.27, 1.1, 0.73); 
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.