FBX not importing some shapekeys #104909

Closed
opened 2023-09-23 22:02:20 +02:00 by Jesse Yurkovich · 6 comments

System Information
Operating system: Windows-10-10.0.22621-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 4090/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 528.24

Blender Version
Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-09-22 23:32, hash: 7c636c170273
Worked: (newest version of Blender that worked as expected)

Addon Information
Name: FBX format (5, 8, 1)
Author: Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem

Short description of error
Not importing shapekeys from some FBX files. Output:

FBX version: 7300
Traceback (most recent call last):
  File "/home/miha/blender-4.0.0-alpha+main.42ddeeadebbb-linux.x86_64-release/4.0/scripts/addons/io_scene_fbx/__init__.py", line 209, in execute
    if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}:
  File "/home/miha/blender-4.0.0-alpha+main.42ddeeadebbb-linux.x86_64-release/4.0/scripts/addons/io_scene_fbx/import_fbx.py", line 3521, in load
    _(); del _
  File "/home/miha/blender-4.0.0-alpha+main.42ddeeadebbb-linux.x86_64-release/4.0/scripts/addons/io_scene_fbx/import_fbx.py", line 3518, in _
    for bc_uuid, keyblocks in blen_read_shapes(fbx_tmpl, shapes, objects, bl_mdata, scene).items():
  File "/home/miha/blender-4.0.0-alpha+main.42ddeeadebbb-linux.x86_64-release/4.0/scripts/addons/io_scene_fbx/import_fbx.py", line 1964, in blen_read_shapes
    assert(len(vgweights) == nbr_indices == len(dvcos))
AssertionError

Exact steps for others to reproduce the error
File -> Import -> Import FBX
MaleFace.FBX (sorry for a too big file example)

This was originally blender/blender#112793

**System Information** Operating system: Windows-10-10.0.22621-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 4090/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 528.24 **Blender Version** Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-09-22 23:32, hash: `7c636c170273` Worked: (newest version of Blender that worked as expected) **Addon Information** Name: FBX format (5, 8, 1) Author: Campbell Barton, Bastien Montagne, Jens Restemeier, @Mysteryem **Short description of error** Not importing shapekeys from some FBX files. Output: ``` FBX version: 7300 Traceback (most recent call last): File "/home/miha/blender-4.0.0-alpha+main.42ddeeadebbb-linux.x86_64-release/4.0/scripts/addons/io_scene_fbx/__init__.py", line 209, in execute if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}: File "/home/miha/blender-4.0.0-alpha+main.42ddeeadebbb-linux.x86_64-release/4.0/scripts/addons/io_scene_fbx/import_fbx.py", line 3521, in load _(); del _ File "/home/miha/blender-4.0.0-alpha+main.42ddeeadebbb-linux.x86_64-release/4.0/scripts/addons/io_scene_fbx/import_fbx.py", line 3518, in _ for bc_uuid, keyblocks in blen_read_shapes(fbx_tmpl, shapes, objects, bl_mdata, scene).items(): File "/home/miha/blender-4.0.0-alpha+main.42ddeeadebbb-linux.x86_64-release/4.0/scripts/addons/io_scene_fbx/import_fbx.py", line 1964, in blen_read_shapes assert(len(vgweights) == nbr_indices == len(dvcos)) AssertionError ``` **Exact steps for others to reproduce the error** File -> Import -> Import FBX [MaleFace.FBX](/attachments/dea088f2-f973-4326-a22b-d0b0d9b6bfe7) (sorry for a too big file example) This was originally https://projects.blender.org/blender/blender/issues/112793
Jesse Yurkovich added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2023-09-23 22:02:20 +02:00

Have some issues posting it as a pull request. Here's diff. The example file causes not only the Assertion error, but also creates millions of duplicated shapekeys. The patch avoids it as well by storing only unique keys in a dictionary.

Have some issues posting it as a pull request. Here's diff. The example file causes not only the Assertion error, but also creates millions of duplicated shapekeys. The patch avoids it as well by storing only unique keys in a dictionary.
Member

