Author Topic: Texture Mask and Meshes  (Read 4936 times)

r.pedra

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 20
  • Posts: 131
    • View Profile
Texture Mask and Meshes
« on: December 09, 2014, 05:47:47 AM »
Hi,
I want to mask meshes with Texture Mask feature of NGUI.
I tried to use the work of this guy:
http://www.tasharen.com/forum/index.php?topic=10223.msg48054#msg48054

But it seems that Texture Mask use a different way of masking.

I tried to do it with RenderTexture instead but it's heavy with mobile(because we want to achieve something like the attachment we need to use multiple RenderTexture if we do this that way)

Can someone help me?
Thank you.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Texture Mask and Meshes
« Reply #1 on: December 09, 2014, 01:56:14 PM »
Why do you need render textures / masks for this? All I see are just a bunch of sprites on top of each other. NGUI's clipping / masking works with widgets, not meshes. To make it work with 3D renderers (assuming that's what you're asking?) you will need to create at least one custom shader for that object that will do clipping inside.

r.pedra

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 20
  • Posts: 131
    • View Profile
Re: Texture Mask and Meshes
« Reply #2 on: December 10, 2014, 05:12:35 AM »
In fact we have very big landscapes, and we couldn't afford to store them with sprites, so there are SVG converted to Meshes.

The artist wants to do this thing in the picture so I need to mask the meshes with a Texture (To have a rounded mask). I managed to do it with the normal clip of the panel thanks to the guy in my link but the artist really wants rounded corner.
I didn't success to do it with meshes so I tried with RenderTexture filming meshes, but it's really heavy in memory to have all these RenderTextures.
(In fact, I tried to mask regular Textures and Sprites with the Texture Clipping but it doesn't work, is it working the same way than Unity UI Mask?)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Texture Mask and Meshes
« Reply #3 on: December 11, 2014, 08:43:01 AM »
Well, as I mentioned, NGUI's shaders are meant to work with widgets. Making them work with meshes involves custom code, like you've see in the other thread. If you can't use textures (and you don't need sprites, remember? you can just use regular textures with UITexture), and you have to use meshes, then you need to write a custom shader for it to make clipping possible. The key is that NGUI supplies variables to its own shaders that make clipping possible. You will need to do it yourself in an OnWillRenderObject().

r.pedra

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 20
  • Posts: 131
    • View Profile
Re: Texture Mask and Meshes
« Reply #4 on: December 11, 2014, 09:36:12 AM »
Ok, thank you for taking the time to answer me  :)