mask of clipping

Not favoritedFavorited Favorited 0 favourites
  • 11 posts
From the Asset Store
Basic template for drawing game with masks and easy customization
  • Ashley

    could you add clipping or masking to the sdk?

    V1 had it but was removed for sdk v2.

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What methods were those exactly?

    If they were undocumented methods in SDK v1 please note they were never officially supported, the documentation explained such features could break or be removed at any time without warning and so addon developers should never use or rely on them, and we are not obliged to support them with SDK v2.

  • Sorry, i was under the impression that it was possible in v1.

    Is it possible to add an official supported method in V2?

    So we can do proper masking and clipping of sprites and other objects etc.

  • Typically you'd do masking/clipping using blend modes like 'destination out' with a force own texture layer. That's all done using the regular engine - do you really need to use the SDK for that? If you want to set something like that up automatically in an addon, you could probably do it using the existing layer and blend mode APIs.

  • There is no blend mode combination you can have that clips sprite A to sprite B's shape while leaving sprite B invisible.

    The closest is apply source-in to sprite A, and having a transparent edge on the image, but it needs to be larger than sprite B to hide sprite B's the shape.

  • You’re probably referring to the scissor cut feature that webgl has that was one of the things that c3’s renderer batched. It was never an sdk feature, but a way to use it was found before sdk2 (which walled a lot of stuff away). Anyways, all it did was limit rendering to a bounding box on the screen. I don’t think that really helps solve the masking issue unless all you want to do is mask by a rectangle.

    The issue you have is the mask isn’t covering all the objects underneath. Using layers you can effectively first draw the mask to a full screen texture and use the blend mode on that.

    You can do the masking by having a layer with two sub layers. You’d put all the objects you want to mask in the first sub-layer, and the mask object in the second sub-layer. Just have normal blend modes on all the objects, but use the “destination in” blend on the second sub-layer itself.

    You could likely do it by drawing objects to a drawing canvas as well. But you’d still need two of them since you need to make the mask cover everything you want to mask.

    I don’t think it’s really something that’s feasible to do from the sdk from what I can tell.

  • Thanks R0J0hound

    It would be nice to have less of a hacky way to do this, but i was able to do what you said and put it in a plugin that handles it all for you automatically. Adding some more features then will release it.

  • Kashin GinnRecently dropped this method in a thread and it works really well. Blew my mind.

    wackytoaster.at/parachute/clippingmask.c3p

  • That’s a pretty cool idea. Erase a hole and draw in the hole. I’ll be adding that to my toolset.

    Edit:

    Main limitation of that method is the mask needs to be completely contained within the object's pixels. And it doesn't work on transparent layers with force own texture. Still pretty cool.

  • That's cool, but the mask is not transparent. When the image doesn't cover the mask fully you can see its colour.

  • Yeah I agree that it's not perfect but it's the best I've seen so far.

    It's a long standing and highly voted suggestion, but alas

    github.com/Scirra/Construct-feature-requests/issues/726

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