Your shader is fine; it's actually the vertex UVs that are the problem:
So for all rectangles the uv coordinates are as following [0, 0] / [0, rect.height] / [rect.width, 0] / [rect.width, rect.height]. So the uvs are going beyond 1
Your shader is designed to support the standard UV space, in which case you should replace rect.width
and rect.height
with 1
.
By using UV coords greater than one, you're effectively asking for texels outside of the specified texture. When used with a texture atlas, that means you're asking for texels outside of the specified tile -- in this case, those happen to be white, and that's what you're seeing in the rendered output.
Tiling with an atlas texture
Updating because I missed an important detail: you want a tiling material.
Usually, UVs interpolate linearly:

For tiling, you essentially want more of a "sawtooth" output:

For a non-atlas texture, you can adjust material scale/wrap settings and call it done. For an atlas texture, it's possible but you'll end up with a shader and/or geometry that aren't quite standard.
The "most standard" solution would be if your larger quads are on a separate mesh from the smaller ones:
- Add a
float
material param named uv_scale
or some such
- Add a
Multiply
node that scales incoming UVs by uv_scale
- Pass output from that into a
Frac
node
- Pass output from that into the
UV Tile
node
Pseudocode is roughly: uv = frac(uv * uv_scale)
If you need all of your quads to be in the same mesh, you end up needing non-standard geometry:
- Change your UVs again (going back to
rect.width
and rect.height
)
- Add a
Frac
node before the UV Tile
node
This is a simpler shader change, but has the downside that your geometry will no longer be cleanly supported in other shaders.