Author Topic: 0.25px offset in geometry from Handles/gizmos  (Read 4145 times)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
0.25px offset in geometry from Handles/gizmos
« on: May 30, 2016, 09:15:10 AM »
I've stumbled on a weird issue, where the geometry from NGUI is offset by exactly 0.25px up and left. The gizmos and handles are all correct, but the actual geometry is wrong.

I'm seeing it both in the editor and on devices, since we keep certain things at half res, it seems to get rounded up or something and we get a 1 px see through line on the UI even on fullscreen backgrounds.

http://imgur.com/iz8YBUn that shows how it looks.

Now I'm not sure what's going on, but it sure is annoying. Under normal circumstances it would not be seen, but since we're doubling UI size on retina displays it becomes very visible. Any suggestions as to what to do? I would rather not just offset the specific by 1,1 px, as it potentially ruins all anchoring and is just wrong. :)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: 0.25px offset in geometry from Handles/gizmos
« Reply #1 on: May 30, 2016, 09:17:55 AM »
Forgot to add, I'm using NGUI 3.9.4 and Unity 5.3.4p6.

If it hasn't been fixed between 3.9.4 and 3.9.8 (newest right now), I'd rather not upgrade, as we have various customizations that will take some time to "port" upwards.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: 0.25px offset in geometry from Handles/gizmos
« Reply #2 on: May 31, 2016, 06:17:36 AM »
On further investigation this seems to spring off from the dreaded half-pixel offset. :S

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: 0.25px offset in geometry from Handles/gizmos
« Reply #3 on: May 31, 2016, 09:41:26 AM »
Found it..

It was the drawCallOffset in UIPanel which messed with everything



Commenting that out, makes everything align properly again in both editor and on device.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 0.25px offset in geometry from Handles/gizmos
« Reply #4 on: June 01, 2016, 10:06:51 PM »
The half pixel offset is a DX9 thing that I've explained many times in the past. Not sure what other device you're getting it on -- it shouldn't affect mobiles.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: 0.25px offset in geometry from Handles/gizmos
« Reply #5 on: June 02, 2016, 02:07:43 AM »
No it's strange, but for whatever reason it's happening on mobiles for me too, both android and ios. Disabling the drawcall offset makes it work as you would expect.

Wisteso

  • Full Member
  • ***
  • Thank You
  • -Given: 21
  • -Receive: 3
  • Posts: 103
    • View Profile
Re: 0.25px offset in geometry from Handles/gizmos
« Reply #6 on: July 06, 2016, 06:07:17 PM »
So is this a fix that's going to be used officially?

We're doing a similar doubling technique for retina devices, and I've definitely seen some weirdness similar to this before.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 0.25px offset in geometry from Handles/gizmos
« Reply #7 on: July 11, 2016, 01:12:03 AM »
No, because as I said, the half pixel offset is only used on DX9 hardware. Check UIPanel's Awake() function where it's set. If you are getting something unexpected, I would need a concrete repro case to look at.