Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: spanagiotis on July 02, 2014, 12:41:40 PM

Title: Compound UIPanel clipping
Post by: spanagiotis on July 02, 2014, 12:41:40 PM
I am attempting to modify NGUI to allow for compound UIPanel clipping. I know nested clipping is currently in the most recent version, but I'm looking to do the opposite. I need nested panels to act a 'one' panel for clipping purposes.

Example Hierarchy:
UIPanel 0
-UIPanel 1
--UIPanel 2
---Some sprite

If 'some sprite' is moved around and it leaves the UIPanel bounds of UIPanel 2, but is moved into the bounds of UIPanel 0, it will still show. This way I could have a panel of a certain size at one point, and of another size at another point, say 100 units away with a gap in-between them. If the sprite moves from the first panel it'll get clipped like normal as it exits the panels bounds, but as soon as it enters the bounds of any of the nested panels it'll show up again.

Unfortunately my knowledge of shaders and how the clipping system works in NGUI is less than optimal, and my modifications feel like I'm taking shots in the dark. I had an impression the modifications need to take place inside the OnWillRenderObject() of the UIDrawCall.cs file.



Title: Re: Compound UIPanel clipping
Post by: ArenMook on July 03, 2014, 04:31:55 AM
For something like this, I strongly advise looking into stencil masks. Don't attempt to modify how clipping works in NGUI, it will only give you a headache. Stencil masks can achieve this easily, but it's a Unity feature and is outside of NGUI support forum's scope.