Should be a duplicate of #84111.

More info at #104698.

Should be a duplicate of #84111. More info at #104698.

Indeed. The provided diff fixes #84111 as well.

Indeed. The provided diff fixes #84111 as well.
Member

The example file causes not only the Assertion error, but also creates millions of duplicated shapekeys. The patch avoids it as well by storing only unique keys in a dictionary.

One of the other cases of this issue had the same result which was caused by each mesh having a connection to the entire group of shape keys for what looked like every single shape key (over 600), when there should only have been one connection, so the shape keys presumably end up being imported over 600 times.

This is probably why importing the file into Unity takes an excessively long time and uses a lot of RAM. Though Unity either doesn't create new blend shapes with the same name, or overwrites the existing blend shapes with the same name, so unlike Blender, the size of the final imported mesh doesn't grow to astronomical proportions from trying to create 360000 (600*600) or so shape keys.

Screenshots from the .fbx converted to .json with the fbx2json.py script:
image
image
image

Additionally, the FullWeights arrays are a mess, with each one having 2 entries where the second entry is a tiny negative number, e.g. ["FullWeights", [[100.0, -4.101866001968969e-270]], "d", []]]],, yet, the shapes assigned to each FullWeight are the same shape.

I'm of the opinion that Unreal's at fault here because there's just so much wrong with the file and FBX Review imports the file beautifully: image

Also, the provided traceback doesn't match this MaleFace.fbx file because it's FBX Version 7700 whereas the traceback has version 7300.

> The example file causes not only the Assertion error, but also creates millions of duplicated shapekeys. The patch avoids it as well by storing only unique keys in a dictionary. One of the other cases of this issue had the same result which was caused by each mesh having a connection to the entire group of shape keys for what looked like every single shape key (over 600), when there should only have been one connection, so the shape keys presumably end up being imported over 600 times. This is probably why importing the file into Unity takes an excessively long time and uses a lot of RAM. Though Unity either doesn't create new blend shapes with the same name, or overwrites the existing blend shapes with the same name, so unlike Blender, the size of the final imported mesh doesn't grow to astronomical proportions from trying to create 360000 (600*600) or so shape keys. Screenshots from the .fbx converted to .json with the `fbx2json.py` script: ![image](/attachments/b19dd0c0-eb8c-427f-81d3-47f53b29e3df) ![image](/attachments/adb636c5-ec74-458a-930a-cb3409237a07) ![image](/attachments/ccfd87d0-2c4a-4cf3-a1f4-0912e50fb540) Additionally, the `FullWeights` arrays are a mess, with each one having 2 entries where the second entry is a tiny negative number, e.g. `["FullWeights", [[100.0, -4.101866001968969e-270]], "d", []]]],`, yet, the shapes assigned to each FullWeight are the same shape. I'm of the opinion that Unreal's at fault here because there's just so much wrong with the file and FBX Review imports the file beautifully: ![image](/attachments/244c3997-0268-4823-b310-9cd78d63ac25) Also, the provided traceback doesn't match this `MaleFace.fbx` file because it's FBX Version 7700 whereas the traceback has version 7300.

Yes, I have two different files with the same issue. Another one is also exported from Unreal. It is Unreal's fault or may be they are trying to encode or hide something here. At least for my purposes I found that being able to import at least something (I mean animation data) is better than nothing.

Yes, I have two different files with the same issue. Another one is also exported from Unreal. It is Unreal's fault or may be they are trying to encode or hide something here. At least for my purposes I found that being able to import at least something (I mean animation data) is better than nothing.
Member

Closing this as duplicate of #84111
Thanks for the report.

Closing this as duplicate of https://projects.blender.org/blender/blender-addons/issues/84111 Thanks for the report.
Blender Bot added
Status
Archived
and removed
Status
Needs Triage
labels 2023-09-27 07:19:09 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#104909
No description provided.