I have a simple shape created with Inkscape. The shape is then exported to PNG format in 64x64 resolution. When I open the image in Photoshop, it looks the same (black background added as a PS layer below to show that the shape does not contain artifacts). Take a look at what the shape looks like in Inkscape and in PS.
But when I draw this texture inside Unity, I get this runtime artifact:
The texture rendered has some kind of a frame border along the bottom side of the texture. The texture file itself does not contain such line. This image is zoomed to 300% to make the line more visible.
The code used to render this:
float linkSize = 40; Rect position = new Rect(200, 25, linkSize, linkSize); GUI.DrawTexture(position, linkTexture);
linkTexture is set as a public field from Inspector.
I have used
200, 25 coordinates here even though the position is actually calculated at runtime to center it in its parent, but it is simplified here for brevity. The other thing I noticed is that if I vary the linkSize, the artifact line is visible from only
45 pixels. At image scale of
46x46, the line is gone. However, again after some
70 pixels of size, the line is visible again.
I am aware that scaling can mess up pixels because of aliasing, but why does this happen in a transparent area?
Is there any solution to this problem?