Skip to content

Wrong attributes JOINTS_0 and WEIGHTS_0 on skin export, re-import graphical issue #45

@anonymous2585

Description

@anonymous2585

Describe the bug
I have an FBX file in my Unity asset containing a skin with only 2 bones:
Image

When I export it, the glb produced has validation errors for attributes JOINT_0 and WEIGHTS_0:

Invalid accessor format '{VEC2, FLOAT}' for this attribute semantic. Must be one of ('{VEC4, FLOAT}', '{VEC4, UNSIGNED_BYTE normalized}', '{VEC4, UNSIGNED_SHORT normalized}').glTF Validator(MESH_PRIMITIVE_ATTRIBUTES_ACCESSOR_INVALID_FORMAT)

When the glb is re-imported as an asset with glTFast importer, the skin goes crazy:
Image

To Reproduce
Steps to reproduce the behavior:

  1. Add the FBX file in your project assets SkinIssue.zip
  2. Place the model in an empty scene
  3. Select the model root in hierarchy, and use menu "GameObject => Export glTF => glTF-Binary (.glb)"
  4. Save the file in your project asset
  5. See Unity internal error "Bone index is not within the number of bones."
  6. Remove the FBX model from the scene and place the glb model in scene
  7. See incorrect mesh rendering

Expected behavior
=> When exported, the glb JOINT_0 and WEIGHTS_0 point to accessors of type "VEC4".
=> When re-imported, the glb displays exactly as the source FBX

Desktop (please complete the following information):

  • glTFast version 6.17.0
  • Unity Editor version 6000.0.71f1

Additional context
The attribute dimension is 2 in this case, but glTF spec want it to be always exactly 4 bones, see glTF 2.0 spec chapter 3.7.3.3:

The number of joints that influence one vertex is limited to 4 per set, so the referenced accessors
MUST have VEC4 type and following component types [...]

It is needed to pad the attribute accessor during export, because this Unity mesh return accessors with only 2 dimension:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions