Author Topic: New anchoring system and half pixel compensation on Windows  (Read 4209 times)

indiefreaks

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
New anchoring system and half pixel compensation on Windows
« on: December 10, 2013, 04:16:44 AM »
Hi,

I migrated to 3.0.7 and thus removed all my "legacy" anchors to the new system which is great by the way.

However, I noticed that some of my previous pixel perfect borders (using sliced sprites without filling the center) are now a bit blurred. I believe (this is only by memory) that this was fixed by ticking the Anchor class "half pixel" checkbox.
Yet this is not available anymore and I therefore wondered if this was automatically detected and corrected by NGUI or if there would be something for me to do to get that working nicely.

If it is automatically managed by NGUI now, I'd suspect a bug in my case which I would be glad to report with some more details if required.

Cheers,

Philippe

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: New anchoring system and half pixel compensation on Windows
« Reply #1 on: December 10, 2013, 10:10:22 PM »
Half pixel offset isn't needed anymore as panels offset the draw calls instead. It's all automatic and done under the hood for you.

Make sure your game window is of even dimensions. If the dimensions are not even, such as 1025x768 instead of 1024x768, then you won't get crisp results.

Also note that the new system does end up placing things at non-whole pixels if the calculated dimensions end up with odd numbers as well, but it should still be crisp visually. Keeping things not using the center pivot also helps.

indiefreaks

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Re: New anchoring system and half pixel compensation on Windows
« Reply #2 on: December 11, 2013, 04:02:53 AM »
Thanks Aren. It makes total sense.

The "not" centered pivot just made the trick.

indiefreaks

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Re: New anchoring system and half pixel compensation on Windows
« Reply #3 on: December 12, 2013, 05:51:33 PM »
Hi again,

I noticed I was still getting the half pixel issue even if I'm running on a DirectX 11 video card.
I saw in the UIDrawCall class that you make a check on the SystemInfo.graphicsShaderLevel < 40 and if so, removes the half pixel fix on panels.

When I comment out this line in my own NGUI installation, I get back crisp results.
Is it a bug specific to my machine or else?

Here is my current setup:
Intel I7-3615QM
4 Gb RAM
nVidia GeForce GT 650M (DirectX 11)
Windows 8.1 64bits

Thanks,
Best regards,

Philippe

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: New anchoring system and half pixel compensation on Windows
« Reply #4 on: December 13, 2013, 05:28:18 AM »
Did you actually enable DX11 rendering? Simply having a DX11 card doesn't mean Unity is using it. By default it doesn't.

I have the same setup (macbook pro with bootcamp, but Win7 instead of Win8). Can you check your hierarchy to ensure that there are no other offsets already present, and that your game window's dimensions are even? (ie: 1280x720 instead of 1281x720).

indiefreaks

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Re: New anchoring system and half pixel compensation on Windows
« Reply #5 on: December 13, 2013, 05:45:38 AM »
Thanks Aren,

I had the Dx11 renderer set on Unity3D.

However, while I was pretty sure my game window dimensions were even, I double checked it and they weren't so this ain't a bug but a misusage on my side.

Thanks for the support.