Hey there, I’ve been trying to figure out this problem for a while now, but have finally decided to see if anyone knows why this is happening.
So to give a bit of background, I’m working on a script which dynamically creates a texture map from a series of images, which appears to work well, but when the textures are rendered on the screen, it is possible to see the padding from the atlas in the meshes being drawn (example below)
I believe the issue is with the generation of the texture, but i cant say I’m 100% sure.
I can also verify that increasing the padding increases the width of the ‘grey lines’ in the mesh as well.
/// <summary>
/// Builds a texture map based on the specific type of data passed in.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static Texture BuildTextureMap(List<PointTemplate> data)
{
Texture2D[] textures = LoadImages(data);
SubTextures = textures;
Texture2D atlas = new Texture2D(1,1);
atlas.PackTextures(textures, 1);
if (debug)
{
byte[] pngdata = atlas.EncodeToPNG();
File.WriteAllBytes("./output.png", pngdata);
}
Texture = atlas;
return atlas;
}
The atlas generated from this looks like:
This texture is being applied to a mesh with the following code…
private void Start()
{
renderer =GetComponent < Renderer >();
renderer.material.mainTexture = TextureConnector.Texture;
_filter = GetComponent<MeshFilter>() ;
_meshCollider = GetComponent<MeshCollider>();
}
Is there anything else i would need to do to this texure?