Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Grofit on August 16, 2012, 09:34:31 AM

Title: Clipping Simple Textures within Panel?
Post by: Grofit on August 16, 2012, 09:34:31 AM
I have a panel with a NGUI simple texture beneath it, but for some reason the panel isn't clipping the texture, is this correct behaviour? I am using Hard Clipping but have tried Soft and Alpha too...
Title: Re: Clipping Simple Textures within Panel?
Post by: ArenMook on August 16, 2012, 10:32:08 AM
You need shaders for clipping to work -- meaning GLES 2.0 if you're targeting android/ios. You also need to use a correct shader. Unlit/Transparent Colored is a shader that supports clipping, for example. Overlay shader does not.
Title: Re: Clipping Simple Textures within Panel?
Post by: Grofit on August 16, 2012, 01:08:10 PM
Thanks for the quick response, currently am only running on windows, I did see a similar topic recommending using a different shader. I have just tried using Unlit/Transparent Colored but it doesn't appear to clip the texture, I am also using the free version of NGUI for the moment. I remember you posting elsewhere saying that the free version didn't have all the bug fixes the paid version has.
Title: Re: Clipping Simple Textures within Panel?
Post by: Grofit on August 16, 2012, 01:12:49 PM
Right! got it working, I had 2 panels, one was a container for multiple elements, one of which contained the texture, now it works as intended, but it looks rubbish because of the transparency, but thats a seperate issue :)

While kind of on the subject, how would you recommend going about grouping NGUI elements to make hierarchies in the project? i.e.

  1. Anchor
  2. |- Camera
  3.     |- Panel
  4.         |- Background
  5.             |- Texture
  6.         |- Content
  7.             |- Label

I tried using empty game objects, but that seems to mess up the transforms for subsquent children.
Title: Re: Clipping Simple Textures within Panel?
Post by: ArenMook on August 16, 2012, 05:05:24 PM
Empty game objects work fine. Just make sure the scale is (1, 1, 1), and I recommend keeping the position as integer numbers so it's pixel-perfect. (Select the UI root and hit Alt+Shift+P).