Jump to content

Morph data and mesh data, how can I handle this?


Recommended Posts

I am researching model files in a game. There are two types of files (base model and specific model), where base model has all vertex, face, UV data and specific model has only vertices

To create the specific shape, game uses a formula for vertices as vertex of base + vertex of specific model I made a compilation of process at the attached image.

Now, the issue I am facing is, the base face has 734 vertices (there are duplicates, not merged) but morph data has 573 vertices (no duplicates). It is easier to create a script that makes this reverse conversion so I can edit vertices in Blender. How can I handle this? Hopefully I could explain myself.

image.thumb.png.8a0a43531e37f9f8ca314e8c0f2aebd6.png

Link to comment
Share on other sites

  • Engineer
Posted (edited)

Hello
From my experience, morph data are stored as sparse additive vertices.

Like you described, base buffer has all vertex data, while morph targets mostly store additive positions and sometimes normals (well you can store anything, the sky is a limit, but those two attributes are prominent)

In addition, morph data tends to be stored as sparse attributes. That means each morph target uses it's own unique vertex set, that is indexed onto base buffer via it's own index table.

Example pseudo code:

for (int v = 0; v < numVertices; v++) {
  outVertPos[v] = baseVertPosition[v] + morphVertPosition[morphSparseIndices[v]];
}

If you want even info, here is great resource: https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/Specification.adoc#sparse-accessors

Edited by Maxwell
Link to comment
Share on other sites

  • 1 month later...

Hi, thanks for your response.

Yes what you meant makes sense. In my case it looks like sparse indices are stored in specific file. Problem is I don't know how they are stored. 2 bytes? 4 bytes? What kind of integer could it be? Repeatedly tried looking into file but couldn't come up with a solution.

I found UV map locations and vertex locations on the file, but have no idea on morph indices.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...