Author Topic: Confusing clippping, doesn't match the size specified  (Read 9308 times)

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Confusing clippping, doesn't match the size specified
« on: February 11, 2013, 12:35:31 AM »
As can be seen in this GIF the size of the clipping is not I expect it to be (full screen width equals to Size.x = 0).



The same happens if i use a alpha or soft clipping, there seems to be some magic margin that always gets added. Obviously if I remove the clipping the whole scrolling within a frame is broken. Just to be clear: What I want is that the clipping rectangle works with a width of the full screen width, right now I am not able to do that.

  • So my question is how to I fix this, is there some obvious setting I haven't found yet that lets me remove that padding in the rectangular mask area?
  • Also upon testing on some of the Android devices (Samsung Galaxy S3) the shader renders black wheras on a Nexus 7 tablet it does fine.

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #1 on: February 11, 2013, 08:06:58 PM »
Upon further investigation it turns out that the mask appears fine on a Android Nexus 7, not on a Galaxy S3 and not like seen the animated GIF on my desktop. Any insight what could cause this or why it is the way it is would be helpful.

redhawk

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 34
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #2 on: February 11, 2013, 09:13:12 PM »
I thought I recall another post response about not setting your Size to 0.  I.e maybe stop at Size 0.01.  Otherwise, I'm sure someone with more knowledge will answer.

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #3 on: February 11, 2013, 10:44:40 PM »
@Redhawk: Thanks for responding but the docs say that if you set it to 0 it auto scales it to the width or height. And you can tell by the magenta wireframe outline, that it detects the correct width.

So even when I manually set a width in NGUI pixel units, I still get this odd masked almost fixed with left and right



I marked in red the area I am talking about. Again maybe I am missing something obvious but it almost feels like there is some hard coded margin within that masking shader or so.

dlewis

  • Guest
Re: Confusing clippping, doesn't match the size specified
« Reply #4 on: February 11, 2013, 10:53:56 PM »
One of the later versions of NGUI (not the latest) had an issue where it would draw the clipping rect incorrectly. Try updating if you're not on the latest version?

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #5 on: February 11, 2013, 11:08:35 PM »
We purchased it a few weeks ago, I am sure that it is fairly up to date. But I can try updating it later to see if it does anything.

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #6 on: February 12, 2013, 07:35:02 PM »
Bump, I still haven't resolved this, any insights would be nice.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #7 on: February 13, 2013, 01:52:48 PM »
Select the UIRoot and hit Alt+Shift+P to make it pixel-perfect. I am guessing one of your game objects is scaled weirdly.

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #8 on: February 14, 2013, 08:10:10 PM »
That fixed it 90%, still I see some black or opaque borders, I guess it will do for now  :-\

Also related:
I can't seem to fix the scroll behavior. I replicated pretty much what the example scene had but the bounds go around the center of the screen instead of the left and right clipping edges, see gif



As you can see the clipping gizmo display is correct (Magenta), and Orange I presume is the content bounds, yet it does not behave correctly. And yes I already made everything pixel perfect, all other transform nodes have a scale of 1,1,1. Also the scrollbar's size (horizontalScrollBar.barSize) gets set to 0 or it's tiniest size every time. Looking at the Ngui code I assume it is related to mPanel.clipRange; but I can't figure out what or why.

The settings of that panel scroll panel

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #9 on: February 14, 2013, 09:22:54 PM »
Why do Start and Back buttons have an orange outline?

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #10 on: February 14, 2013, 10:21:35 PM »
That's my own Gizmo code, additional UI transition stuff. Same with the Green and red outline those are custom Gizmo scripts.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #11 on: February 15, 2013, 02:44:43 PM »
Well, no idea then. Check your setup and compare it to the clipped panel example that comes with NGUI as I know it works correctly.

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #12 on: February 26, 2013, 12:36:35 AM »
so here is what I did, I went to the example scenes and changed the size of the clipping mask to 0 (as per doc which makes it 100% the width of the screen) and I get the same bugs (just removed some sprites and labels)



Notice that just like my scene it also shrinks the scroll bar at the bottom likewise. The only thing that I haven't figured out yet that this scene seems to have no issues with is the masking.

So it looks like it is broken :*(

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Confusing clippping, doesn't match the size specified
« Reply #13 on: February 26, 2013, 12:48:27 AM »
Actually that's what was wrong the whole time, NGui's UiDraggablePanel is not written with the UIPanel's clipping size of size.x = 0f in mind. So what I ended up doing now is calculating the target unit screen width and apply it via code to the UIpanel instead of relying on the 0f auto width feature.
This also fixes the scrollbar resizing to it's tiniest size.