pixijs / spine

Pixi.js plugin that enables Spine support.
Other
569 stars 217 forks source link

Spine clipping #179

Closed macpooh closed 7 years ago

macpooh commented 7 years ago

Some time ago Spine introduced clipping masks for spines. Does support of this feature scheduled in nearest future?

ivanpopelyshev commented 7 years ago

pixi-spine is up-to-date with spine-ts, but pixi implementation lacks masks. I'm gonna add them soon if you are able to test them :)

macpooh commented 7 years ago

It would be highly appreciated. just let me know if u need something further.

michalochman commented 7 years ago

@ivanpopelyshev I have just run into this issue and I have created very simple test case if that helps:

https://codepen.io/michalochman/pen/PjVjRr?editors=0010

This is how it looks like: image

This is how it should like: image

ivanpopelyshev commented 7 years ago

That'll help me to debug, thank you!

ivanpopelyshev commented 7 years ago

OK, so I studied their clipping algorithm and understood that we need better clipping handling in pixi first. Probably as a separate plugin. With current implementation its not easy.

  1. Direct spine-ts mesh clipping - good only on low mobile devices with WebGL
  2. "PIXI.Graphics" as a mask. - good in both Canvas2d/WebGL but it has to be PC or good mobile phone
ivanpopelyshev commented 7 years ago

@michalochman please check the latest version. Also I didnt make special tests, but I hope there are no stupid errors.

I implemented clipping through PIXI.Graphics, it must work with Canvas2d too.

michalochman commented 7 years ago

@ivanpopelyshev I have updated my test case on CodePen, seems to be working!

Great, thanks!

macpooh commented 7 years ago

hey. It works, but if its static. though DeformTimeline seems working, vertices keep updating on each frame, but its have no visual representation. I'm debugging right now, but if you have any suggests - would be cool) animation used in attachment clip_animation.zip

link to pen clipping not updated, as you can see here.

ivanpopelyshev commented 7 years ago

OK, then its a bug, good test. Will look at it soon.

ivanpopelyshev commented 7 years ago

Fixed in 1.5.3

@macpooh please test it!

macpooh commented 7 years ago

It works fine! thanks a lot