I’m creating meshes with a script which are acting as chunks of a terrain and i’m assigning a texture atlas to them but there’s a white outline around some of the meshes. Through some research i find out that it could be antialiasing or mipmap’s but i couldn’t find a fix this it. So how can i solve this problem?
Edit: I think it could be a bleeding atlas because some chunks also have green and grey around the edges which would be the grass and stone. I still don’t know how to fix it though.
Sounds like mipmap bleeding in the atlas. Very common and there are many topics about this. Search for atlas lines or atlas edges. For example this topic:
That looks like good old Bilinear sampling. You need some padding in your atlas between tiles and inset your UVs.
For example, if you have an atlas of four textures in a 2x2 layout (pretty much your most basic atlas) and just use that as a texture across an entire quad there’s not a hard break between the different parts of the atlas, it is just one texture after all. If you divide up that quad into 4 quads, one for each of the textures in the atlas the parts of the texture that “blend” between one tile and the next don’t go away, which leads to strange color artifacts on the edges. The most basic solution is to inset in the UVs for each tile slightly (half a texel), but that leads to the mipmap problem originally suggested. The half texel inset isn’t a half texel anymore on the smaller mips, and you end up with the same problem as before. You actually want to add 4 or more pixels of “gutter” around each tile, so 8+ pixels of essentially unused texture there just to stop the Bilinear sampling from showing the blend of one tile and the next. The other simple option some people go with is use point sampling and disable mip maps.
There are a ton of threads on this on the forum.
The modern solution is to not use atlases at all, and use texture arrays instead.