pablodp606 / keymesh-addon

GNU General Public License v3.0
129 stars 13 forks source link

Feature Request: Export to Mesh Sequence or Alembic File #7

Open ncthbrt opened 3 years ago

ncthbrt commented 3 years ago

Hi there I'm extremely excited for this add on as I've been independently working on a game that utilizes sequences of meshes for character animation. Keymesh adds some really nice workflow improvements however I cannot use it yet as the animations don't yet allow export to a format usable by my game engine (Unity).

AldrinMathew commented 3 years ago

@ncthbrt Exporting animatable Mesh sequences is a heavy concept. Most formats (or all as far as I know) stores animation as values between which the software can interpolate to get the correct animation. The interpolation happens for the same mesh data. A sequence cannot be exported without loss if there is any change in mesh data. Imagine the change in number of vertices, and how an exporter will understand it. The way in which Blender manages mesh data and Keymesh addon manages keyframes is native to Blender, and by design is not compatible with export formats. And, an exporter is separate from the keymesh addon, and has its own way of understanding and handling data. So to make it compatible with Keymesh Data, the source of the exporters will have to be modified, which is it's own problem. Plus, the biggest problem here is the target software. How can the target software understand this custom method of storing mesh sequences?

AldrinMathew commented 3 years ago

@ncthbrt

There are 2 solutions that I can think of:

Both of these methods are beyond my knowledge of python (which is bare minimum). Hopefully, we can get Pablo Dobarro's comment on this @pablodp606

ncthbrt commented 3 years ago

Create a Keymesh addon/plugin for the target software, and find a way for Keymesh to export the mesh sequence from Blender to a custom format. Then the target software's Keymesh addon/plugin can import it to that software.

The second solution is something that would definitely work at least for me. I'm just not sure how to get the mesh data out from blender as I'm unfamiliar with the scripting language and API.

I have already built a small lib in Unity that can handle mesh sequences, though should probably add support for some data format that is adjacent to the actual mesh files that allows the exporter to reuse mesh data if the animation repeats particular frames.

AldrinMathew commented 3 years ago

@ncthbrt May be export each of the Keymesh keyed frame of the mesh to a light format like STL in Blender and then import each one of those files in Unity and combine to a single Object? Not entirely doable, as we will need to find which of the keyframes were created by Keymesh.

ncthbrt commented 3 years ago

That definitely could work. Stl/Obj are both good formats for interchange.

Here's a short animation test in Unity I did that used that obj sequences: https://www.instagram.com/p/CFX0i81pseg/

AldrinMathew commented 3 years ago

That was cool! Especially the regeneration part!