Author Topic: White line appears for UISprite  (Read 4863 times)

fanling3

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 29
    • View Profile
White line appears for UISprite
« on: August 07, 2014, 02:39:19 AM »
There are some strange thin white lines (about 1 pixel) on one side of UISprites on some devices.

For example I have a 100 x 100 UISprite, the orginal imported png is also 1:1 aspect ratio. Some devices like ipad 4 and iphone 4 has no problem on display. But on ipad 2 and iphone 5, there is 1 thin white line on the left side of the UISprite.

Most strange thing is some UISprites are fine on ipad 4, iphone 5 and iphone 4 but having white line on ipad 2. End up the screen is perfect for ipad 4 and iphone 4, 1 thin line for iphone 5, 2 thin lines for ipad 2. My Android tablet and Android phone do not have this problem.

Is it related to resolution or something? Or iOS related? How to solve it?
« Last Edit: August 07, 2014, 03:14:15 AM by fanling3 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: White line appears for UISprite
« Reply #1 on: August 07, 2014, 04:07:35 AM »
When you shrink sprites, MipMapping causes pixels to get squished, which results in other nearby pixels being "averaged out" to create your new "big" pixels. That's how texture filtering works.

Either don't shrink your sprites, or add some padding between your sprites. You can do that individually on sprites by selecting them in your atlas and adding a Transparent Border (click the button), or globally on the entire atlas -- as a "Padding" option in the Atlas Maker.

fanling3

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: White line appears for UISprite
« Reply #2 on: August 07, 2014, 04:24:36 AM »
By "shrink" do you mean I use different size (UISprite) from the original png pixel size?

When does the "Padding" option of Atlas take effect? I changed the number and seems nothing happened
« Last Edit: August 07, 2014, 04:46:02 AM by fanling3 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: White line appears for UISprite
« Reply #3 on: August 08, 2014, 07:09:06 AM »
Yup, that's what it means.

Padding takes effect when you actually rebuild the atlas. Try updating some sprite in the atlas by selecting its source texture and clicking the Add button.