Clean texture file imports with grime/crud in alpha channel — why?

I’ve got a 128x128 PNG file of a circle. I’ve blown this up in Graphic Converter, and inspected the alpha channel very carefully; its mask is perfectly clean (that is, the area outside the circle is completely white in the alpha channel). And yet, when I import this into Unity, there are a few pixels of extra junk appearing outside the circle. I can see this both in the Preview panel in the IDE when I select the texture in the project, and also at runtime when I draw it with GUI.DrawTexture.

It sounds like an import settings problem, but I’ve gone over all the settings, and I’m stumped. I tried texture type GUI, and when that didn’t work, went to these:

  • Texture Type: Advanced
  • Generate Cubemap: None
  • Import Type: Default
  • [×] Alpha Is Transparency
  • Sprite Mode: None
  • Generate Mip Maps (i.e. off)
  • Wrap Mode: Clamp
  • Filter Mode: Point

I also tried the other two Filter Modes, but they all look the same.

Any idea why the texture imported into Unity looks different from the PNG file on disk?

Thanks,

  • Joe

I cannot tell without an image, but I have a feeling that it could be a compression issue. As GPU’s don’t read PNG by default, unity changes the compression mode. If it is for a GUI image then my recommendation is to turn compression off.

Yes, that was it. To fix it, I clicked the “Override” checkbox for each of Web, Standalone, iPhone, and Android, and then changed the Format of each of these to ARGB32.

I think what was tripping me up yesterday is that I expected to be able to do this with one of the settings in the main texture import settings above, rather than having to “override” it for each of the platforms below. It still seems weird to me that you can’t. But I’ve searched the Texture 2D docs and it looks like the Override section is the only way to do it.

Anyway, thanks for the push in the right direction!

  • Joe