rayxuln / spine-runtime-for-godot

This project is a module for godot that allows it to load/play Spine skeleton animation.
MIT License
92 stars 22 forks source link

Clipping is not working #4

Closed rayxuln closed 4 years ago

scottkunkel commented 4 years ago

Please explain.

rayxuln commented 4 years ago

The animation "portal" in SpineBoy is not the same as expected when played using this runtime module in Godot.

scottkunkel commented 4 years ago

Tricky. Looking at the example, the SpineSprite is only visible when inside a clipping mesh. Godot is not really supporting clipping masks. I found two ways of doing this:

This would entail creating a mask texture from the clipping mesh, transforming it for each individual slot for rotation and translation and then feeding it into an attached masking shader. Ugh!

I don't really like either solution to the issue. Looking at the animation, I would leave it to the game developer to mask the actual sprite using what they want in that situation. The portal example can be fairly simply replicated by having the portal and spineboy as two different nodes and masking spineboy in the engine itself. I've done similar things with the spine node and it's fairly straightforward since you can use a baked texture for a shader on a parent node.

scottkunkel commented 4 years ago

Actually scrap that. Looking at https://github.com/EsotericSoftware/spine-runtimes/blob/3.8/spine-cocos2dx/src/spine/SkeletonRenderer.cpp, clipping can be done by eliminating vertices from the attachments using the runtime SkeletonClipping class. Gotta dig deeper.

rayxuln commented 4 years ago

Nailed it.

Next is to test its stability.