Hello Guest

Author Topic: Black edges around sprite appearing only on Nexus 4  (Read 4954 times)

melong

  • Newbie
  • *
  • Posts: 2
    • View Profile
Black edges around sprite appearing only on Nexus 4
« on: May 17, 2013, 05:59:00 pm »
Hi Guyz

I have some pretty much strange outline appearing on my sprites. At first i thought it was a classical wrong alpha/filtering problem but it only occurs on the google nexus 4, every other devices i checked don't have this problem.
Just to be sure i double checked my textures and made sure there is no black in the fully transparent areas.
Moreover i noticed this problem only appears with sprites using tk2d sprite sheets, i have other sprite sheet made with another 2d sprite plugin which don't have this problem.
Then i assume tk2d may be involved somehow in that strange behavior but can't happen to figure why.

Thanks for your help!


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Black edges around sprite appearing only on Nexus 4
« Reply #1 on: May 17, 2013, 06:45:11 pm »
Interesting. tk2d doesn't do anything funky while processing the textures, but there are a few different things that could potentially be the cause.

1. First thing to do is to take the atlas texture, and draw it on the device using GUITexture or the like. Do you see any black outlines there?
2. What filtering is on the texture? Does it have mipmaps? What is the format of the texture?
3. Is the black outline an outline of the sprite or the actual alpha'ed bits?

If you can post a screenshot (framebuffer grab would be best, but a photo could be sufficient I guess, that would greatly help).

melong

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Black edges around sprite appearing only on Nexus 4
« Reply #2 on: May 20, 2013, 11:09:23 am »
Hi,

I tried to use the atlas texture with GUITexture as you suggested and did not have the edges.
We made a bit more tests on different devices and we found that every devices (all nexus 4) that had this problem had a modified version of android in some way, on another device with an original non modified version of android, the problem did not appear. We could only test on one device with an original version of android then i can't confirm but this may be kind of related.

Concerning the texture settings, mip maps has been desabled for every one and filtering is set to bilinear. The compression is set to automatic compressed which becomes 16bits texture in unity android.

Here is a photo of the problem.  I tried to get a screenshot directly on device but interestingly, the grabbed image did not have the problem...

Thanks for your help.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Black edges around sprite appearing only on Nexus 4
« Reply #3 on: May 20, 2013, 01:02:18 pm »
It looks very much like errors you'd see with incorrect edge filtering. Can you try this with premultiplied alpha?
1. Tick "premultiplied alpha" in sprite collection settings, commit.
2. Select material & switch to tk2d/PremulVertexColor.
Do you still get the same error?

The problem would have been there with GUITexture unless it was scaled and offset in the same way.
Its going to be really hard to track this down due to it happening only on modified roms, but the above might fix it.