Author Topic: Alpha not clipping on child  (Read 4582 times)

ngui

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Alpha not clipping on child
« on: January 18, 2014, 02:29:31 AM »

I have a heirarchy with a UIWidget at the root, a number of children UITextures, UISprites, UIWidgets, and UIScrollView/UIPanel under it.

I'm finding the 'Alpha' slider of the Widget and Panel to operate with some inconsistency. Some times all objects under the root can be faded, other times some elements (particularly the children under the UIScrollView/Panel) remain visible.

Same with the 'Soft Clipping' of the UIScrollView/UIPanel, I'm having trouble getting the children (UIWidgets w/ children UITextures) to clip.

How can I solve this? Is the setup wrong?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Alpha not clipping on child
« Reply #1 on: January 18, 2014, 02:32:13 AM »
Clipping cannot be nested, so if you have extra panels in between of your widget and your scroll view, the clipping won't work.

ngui

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Alpha not clipping on child
« Reply #2 on: January 18, 2014, 03:02:18 AM »

I don't have any UIPanels between my UIScrollView/UIPanel and my UIWidget w/ UITexture. By nesting do you mean any nesting? or only UIPanels? Because I have had clipping in the past with nested elements.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Alpha not clipping on child
« Reply #3 on: January 18, 2014, 09:51:05 PM »
Just panels. Clipping works only if you have shaders enabled (quality can't be set to 'fastest'), and the widget you're trying to clip must be using one of NGUI's shaders -- Unlit/Transparent Colored being the default.

ngui

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Alpha not clipping on child
« Reply #4 on: January 19, 2014, 11:08:25 PM »

I'll double check that I'm using NGUI's shaders (so not just any shader that supports transparencies/alpha will work?) and let you know whether that is the issue.

ngui

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Alpha not clipping on child
« Reply #5 on: January 20, 2014, 01:55:57 PM »

Just double checked the setup, there is no other UIPanel under the UIScrollView/UIPanel and the UISprite is using the sample 'Wooden Atlas' (Unlit/Transparent Colored shader). But soft clipping does not occur.

Any ideas?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Alpha not clipping on child
« Reply #6 on: January 21, 2014, 01:35:42 AM »
Did you move the shaders from their default location in the Resources folder? You need NGUI's shaders to be present there in order for NGUI to be able to load them. "Unlit/Transparent Colored" gets replaced with "Unlit/Transparent Colored (SoftClip)" for soft clipping. You can also add them to the list of shaders that always get included (Edit -> Project Settings -> Graphics).

ngui

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Alpha not clipping on child
« Reply #7 on: January 21, 2014, 01:47:58 AM »
I'll double check their location tomorrow. Thank you.