Author Topic: Bug in MakePixelPerfect when using HD atlas?  (Read 1806 times)

1dayitwillmake

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Bug in MakePixelPerfect when using HD atlas?
« on: March 06, 2014, 05:08:34 PM »
I'm noticing an issue with using a reference atlas to switch to an HD atlas at runtime.
Make pixel perfect will add 1 to the Width / Height if it is not an even number.

However when using an HD atlas with the pixelSize set to 0.5, that creates visual artifacts.

For example an HD texture that is 74 pixels across, becomes 37 pixels, and NGUI is rounding it to 38 pixels modifying the image enough to make it appear sheered.

Perhaps the MakePixelPerfect function in UISprite should take the atlas pixelSize into account before adding 1?
Or is there a special way of making the atlas / textures etc.

With adding +1 pixel to HD texture atlas


Without:

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug in MakePixelPerfect when using HD atlas?
« Reply #1 on: March 07, 2014, 08:46:18 AM »
Reference atlases don't call MakePixelPerfect. Are you calling it yourself? If so, why? A single pixel does get added to the widget to make its dimensions even, but that's something that happens with sprites that have odd dimensions, most commonly associated with making things look correct with centered pivots.

1dayitwillmake

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Bug in MakePixelPerfect when using HD atlas?
« Reply #2 on: March 07, 2014, 10:29:46 AM »
I see, I am not calling it myself per-say but I'm using an addition to NGUI called "RetinaPro" which /does/ explicitly call MakePixelPerfect when it swiches the atlas.

I believe it does this because when for example switching to an iPad atlas, those textures are not necessarily [size*scaleFactor] as the iPhone ones.

I will look into it, but quick question so I understand the system better, when does MakePixelPerfect get called (outside of the editor)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug in MakePixelPerfect when using HD atlas?
« Reply #3 on: March 07, 2014, 10:45:36 AM »
It doesn't. It only gets called if you click the "Snap" button, use ALT+SHIFT+P shortcut, or have a UIButton that has "Pixel Snap" turned on.