- Home /
UV mapping problems with multiple textures in same file
We use Blender for modelling our objects and export them as .FBX files.
We have 16x 2D-tiles in a 1024x1024 texture as 4x4 tiles, but when we import the flat ground objects seperately and instance them, the border of the ground shows an imprecision near the edge of them, like if the pixel of the next tile has been used to make an edge or smooth the color.
The ground element is a simple square and the bitmaps are 100% precise in Photoshop. 256x256 pixels.
Somehow the pixel color of the next tile gets into the ground of the tile? Its like the UV maps are unprecise when mapping.
Has anyone else seen this problem and better, does anyone have a solution?
The reason for keeping the tiles in same texture should be the way that shaders work with textures as it has to switch them in and out when rendering all the small tiles. Combining them should give performance benefits + its easier to keep all the tiles in same colors because a filter can be added in a seperate layer in Photoshop.
Yes, we know we could auto-export them in small tiles, but this example is only part of our problem as we have many normal 3D objects that suffers same problem when trying to combine the textures and reusing parts among different objects.
Answer by Waz · Sep 04, 2011 at 11:42 AM
You're basic approach is correct - a single material and UV texture cutting is likely better than small textures and many materials.
But finding a way to get precise texel alignment across DirectX, OpenGL desktop and ES, and for diverse tools like Blender and Unity to conspire to help rather than hinder is not something I would hope for. Someone else may know better, but the usual approach is to have a border of at least one pixel (more if you enable mipmaps) around UV islands - in this case your tiles. Alternatively, pull your UVs in half a pixel.
pull UV's in half a pixel... intersting... might work, as we have a lot of seamless textures and these suffers visually from that extra pixel.
@Warwick I understand that adding a border around each tile will offer better results, and thicker borders allow for higher mipmaps. I have implemented the 1/2 pixel solution that you mention and this works rather well. I notice that when zoomed in there is 1/2 a pixel missing.
Why does this work? I thought that texel/pixel alignment was consistent between OpenGL and the later DirectX versions. Do you know if this 1/2 pixel approach works with ES?
Cheers