Textures weird transparency problem -- black lines on edges --

Hey,
So, I’m having trouble with using transparent textures. When I import textures, non continous black lines appears on edges like in the image below :

This is problematic image:
weirdimageYou can see black lines shown with red circles

And this is correct image
correctimageAs you can see there is no problem in correct image. So it looks like image is not “Premultiplied” ( like the option in After Effects ). I did few searches and tried to use SuperPng in photoshop and didn’t worked!! ( but actually I’m not making images on Photoshop I’m doing it with Illustrator. ).
How can I solve this problem ?? (Also the resolution seems like not similar in unity as it is in png. I don’t know why)

I’ve had this problem before, and I don’t know if this will help but…

1: Does your image have an alpha channel, or just pure transparency? Creating an alpha channel and exporting it as something like a TIFF file can help make it look a little better.

2: Does this texture tile? If not, you could set it to “Clamp” instead of “Repeat” in the inspector.

Hope I could help.

-myjean17

This is caused by the transparent pixels being black. When imported into a game engine, the camera must transform the pixels from the texture into screen pixels, it does this by averaging the color of neighboring pixels and displaying them based on distance (mip mapping and filtering).

When the transparent pixels on the border are a different color than the edge, their color gets blended with the edge color before the pixels are rasterized to the screen. So, this causes an outline. You can fix it by checking “save color from transparent pixels” during export, and making sure that your background color for those pixels matches the edge color of the sprite. Then, it will work on all exported resolutions with no edge artifacts.