Put large texture onto array of quads

Godot Version

4.3

Question

Hey all, I am working on a project that I have nearly finished, but I am getting stuck on one last part and not sure how to proceed. I have a world where I am spawning in an array of Quads as the map. trying for 64 quads by 64 quads, so a large array. I can spawn them in just fine so far.

The next part is texturing them. I have a large texture that I made that will fit the area perfectly, but I don’t know how to map that texture onto the quads. I don’t want the entire texture on each quad, I want each quad to be textured with a tiny section of the texture, based on where the quad is in the array.

How would I go about doing this? How do i set which part of a texture gets put onto a quad?

The primitive quad has UVs from 0 to 1, you need UVs from 0 to 1/64. You could make a new material or shader with offset and reduced UV mapping or each quad, but it may be best to make a plane with 64 subdivisions. Why 64 by 64 individual quads?

That might be a way to go about it. Would definitely give me a path to try! I haven’t worked with shaders at all in Godot, so hopefully it isn’t too difficult to work with.

As for the 64, its just the map size I am most familiar with and comfortable with. I’m used to doing everything in sizes like that (4, 8, 16, 32, 64), so 64 just seemed like a place to start.

Yeah, get the world X/Y and feed those into the UV’s, then you will have to do some math to make sure it starts from the place you want, and the the X/Y coordinates are scaled properly as the world coordinates will be a lot large than the 0 to 1 UVs of your texture.

Also if you do still end up needing individual quads, I’d recommend mesh instancing, if all of them have the same mesh and material setup, they should instance quite well, because even 64x64 is 4096 individual objects.