Spine icon indicating copy to clipboard operation
Spine copied to clipboard

[Question] Mesh support

Open freeubi opened this issue 6 years ago • 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 :)

freeubi avatar Apr 13 '18 09:04 freeubi

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.

maxgribov avatar Apr 13 '18 09:04 maxgribov

Very urgent needed

Whiskee avatar Jan 02 '19 10:01 Whiskee

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 :)

freeubi avatar Jan 15 '19 09:01 freeubi

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...

maxgribov avatar Jan 17 '19 14:01 maxgribov

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.

hartwoolery avatar Jan 23 '19 17:01 hartwoolery

@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?

zabolotiny avatar Jul 15 '20 08:07 zabolotiny

@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?

zabolotiny avatar Jul 17 '20 10:07 zabolotiny

Do you have an idea how to do that?

zabolotiny avatar Jul 17 '20 10:07 zabolotiny

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

hartwoolery avatar Jul 17 '20 20:07 hartwoolery

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

maxgribov avatar Jul 18 '20 12:07 maxgribov

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

maxgribov avatar Jul 18 '20 12:07 maxgribov