Clip mask

  • "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

  • 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.

  • 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...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)