Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: apocriva on January 30, 2014, 11:17:28 PM

Title: Slight UV Nudging
Post by: apocriva on January 30, 2014, 11:17:28 PM
In some situations when scaling up a UI (to make "fat pixels"), I've found that the triangles rendered by NGUI are resulting in ever-so-slightly-off textures. This manifests as funny-looking jaggies along the edge of what should be straight lines.
(http://apocriva.com/images/funnyEdges.png)

This is remedied by putting in a very small nudge when calculating texture UVs.
(http://apocriva.com/images/funnyEdgesGone.png)

I've posted the small changes I made within NGUIText.cs and NGUIMath.cs for this. Thought it might be useful for others. :)
http://pastebin.com/C7cBW2d1
Title: Re: Slight UV Nudging
Post by: ArenMook on January 31, 2014, 11:58:24 AM
That's a strange hack, I must admit.
Title: Re: Slight UV Nudging
Post by: apocriva on January 31, 2014, 05:46:50 PM
Little tiny precision errors make things round off incorrectly sometimes... bit this I've found to be unpredictable -- if I scale things up one way it works, another way it doesn't! iunno. :)

Oh wait now, it has become clearer once I started having something at the edge of the screen. There is a half-pixel offset being applied to the widget meshes that I wasn't expecting. Anyway, these are self-inflicted issues due to the fact that I'm forcing NGUI into pseudo-pixel-perfection and not really letting it be pixel perfect. :)
Title: Re: Slight UV Nudging
Post by: rain on February 03, 2014, 08:48:25 AM
This fix messes up the new anchoring system for me.
Title: Re: Slight UV Nudging
Post by: raomuqi on February 08, 2014, 04:07:09 AM
I have similar problem :
a strange line appear when i scale down a sprite equiped with a triangle image
(http://www.thebestsync.com/report/20140208.jpg)