I’m trying to save draw calls and I was thinking it would be nice if you were able to tile within one big texture atlas that contained all of your tiles.
I imagine this would be possible through a shader but I’m wondering if there would be any point to it as I can’t think of a way to do it without multiple materials (meaning multiple draw calls).
Just wondering if anyone has any cool ideas on how you could achieve this.
Do you mean just use a part of that texture on 4 separate models? You can do that by modifying the UVs within your 3d models. If you mean how can you tile that entire texture instead of using unity’s tiling feature, you can modify the UV of the UV of the 3d model so it extends outside the 1x1 UV space or you can shrink the size of that texture in photoshop and tile it yourself.
I reckon I’d be going for the shader approach because I was going to end up with way more than four textures on the atlas.
I still can’t think of a way to get it to work as the materials will have to have different offsets within them thus making them unique and negating the draw call benefit.
Thanks for the modulo tip though, sounds handy!
Pete.
nicloay, this is useful when you want to tile a texture multiple times over one quad. if you wanted four of each (but same) fish on every side of the box, that wouldn’t work with just an atlas and uvmapping.
this is possible, and as DanTreble mentioned, requires using modulus. the problem with this approach is that mipmaps don’t play nice with fmod(). You get block artifacts at the “seams” because the screenspace block derivatives get messed up, and tex2D decides to pick a lower miplevel when you do this. The result is something like this;