-
Notifications
You must be signed in to change notification settings - Fork 1.1k
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Morph Target Names #1036
Comments
glTF 2.0 uses integer indices to refer to different entities, because they're stored in JSON arrays. If an application wants to add string identifiers, it could use {
"meshes": [
{
"primitives": [
{
"attributes": {
"POSITION": 0
},
"targets": [
{
"POSITION": 1
},
{
"POSITION": 2
}
],
"extras": {
"targetNames": [
"Happy",
"Sad"
]
}
}
]
}
]
} |
Yeah I guess that could work |
Perhaps we should leave this open under |
Having two ways of doing something (in this case, referring to a morph target) isn't a good thing for data format in general. I would think of some sort of "Pose" extension which could cover this use case as well as named and predefined skeleton states. Sometimes, model "emotion" consists of both skeleton transforms and morph weights. |
Right, if anything this should be similar to the |
I really want morph targets names as @feiss mentioned morph targets are often named for artists/programmers. I know Blender and other tools support morph targets names. I think adding
|
Another syntax option might be similar to what @lexaknyazev suggested, but without
Could help with issues like KhronosGroup/glTF-Blender-Exporter#100, where the order of morph targets is not stable or obvious to the artist within a DCC tool. |
^The syntax above is easier because it doesn't break syntax and could potentially be in a 2.X release. Unfortunately I think @takahirox's suggestion would have to be considered a breaking change, based on:
If we were willing to break syntax, my vote might be to also move
|
Ah, right. And in my suggestion having different types (indices to attributes and strings as name) in a dictionary isn't good. A bit complicate to parse. I personally prefer the latter one because we don't need to care if "targetNames and weigts lengts are equal to targets length" and that
I hope this gets in. |
I came to think it'd better to have Is there any cases where we want different morph target name set across primitives, like
? |
Oh, great point, I'd forgotten weights were on the mesh and not the primitive... worth noting that glTF animations target nodes, not primitives, and so having unrelated morph targets across primitives is probably something to discourage anyway.
|
=> mesh[i].primitives[j].extras.targetNames[k] https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/mesh.primitive.schema.json KhronosGroup/glTF#1036
I got a request to add this to Maya2glTF. Has a decision been made regarding this? If not, any advice on what to pick for maximum compatibility with existing engines? Thanks! |
@ziriax three.js looks for |
Looks like the In the mean time, would it be acceptable to add a non-normative "implementation note" to section §Concepts/Geometry/Meshes/Morph Targets Something like that: begin of text to add:
"meshes": [{
"extras": {
"targetNames": [
"target_Smile",
"target_Cry"
]
},
"weights": [
0,
0
],
"primitives": [{
"attributes": {
"POSITION": 0,
"NORMAL": 1
},
"targets": [{
"POSITION": 2,
"NORMAL": 3
},
{
"POSITION": 4,
"NORMAL": 5
}
],
"indices": 6
}]
}]
end of text to add I would like to open a PR to implement the proposed addition... Edit: This could also be formalized in an tiny extension? Would that be worth it? The |
I'd definitely like to see |
Hey @donmccurdy thanks for your input! For me, It really depends on when "the next version of glTF" will happen... If it's in a little while, well, maybe we should bother with explaining the stop-gap solution? Such an extension is indeed a bit silly, and like you I also feel like it is a bit strange to have documentation about an extra field (that is supposed to exist to be able to add application specific things to the glTF format if I understand the design logic behind It is just that I had to google for and find this discussion for finding the answer for "is there a way to get the name of morph targets in a glTF?" And I found this, and that the exporter in the lattes beta of blender 2.8 I downloaded was writing this array of strings, so I could use that directly. I am aware of another exporter that also bother exporting target names in that way, and I think your glTF webGL viewer (three.js based?) also can read these names and show them in the UI, but I haven't checked this usage was super widespread among software compatible with glTF. Judging by the number of times this issue has been referenced by external repository discussions using the # feature of GitHub markdown, it seems that whether or not we hint about this in the main document, people are today writing software that check if that property exists and loads it's content anyway. It is not ugely important, and not all application that consume glTF assets needs to have names for their morph targets, it's just a "nice to have feature". What I suggest is obviously not to set in stone the extras property at all, it's to add a pointer as a non-normative note that this is a relatively common usage of I have updated my comment above to add a blurb explicitly saying "this is not standard, a future version of glTF may do this differently". Personally, I think this is so small of a thing that it doesn't deserve an extension. However, some extensions like |
There is no ETA on glTF 2.X or 3.0 at this time – we are currently focused on extensions. I'd be OK with adding a non-normative implementation note in the spec. Any objections? |
Okay. If you guys are on board with it I will open a PR with my proposed addition later today. We will be able to discuss the actual wording in that comment section. 😄
… Le 18 juin 2019 à 02:03, Don McCurdy ***@***.***> a écrit :
There is no ETA on a new version of glTF 2.X or 3.0 at this time – we are currently focused on extensions.
I'd be OK with adding a non-normative implementation note in the spec. Any objections?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
…ames Morph target names are not required to perform morphing. A real time application that consume glTF assets doesn't need morph target names in the general case. Rightly so, glTF doesn't impose assets to have target names, but it also doesn't provide a way to optionally add them. It seems that, since the release of glTF 2.0 in mid-2017, a number of implementation (three.js, the official Blender exporter, UnityGLTF, a and at least one Maya exporter (and probably some others software, I haven't made a list, these are the few I'm aware of)). This has been discussed in issue KhronosGroup#1036. The goal is to help implementations that wants to do so have a way to do so in an interoperably way. Currently this has been done by adding a `targetNames` extras properties to the object. Maybe a more proper way would be to have an extension doing so, however, this practice is already quite widespread, so I would argue that at least documenting it here and integrate a better (and standardized) way of doing so in glTF 2.x/3.0 is the better thing to do. I am not opposed to the idea of writing an extension to support morph target names, but that would add 2 *not really standard* way of doing it instead of the one already out in the wild.
I've opened PR #1631. If you agree that's a good idea, we can go discuss the actual wording to add to the document here. |
Implementation note (#1631) has been merged. Leaving this issue open under the "glTF Next" milestone, so that we can consider something in the spec when we get there. |
It's not unusual to name morph targets so artists and programmers can refer to them by name, not index. An example in Blender:
But I don't see how 2.0 supports morph target names (https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets). It seems it does not. Any thoughts on this?
The text was updated successfully, but these errors were encountered: