maxgribov/Spine

[Question] Mesh support

Closed this issue · 11 comments

Hello,

in the last few days, I played with this framework, it's a pretty decent work!
I plan to test on Apple Watch in this weekend.

Currently, I'm developing our app new version with the official spine-objc framework (in a swift project), but it will be awesome if we can do animations on the watch too.

The only thing that missing here is the mesh support, do you plan to build it?
As I see, it's not that easy :(
I'm available to help :)

Hey,

the implementation of mesh support requires further investigation of the SpriteKit framework. I suggest that the solution lies in the area of working with SKWarpGeometry. But need to experiment.

Planning on doing that in the future, but not in the near future.

Very urgent needed

Yeah, this is the only reason why I don't use this framework.
I checked a few things with SpriteKit but unfortunately, the mesh support is way over my skills.
Otherwise, if you need any help, then feel to free hit me up :)

I'm sorry, guys, but I still don't have time to implement meshes. Besides, I don't have the Pro version of Spine App and I don't use meshes in my own projects yet... So, it also does not speed up the process of implementation of this feature...

I think this can be accomplished with SKShader (looking at SKWarpGeometry, it doesn't seem like a great fit). I'll take a look and maybe I can create a pull request if I figure this out.

Edit: looks like SKShader doesn't support vertex shaders (only fragment), so maybe not.

@maxgribov @hartwoolery Hey guys, i am going to jump on Mesh support implementation. Max maybe you can point me into a right direction from where to start and what is missing to obtain Mesh support?

@maxgribov While working on this i am using this sample
raptor.zip
But stuck with the question how to convert "vertices" float array to columns and rows qty?

Do you have an idea how to do that?

Essentially looking at that json, it provides mesh information in a triangle format, so you would need to write a custom shader in SceneKit then render it in SpriteKit using SK3DNode. See here for info on creating a custom meshes: https://medium.com/@zxlee618/custom-geometry-in-scenekit-f91464297fd1

SK3DNode render a three-dimensional SCNScene in one piece. If you try to render all the slots with meshes at once in a single scene, this creates problems with the render of the slot hierarchy (because they can overlap each other and change their position in the hierarchy, while regular slots and meshes can be mixed together). If you use a separate SK3DNode for each mesh slot (and, accordingly, a separate SCNScene), this can affect performance.
https://developer.apple.com/documentation/spritekit/sk3dnode/displaying_3d_content_in_a_spritekit_scene

Perhaps it makes sense to render characters that use meshes completely in SK3DNode