Non rectangular GUI Mask / Matte?

I have looked around a bit but can't find anything definitive on this.

I'm using GUI.DrawTexture along with a GUI Group to move textureA behind textureB so that textureA looks like it's disappearing. However, textureB has transparency and a curve so using a simple rect from the GUI Group does not achieve the look.

Is there a way to pass in alpha or color information from another texture in order to get a non-rect masking effect?

I saw something about using the Graphics class along with a custom material which I will look into more. I don't know shader scripting very well so I am hoping there is a more simple approach that I am overlooking.

Thanks! John

Edit: Adding an image to help clarify my question. alt text

more ▼

asked Aug 13, 2011 at 09:49 PM

jczaban gravatar image

186 3 14 7

Not sure I get what you're trying to do. You say you want to move a texture behind another, but I can't visualize what you mean. Can you include a couple screen captures of the beginning and end frame of what you want to do? When you say the texture is 'disappearing' I think fading - is that the case?

Aug 13, 2011 at 10:02 PM Julien.Lynge

I added an image to help visualize. I need a GUI texture to move behind another GUI texture that has transparency and a curve. I want it to look like the moving texture is extending in/out from the top of the curve. Thanks for replying, I hope the image helps, I feel like I'm missing something simple.

Aug 14, 2011 at 04:45 AM jczaban
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Tricky :). If the moving part (textureA) has no transparency, you could try using a transparent cutout material. There's an example of more or less what you'd need to do here, but your alpha channel would look more like this:

alt text

Then, you'd just check the screen y-value of your object and adjust the alpha cutoff accordingly. That's the easiest way I know of to do it without a bunch of coding and pixel manipulation - hopefully someone else will come along with a more elegant solution :)

more ▼

answered Aug 14, 2011 at 05:26 AM

Julien.Lynge gravatar image

10.5k 89 103 161

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Aug 13, 2011 at 09:49 PM

Seen: 2484 times

Last Updated: Aug 14, 2011 at 05:26 AM