I have a texture atlas with two blocks:
And I want to use this texture for my blocks. I don't want each block to use the entire texture, just a part of it, to make the world look bigger, which is why I would've used something like this for the vertex shader:
v_uv = a_position;
Unfortunately since this isn't a single texture, but an atlas, I had to improvise:
v_uv = vec2(0.5 * a_blocktype + mod(a_position.x, 0.5), -a_position.y * 0.5);
And this kinda works, except that it causes this bleeding:
(notice how there's these spots next to each A. The same problem exists for the other block type).
I then tried adding space between the tiles in the atlas, except now there are just black lines.