• Editor
  • [Feature Request] Masking

So there are a few areas where masking is an obvious enhancement: effects and objects that have overlapping layers from multiple sides (eyes, mouths, gaping wounds, machine parts, etc). With effects you can get a hell of a lot of play out of moving, scaling and deforming a texture through a mask (or heaven forbid a set of objects use collectively as a single mask).

Nate wrote

Masking of images (for instance an eye ball) This would be nice, but would need to be supported in all runtimes.

I know you guys are hard at it and that there are workarounds or other software that can achieve the effects of masking. I just think it'd be a major creativity booster, where suddenly you're able to do new things or workflows that wouldn't have otherwise been possible. I'd drop another $50 to see it happen.

Related Discussions
...

I agree, it would be awesome. The runtimes are really the limiting factor. The cheapest way to do clipping in OpenGL is probably a stencil buffer. The downsides are that it would have aliased edges and would cause two batch flushes. None of this matters for exporting video or images of course.

It's a good feature and I'd like for it to make it in, but there are lots of other things to do first.

Yep totally understand. I made the post hoping to drum up support, but it looks like I might be in a minority on this one 😃

Thanks for the reply Nate. The community support here is top notch. Keep up the great work.

12 days later

Yes Nate, make another Kickstarter project! You have my support too...

It's actually something we talked about a long time ago before this thread even came up. Personally I would love to have that feature, however the nature of it makes it unlikely that it is something all runtimes would support. Also there are more important tasks to take care of should we ever want to implement it. Currently it's not planned.

Oh and also no more Kickstarter plans 😉

2 months later

I just recently started working with Spine. Loving the tool! Keep up the great work!

What workarounds/tools would you recommend as alternatives to masking in Spine for a cocos2d-x 3.0 pipeline? So far, GAF is the only alternative i've found that supports masking for cocos2d-x, however it hasn't been updated to support 3.0 yet.

A couple of example use cases:

  1. Clipping objects that are partially outside of another arbitrarily shaped object.
  2. Animated progress bars of arbitrary shapes.

Thanks!

12 days later

I haven't looked into how clipping is done with cocos2d-x, they may have cocos2d-x classes to help with it. Otherwise you can just use OpenGL. glScissors is easiest for axis aligned clipping. The stencil buffer is your best bet for arbitrary shapes, though it won't have antialiased edges on the clipping. Maybe you could use a bounding box to define the clipping area for using the stencil buffer. That's actually a pretty cool idea.

Image removed due to the lack of support for HTTPS. | Show Anyway

3 months later

I don't know about rest of the Spine users, but my project would benefit from masking regardless the run times. All graphics I've produced with Spine are exported into .png sequenced pictures anyways.

Venomlemon wrote

I don't know about rest of the Spine users, but my project would benefit from masking regardless the run times. All graphics I've produced with Spine are exported into .png sequenced pictures anyways.

That is a very valid point, however due to the amount of work we still have to do on Spine we focus on features that benefit both users that export JSON and users who export images first. Unless it is really trivial to implement (which I'm pretty sure it's not) it will have to wait for other things to be finished first.

3 months later

Yes please. I would love to have this feature in there too.

2 months later

+1 for masking... it isn't a trivial feature :-P

12 days later
10 days later
2 months later

+1 for masking. i would really love to be able to make "shinny" buttons and light sweeps over layers without generating huge textures...

10 days later

-1000000 to masking! Ha! your idea has now been downvoted 😛

Nah seriously, we would love to do this, but the workload is already huge. I honestly don't know when we can get to it. For now I suggest using a bounding box as a mask. You won't be able to actually see the masking in effect inside of Spine, but at runtime you can write some code to make the magic happen.