Author Topic: UIScrollView is not pixel perfect!  (Read 6213 times)

BrightBit

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 21
    • View Profile
UIScrollView is not pixel perfect!
« on: November 04, 2014, 07:16:39 AM »
I've changed NGUI's Example Scene "ScrollView(Panel)" to use a Sliced Sprite for the items instead of the simple ones. The Filter Mode of the corresponding atlas texture is set to Point. The following animation illustrates that those items won't be rendered pixel perfect:



Please note that I have a real problem with this issue in another application. I only took the Example Scene to explain my problem for easier reproduction. The versions of my software: Unity 4.5.1f3 and NGUI v3.7.5

Does anyone know how to fix this problem?


Greetings
BrightBit

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIScrollView is not pixel perfect!
« Reply #1 on: November 04, 2014, 10:30:07 AM »
Looks to me like your game window is too small to draw the UI at 100%, so the UI is simply shrunk down. You might want to check that...

BrightBit

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 21
    • View Profile
Re: UIScrollView is not pixel perfect!
« Reply #2 on: November 05, 2014, 08:24:10 AM »
I did some more tests and finally realised that if I am building a standalone version of my project the issues are gone BUT it doesn't seem to be related to the size of screen. The following two images illustrate what I mean:

Unity Editor Game Preview [Resolution 1063x598]:



Fullscreen Standalone [Resolution 640x480]:



Since it might be difficult to see the difference:



BTW: Why should the UI be shrunk down? Even if an item doesn't fit onto the screen I want it to be rendered correctly, i.e. pixel perfect! Apart from that: Every other element in my GUI is okay, just the items in the ScrollView are wrong!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIScrollView is not pixel perfect!
« Reply #3 on: November 06, 2014, 01:41:25 AM »
Here's your problem: 1063x598

Dimensions must be dividable by two.

BrightBit

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 21
    • View Profile
Re: UIScrollView is not pixel perfect!
« Reply #4 on: November 06, 2014, 02:45:56 AM »
Thank you! :) It's still weird that this resolution (1063) doesn't affect the other widgets but it really seems to be the problem and I can adjust the size of Unity's preview window so I will get a correct preview and don't have to build a standalone version each time I need to check my layout. So it's fixed for me!

Thank you.

Greetings
BrightBit

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UIScrollView is not pixel perfect!
« Reply #5 on: November 09, 2014, 03:29:55 PM »
It will only affect widgets that are centered, not those aligned to left or right, since math. :)