Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: David Foster on November 14, 2013, 01:09:52 PM

Title: Inconsistent Pixel Perfection between Odd-sized SD and Double-res HD Textures
Post by: David Foster on November 14, 2013, 01:09:52 PM
I have noticed that odd-sized sprites have their dimensions evened out when hitting 'Correct' or calling MakePixelPerfect(), so an underlying texture might be 39×39 pixels, but its sprite dimensions become 40×40. I see that this is deliberate, as this does indeed result in the sprite being pixel perfect.

However, these even dimensions do not result in pixel perfect sprites when the reference atlas is replaced with the HD atlas (with 0.5 pixel size). In this instance, an underlying HD texture might be 78×78 (i.e., 39 * 2), and its dimensions are 'corrected' to 40×40, but this is not pixel perfect. In fact, the dimensions which do result in a pixel perfect HD sprite are 39×39 – half of 78×78, as you'd expect.

How can I resolve this issue? It seems my options at present are to either sacrifice pixel perfection in HD or to manually correct dimensions and sacrifice pixel perfection in SD.

I have uploaded a very simple test case project with a README detailing steps to replicate. Please download here: https://www.dropbox.com/s/c1vfwoupcfi2lpq/NGUI%20Pixel%20Perfect%20Playground.zip. It is password protected, so you need not fear for unpaid users getting their hands on NGUI. Michael, I have PMd you the password to extract.

Your assistance on this would be hugely appreciated. I'm on a tight deadline and anything you can do to help might just save my life.
Title: Re: Inconsistent Pixel Perfection between Odd-sized SD and Double-res HD Textures
Post by: ArenMook on November 14, 2013, 01:22:57 PM
Hmm... I will have a look into this, thanks -- but I suggest you keep the sprites with dimensions dividable by two in both cases.
Title: Re: Inconsistent Pixel Perfection between Odd-sized SD and Double-res HD Textures
Post by: David Foster on November 14, 2013, 01:40:12 PM
Thanks Michael. Unfortunately there are a couple of reasons right now why I can't have all dimensions divisible by two:
I am so sorry to be pushy but what are your are immediate thoughts on this? Do you think this could be fixable at the NGUI level?
Title: Re: Inconsistent Pixel Perfection between Odd-sized SD and Double-res HD Textures
Post by: ArenMook on November 14, 2013, 01:58:57 PM
I am in Copenhagen attending Unity's Hack Week this week, so I can't be of much help until next week. Even if I did find the time to squeeze this in and investigate the issue though, I'd first put it into the Professional repository, and wouldn't release an update until the following weekend. Certainly not by tomorrow.
Title: Re: Inconsistent Pixel Perfection between Odd-sized SD and Double-res HD Textures
Post by: David Foster on November 14, 2013, 02:03:11 PM
Okay, thanks. Well I just bought a Professional license ten minutes ago specifically to get access to another bug fix you posted today (atlas reference break on slice adjustment).