KhronosGroup / glTF

glTF – Runtime 3D Asset Delivery
Other
7.15k stars 1.14k forks source link

Mesh sequence animations #2175

Open jjcasmar opened 2 years ago

jjcasmar commented 2 years ago

Does glTF support mesh sequence animations? I have a bunch of N obj files defining an sequence animation that I want to convert to a binary file. In glTF I could theoretically add N morph targets and a step animation for the weights, settings 1 for the current shape and 0 for the rest, but that looks really hacky. Does glTF supports mesh sequence properly?

scurest commented 2 years ago

Not specifically. Btw it's better to make separate meshes and step-animate their scale because lots of morph targets may hit the vertex attribute limit. See a workflow for this here.

jjcasmar commented 2 years ago

Yeah, completely agree that several morph targets hit the attribute limit. That is why I say its a hacky way of doing it. Using different meshes doesn't seems like a solution neither, as you will be generating several meshes with completely equal index buffer and potentially, if the renderer doesn't do some checks, doing a draw call for each of the meshes.

btw, I just want to use this in Blender. The objs are the results of some physically based simulations and I want to check how the simulation went.

donmccurdy commented 2 years ago

You can use whichever workflow, but FWIW the morph target workflow is pretty common and should work fine in most engines. Even in engines with limited morph targets, the limit is often active morph targets, and cycling through 100+ targets one at a time is OK. Example:

https://threejs.org/examples/?q=morph#webgl_morphtargets_horse

RNavega commented 2 years ago

btw, I just want to use this in Blender. The objs are the results of some physically based simulations and I want to check how the simulation went.

You should take a look at the Alembic format, it's ideal for situations like yours.

fire commented 1 year ago

Someone reminded me a few days ago I had a workflow for alembic to gltf.

There's two workflows.

  1. every frame is a different mesh https://github.com/V-Sekai/vsekai-blender-game-tools/blob/main/misc/io_mesh_obj_seq.py
  2. frames can be morph targets / have same vertex order etc. https://gist.github.com/fire/495fb6a35168500df53c002695a1f5fe