Welcome,
Guest
. Please
login
or
register
.
June 03, 2023, 12:08:03 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Mask with NGUI
« previous
next »
Print
Pages: [
1
]
Author
Topic: Mask with NGUI (Read 4615 times)
Tatanan
Jr. Member
Thank You
-Given: 11
-Receive: 0
Posts: 81
Mask with NGUI
«
on:
February 16, 2015, 06:34:54 AM »
Hello.
Is there any way to make a mask with NGUI?
By "mask" I mean the mask Flash has, ie, an object which defines which part of another object is shown.
I already know that NGUI does have some kind of mask if you use a UISprite of type Filled. Then adjusting Fill Amount I can show more or less. But I wonder if I can make it better like I did it on Flash.
Example: cutting an image with a starred shape or so.
Thank you.
Logged
Game developer on
Casual Arena
.
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Mask with NGUI
«
Reply #1 on:
February 17, 2015, 09:24:10 PM »
Yes. Panels let you specify a clipping mask texture.
Logged
Tatanan
Jr. Member
Thank You
-Given: 11
-Receive: 0
Posts: 81
Re: Mask with NGUI
«
Reply #2 on:
February 18, 2015, 03:19:57 AM »
As far as I know, panel mask are only rectangular.
Is there any way to use other shapes, like stars, circles, human-shapes or whatever?
I know that Unity UI has this kind of masks, but I don't know if it's compatible with NGUI.
Logged
Game developer on
Casual Arena
.
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Mask with NGUI
«
Reply #3 on:
February 18, 2015, 05:06:19 PM »
Make the texture mask a circle, and there you go. Its a texture mask. Specify whatever you like. All textures are rectangles, doesn't mean that what you see has to be.
Logged
Tatanan
Jr. Member
Thank You
-Given: 11
-Receive: 0
Posts: 81
Re: Mask with NGUI
«
Reply #4 on:
February 19, 2015, 03:21:31 AM »
Oh, I just realised that you could specify a texture on the UIPanel to use as mask.
That's a great feature.
However I'm finding a problem. I'm attaching a screenshot. The mask is not working properly. The UISprite should be masked by a hand shaped mask, but there are also some extra lines on each direction.
Logged
Game developer on
Casual Arena
.
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Mask with NGUI
«
Reply #5 on:
February 19, 2015, 02:05:42 PM »
That's your texture import settings. You have it set to Clamp, and your texture goes all the way to the edges of the texture.
Add some padding pixels.
Logged
Tatanan
Jr. Member
Thank You
-Given: 11
-Receive: 0
Posts: 81
Re: Mask with NGUI
«
Reply #6 on:
February 20, 2015, 03:28:56 AM »
I still don't know how to do it.
After your answer I have tried every texture type and I still can't make a "good" mask. The mask keeps adding 4 extra lines for each direction.
It's the same with other textures. Basically, the mask is not respecting the Size value and it's adding "extra lines".
Logged
Game developer on
Casual Arena
.
Nicki
Global Moderator
Hero Member
Thank You
-Given: 33
-Receive: 141
Posts: 1,768
Re: Mask with NGUI
«
Reply #7 on:
February 20, 2015, 03:33:30 AM »
I think you can hack it by giving the mask a 1px border of transparent color.
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Mask with NGUI
«
Reply #8 on:
February 21, 2015, 08:09:58 AM »
Exactly what Nicki said. The "white" of your texture should never go all the way to the edges of the clamped texture. Clamp = border pixels "repeats" forever.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Mask with NGUI