Author Topic: Odd sprites rendering  (Read 3670 times)

Clicker

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Odd sprites rendering
« on: January 21, 2014, 09:39:25 AM »
Currently, I am using NGUI 3.0.9 f3. But this issue has been following me since NGUI 3.0.0. Sometimes, I have got interesting rendering results in gui panels. Like this http://joxi.ru/tmzeUhjKTJCsBSzxh1E. As you can see on the picture, all the widget's colliders and rects stay in proper places, but the rendered content is wrong. I have no idea about why it happens. I have tried to refresh panels, but it actually didn't help. Moreover, I have noticed that this issue somehow depends on twinning actions with panels. For instance, on the picture above, it happens only in a case of changing scale of the topmost widget or gameobject (zooming in or out porpose). I guess, somehow it doesn't refresh(re-render) all the widgets in panel or subwidgets to a widget that has been changed somehow in real time. So, have you got any idea how to fix it?

P.S. If I switch the game view to the scene view in editor, everything becomes fine. Although, this problem has been found in Editor, Standalone and Android platforms, so, I guess, the using platform isn't an issue.

P.P.S. Here is the normal render of that panel http://joxi.ru/SIfeUhjKTJBFBSS5PlQ

P.P.P.S.  I have found another interesting thing. When I change sprite's scale after disabling it - the issue appears. Whereas, if I change its scale before disabling it - everything is fine.
« Last Edit: January 21, 2014, 10:45:05 AM by Clicker »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Odd sprites rendering
« Reply #1 on: January 22, 2014, 05:21:05 AM »
If UIPanel has the 'static' flag checked under Advanced Options, then the transform scale changes will not be tracked, and resizing of your widgets won't be tracked as a result of it.

Likewise if you scale from zero, then the result will be undefined as zero is invalid. You can't divide by it, so inverse transform can't be calculated.

Clicker

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Re: Odd sprites rendering
« Reply #2 on: January 22, 2014, 06:12:47 AM »
Thanks for the answer. I have been scaling that panel from 0.25 to 1 (for each axis), and of course I haven't checked static flag on the panel. So, the issue is still here, and, I guess, every one can repeat it, just doing the same. Another thing, I have also encountered on, if I have a complex panel (such a template) which I have to transform during the run-time, for instance, a tutorial dialog panel which keeps changing during the game, depending on a content that I want to show for a player. There is still a problem about strange gui rendering effects. Sometimes, something blinking on the screen, some parts of a panel (like this part of a window header http://joxi.ru/j6XfUv3JTJAAEbFlYJA) which is not at that moment on the screen (tweening from right side of the screen to the center). In my opinion, some of the roots of the issue lies in changing something during the disabled state of a panel, and then, after enabling it we have the issue with rendering. For now, I have no idea how completely avoid all of it, and it keeps annoying. :(

P.S. Likewise, I have noticed that if I am scaling panel's objects and current fps is too low (10-15 frames), the bug with sprite's rendering appears almost all the time. I think, sometimes, tracking of widgets scales isn't working at all. Is there any clues about how to scale widgets in panels without such a terrible issue? Maybe something like NGUITools.ScaleWidget(aWidget)?
« Last Edit: January 22, 2014, 10:46:09 AM by Clicker »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Odd sprites rendering
« Reply #3 on: January 23, 2014, 07:10:38 AM »
No, there is nothing special. Adjusting the transform is quite enough. NGUI keeps track of transform changes when the 'static' flag is off (UIWidget.UpdateTransform function). In Unity 4.1+ this means relying on the transform.hasChanged flag. If you get a solid repro case going, I could take a look at it. Just please don't upload it here. Put it up on dropbox and email me the link (support at tasharen.com).