Clip mask

Discussion and feedback on Construct 2

Post » Sat Sep 26, 2015 10:27 pm

"A clipping mask is a group of layers to which a mask is applied. The bottommost layer, or base layer, defines the visible boundaries of the entire group. For example, suppose you have a shape in the base layer, a photograph in the layer above it, and text in the topmost layer."

Seems like this should be readily available, but I can't seem to find a way to do it.

Any Ideas?
Suggestions?
Implementations using css, canvas clip, and webgl
Image ImageImage
B
169
S
50
G
174
Posts: 8,330
Reputation: 110,804

Post » Sat Sep 26, 2015 11:39 pm

If the mask is just a sprite, you could duplicate it for each layer and use blend modes. Just be sure the layer has "force own texture".

The only other alternative would be to draw to a canvas or paster object for such grouping. I haven't been able to get the paster object to paste a layer at a time but the canvas plugin can, but doesn't use webgl. The flow would be to paste the two top layers first then paste the mask layer to a second canvas and then use a blendmode to paste to the first canvas.
B
92
S
32
G
110
Posts: 5,295
Reputation: 71,501

Post » Sun Sep 27, 2015 1:34 am

It's quite aggravating to try and figure out how to apply a blend mode when you have no idea how it will work.
What goes over what, do I use separate layers, etc...
Image ImageImage
B
169
S
50
G
174
Posts: 8,330
Reputation: 110,804

Post » Sun Sep 27, 2015 1:59 am

Got it to work:
https://www.dropbox.com/s/o5acvj3hfk0y2 ... .capx?dl=0

Could probably be improved somehow.
A separate sprite as the boundary seems a bit of overkill.

Edit:
Thanks @R0J0hound the force own texture was the part I needed.
Image ImageImage
B
169
S
50
G
174
Posts: 8,330
Reputation: 110,804

Post » Sun Sep 27, 2015 3:22 am

For the record, you can also do this with the overlay shader without force own texture. It's a little different though. More suitable for lighting effects and such.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770


Return to Construct 2 General

Who is online

Users browsing this forum: mihirolover and 6 guests