• Unity
  • Clipping Spine skeleton animaion with Unity 2017 sprite mask

Related Discussions
...

Hello,
Recently I've encountered a problem. While Unity sprite mask is clipping sprites perfectly I cannot make it work with Spine objects. Do you know any way to clip Spine object using another sprite's bounds by any chance? I'd prefer not to use any shaders for that as we want to use custom shaders for special visual effects for Spine objects. It's also worth noticing that Unity UI clipping maks works perfectly with Spine skeleton graphic objects, but we need it to work with skeleton animation (interact with it's mesh renderer).

Sprite Mask is implemented via shaders.
(Or rather, Unity shaders define how a Material interacts with Sprite Masks because they are implemented using stencils.)
So you do have to use shaders.
Unity otherwise doesn't expose enough of the underlying stencil calls for us to handle this simply on the component side. It has to be done on the material/shader.

See this post for info on what we've found to work: [unity] Unity 2017 SpriteMask support · #941

Thank you for the reply, it was very helpful!

I've managed to use Unity SpriteMask with Spine objects but I've encountered another problem. It seems that when a sprite is clipped by mask (it uses material with shader that is capable of being clipped) it looses ability to receive shadows. We are trying to achieve effect of a 'photo' that consist of few sprites / Spine objects. All those objects must fit inside photo frame (that's why we're using sprite mask). We also want this photo to cast and receive shadows, but unfortunately receiving shadows does't work when object is clipped. I've tried different shaders and it seems like shaders that can be clipped by SpriteMask don't have ability to receive shadows. Is there any way to achieve described effect ? I'll attach image that hopefully will help to understand my problem.