FBX model import error #84111

Open
opened 2020-12-24 15:16:09 +01:00 by KriegsWolf · 21 comments

System Information
Operating system: Window 10 Pro x64
Graphics card: ASUS Turbo GeForce® RTX 2080 Ti 11GB

Blender Version
Broken: 2.91

Short description of error
This error message pops up when importing FBX models (FBX version:7.5) G_CA_Admiralhipper.fbx

2018.2.14f1 log.zip
And after switching to PMX, I found Morph Tools, missing most of the Vertex Morphs

Python: Traceback (most recent call last):

  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\__init__.py", line 216, in execute
    if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}:
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\import_fbx.py", line 2901, in load
    _(); del _
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\import_fbx.py", line 2899, in _
    keyblocks = blen_read_shape(fbx_tmpl, fbx_sdata, fbx_bcdata, meshes, scene)
  File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\import_fbx.py", line 1388, in blen_read_shape
    assert(len(vgweights) == nbr_indices == len(dvcos))

AssertionError

location: <unknown location>:-1
**System Information** Operating system: Window 10 Pro x64 Graphics card: ASUS Turbo GeForce® RTX 2080 Ti 11GB **Blender Version** Broken: 2.91 **Short description of error** This error message pops up when importing FBX models (FBX version:7.5) [G_CA_Admiralhipper.fbx](https://archive.blender.org/developer/F9528136/G_CA_Admiralhipper.fbx) [2018.2.14f1 log.zip](https://archive.blender.org/developer/F9528141/2018.2.14f1_log.zip) And after switching to PMX, I found Morph Tools, missing most of the Vertex Morphs ``` Python: Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\__init__.py", line 216, in execute if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}: File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\import_fbx.py", line 2901, in load _(); del _ File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\import_fbx.py", line 2899, in _ keyblocks = blen_read_shape(fbx_tmpl, fbx_sdata, fbx_bcdata, meshes, scene) File "C:\Program Files\Blender Foundation\Blender 2.91\2.91\scripts\addons\io_scene_fbx\import_fbx.py", line 1388, in blen_read_shape assert(len(vgweights) == nbr_indices == len(dvcos)) AssertionError location: <unknown location>:-1 ```
Author

Added subscriber: @KriegsWolf

Added subscriber: @KriegsWolf

Added subscriber: @rjg

Added subscriber: @rjg

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

Based on the error message the FBX seems improperly formatted. What software did you use to create it?

Based on the error message the FBX seems improperly formatted. What software did you use to create it?
Author

AssetStudio.v0.15.23
Options as shown
options.jpg

But the output of some models is normal, I don’t know why.

AssetStudio.v0.15.23 Options as shown ![options.jpg](https://archive.blender.org/developer/F9532435/options.jpg) But the output of some models is normal, I don’t know why.

According to their GitHub page they are using the official FBX SDK. We will take another at this.

According to their GitHub page they are using the official FBX SDK. We will take another at this.

Added subscriber: @djwhatley

Added subscriber: @djwhatley
Author

Thank you! Looking forward to the next update.

Thank you! Looking forward to the next update.

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'

Added subscriber: @Vlash

Added subscriber: @Vlash

I found this post after running into this issue myself, and looking to report this. I exported a mesh from unreal engine 4 both 4.25 and 4.26, then hit with the error during import. I have also exported using fbx 2013 and 4014.

Using Windows 10 Pro X64, and Blender 2.92.0

SK_Female_Final.7z

Unreal Engine 4.25 fbx settings
fbx_settings.jpg

Python: Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_scene_fbx\__init__.py", line 216, in execute
    if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}:
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_scene_fbx\import_fbx.py", line 2901, in load
    _(); del _
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_scene_fbx\import_fbx.py", line 2899, in _
    keyblocks = blen_read_shape(fbx_tmpl, fbx_sdata, fbx_bcdata, meshes, scene)
  File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_scene_fbx\import_fbx.py", line 1388, in blen_read_shape
    assert(len(vgweights) == nbr_indices == len(dvcos))
AssertionError

location: <unknown location>:-1

Edit: I found the problem at least for me. Turns out I exporting the morph targets was my issue. If I untick the export morph targets I no longer have an issue importing to blender.

I found this post after running into this issue myself, and looking to report this. I exported a mesh from unreal engine 4 both 4.25 and 4.26, then hit with the error during import. I have also exported using fbx 2013 and 4014. Using Windows 10 Pro X64, and Blender 2.92.0 [SK_Female_Final.7z](https://archive.blender.org/developer/F9912994/SK_Female_Final.7z) Unreal Engine 4.25 fbx settings ![fbx_settings.jpg](https://archive.blender.org/developer/F9912995/fbx_settings.jpg) ``` Python: Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_scene_fbx\__init__.py", line 216, in execute if import_fbx.load(self, context, filepath=path, **keywords) == {'FINISHED'}: File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_scene_fbx\import_fbx.py", line 2901, in load _(); del _ File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_scene_fbx\import_fbx.py", line 2899, in _ keyblocks = blen_read_shape(fbx_tmpl, fbx_sdata, fbx_bcdata, meshes, scene) File "C:\Program Files\Blender Foundation\Blender 2.92\2.92\scripts\addons\io_scene_fbx\import_fbx.py", line 1388, in blen_read_shape assert(len(vgweights) == nbr_indices == len(dvcos)) AssertionError location: <unknown location>:-1 ``` Edit: I found the problem at least for me. Turns out I exporting the morph targets was my issue. If I untick the export morph targets I no longer have an issue importing to blender.

It's definitely the morph targets. I had this error when working with a mesh where I needed the morph targets to be exported, so I tweaked the script to naively pad out the length of vgweights to match the other values, and I ended up with all of the morph targets duplicated about 100 times. Oops. Well, at least I got what I needed, after tediously deleting all the extras.

It's definitely the morph targets. I had this error when working with a mesh where I needed the morph targets to be exported, so I tweaked the script to naively pad out the length of `vgweights` to match the other values, and I ended up with all of the morph targets duplicated about 100 times. Oops. Well, at least I got what I needed, after tediously deleting all the extras.

Added subscriber: @littlebunny

Added subscriber: @littlebunny

I've come across a similar issue, I get the same error in the logs. There's some background in this post - https://forums.unrealengine.com/t/export-from-ue4-with-morph-targets-and-import-to-blender-loses-all-material-slots/253659/2

I need to keep the morph targets in tact at the very least. @djwhatley your script tweak sounds like a potential workaround but my mesh already has over 100 morphs associated with it so it would be a royal pain in the ass to remove 100 duplicates.

Any other solutions?

I've come across a similar issue, I get the same error in the logs. There's some background in this post - https://forums.unrealengine.com/t/export-from-ue4-with-morph-targets-and-import-to-blender-loses-all-material-slots/253659/2 I need to keep the morph targets in tact at the very least. @djwhatley your script tweak sounds like a potential workaround but my mesh already has over 100 morphs associated with it so it would be a royal pain in the ass to remove 100 duplicates. Any other solutions?

Just found a solution using the Autodesk FBX converter - https://answers.unrealengine.com/questions/1011442/ue426-export-to-fbx-with-morphs-to-blenderpython-e.html

It worked perfectly for me

Just found a solution using the Autodesk FBX converter - https://answers.unrealengine.com/questions/1011442/ue426-export-to-fbx-with-morphs-to-blenderpython-e.html It worked perfectly for me

Oh, very nice! So it sounds to me like this might be a bug in UE4, rather than Blender?

EDIT: I forgot the ticket was originally filed for a different software. Still, the fact that the FBX converter fixes it suggests that the problem is happening when it is exported, and Blender is capable of handling a properly formatted FBX without issue.

Oh, very nice! So it sounds to me like this might be a bug in UE4, rather than Blender? EDIT: I forgot the ticket was originally filed for a different software. Still, the fact that the FBX converter fixes it suggests that the problem is happening when it is exported, and Blender is capable of handling a properly formatted FBX without issue.

In #84111#1229747, @littlebunny wrote:
Just found a solution using the Autodesk FBX converter - https://answers.unrealengine.com/questions/1011442/ue426-export-to-fbx-with-morphs-to-blenderpython-e.html

It worked perfectly for me

I too used this method and can confirm it works. If I'm not mistaken, what happens is the morphs are converted to shape keys.

Thanks for posting the solution Amy.

> In #84111#1229747, @littlebunny wrote: > Just found a solution using the Autodesk FBX converter - https://answers.unrealengine.com/questions/1011442/ue426-export-to-fbx-with-morphs-to-blenderpython-e.html > > It worked perfectly for me I too used this method and can confirm it works. If I'm not mistaken, what happens is the morphs are converted to shape keys. Thanks for posting the solution Amy.
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

FullWeights contains only 2 elements in this case, being (0.5, 1.0). I am not sure if that means the file is corrupt, the values are retrieved wrong, or is it just another special case like d0425df1ef.

`FullWeights` contains only 2 elements in this case, being (0.5, 1.0). I am not sure if that means the file is corrupt, the values are retrieved wrong, or is it just another special case like d0425df1ef.

I get the same issue every time I am trying to import FBX file exported from unreal engine and which contains morph targets. I have done some research.

Cause Autodesk FBX converter fixes the issue I tried to take a look at the same files before and after the converter.
Before converter vgweights has len of 2 and the last number is exetremelly small while after converter the vgweights has the same size as indices values in vgweights are equal to the first value of vgweights before the converter. So I have extended the special rule for this case before assert:

# Special case, in case all weights are the same, FullWeight can have only one element - *sigh!*
nbr_indices = len(indices)
if len(vgweights) == 1 and nbr_indices > 1 or len(vgweights) == 2 and vgweights[1] < 1e-10:
    vgweights = np.full_like(indices, vgweights[0], dtype=vgweights.dtype)

assert(len(vgweights) == nbr_indices == len(dvcos))

The code above solve the problem for me, but I am not sure that it is a general case.

I have tried solution from 6b5acc2aeb but it does not work in my case. I dont get error while import, but shape keys does nothing cause the weights were initialized as zeros, see below

# Special case for trimmed weights with trailing zeroes
if len(vgweights) != nbr_indices:
    # Pad with zeros
    new_vgweights = np.zeros_like(indices, dtype=vgweights.dtype)
    n = min(len(vgweights), nbr_indices)
    new_vgweights[:n] = vgweights[:n]
    vgweights = new_vgweights

My system info:
version: 4.0.1, branch: blender-v4.0-release, commit date: 2023-11-16 16:40, hash: d0dd92834a08, type: release
build date: 2023-11-17, 00:36:52
platform: 'Windows-10-10.0.19045-SP0'

I get the same issue every time I am trying to import FBX file exported from unreal engine and which contains morph targets. I have done some research. Cause Autodesk FBX converter fixes the issue I tried to take a look at the same files before and after the converter. Before converter `vgweights` has len of 2 and the last number is exetremelly small while after converter the `vgweights` has the same size as `indices` values in `vgweights` are equal to the first value of `vgweights` before the converter. So I have extended the special rule for this case before assert: ``` # Special case, in case all weights are the same, FullWeight can have only one element - *sigh!* nbr_indices = len(indices) if len(vgweights) == 1 and nbr_indices > 1 or len(vgweights) == 2 and vgweights[1] < 1e-10: vgweights = np.full_like(indices, vgweights[0], dtype=vgweights.dtype) assert(len(vgweights) == nbr_indices == len(dvcos)) ``` The code above solve the problem for me, but I am not sure that it is a general case. I have tried solution from [6b5acc2aeb](https://projects.blender.org/blender/blender-addons/commit/6b5acc2aebff63aad548cd2e9e06e6d25d4c5d82) but it does not work in my case. I dont get error while import, but shape keys does nothing cause the weights were initialized as zeros, see below ``` # Special case for trimmed weights with trailing zeroes if len(vgweights) != nbr_indices: # Pad with zeros new_vgweights = np.zeros_like(indices, dtype=vgweights.dtype) n = min(len(vgweights), nbr_indices) new_vgweights[:n] = vgweights[:n] vgweights = new_vgweights ``` My system info: version: 4.0.1, branch: blender-v4.0-release, commit date: 2023-11-16 16:40, hash: d0dd92834a08, type: release build date: 2023-11-17, 00:36:52 platform: 'Windows-10-10.0.19045-SP0'
Sign in to join this conversation.
No Milestone
No project
No Assignees
7 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#84111
No description provided.