FBX export error because of invalid NaN UV values. #102783

Closed
opened 2022-11-26 02:05:33 +01:00 by Paul Kotelevets · 28 comments

System Information
Operating system: Linux-4.15.0-51-generic-x86_64-with-glibc2.27 64 Bits
Graphics card: GeForce GTX 850M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 390.143

Blender Version
Broken: version: 3.3.1, branch: master, commit date: 2022-10-04 18:35, hash: b292cfe5a9
Worked: never

Short description of error
Export of an element from attached file in FBX format cause error until UV is not removed.
Tested on 3.2, 3.3.1, 2.79

3.2 fbx error.blend

Python: Traceback (most recent call last):
  File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\__init__.py", line 655, in execute
    return export_fbx_bin.save(self, context, **keywords)
  File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3243, in save
    ret = save_single(operator, context.scene, depsgraph, filepath, **kwargs_mod)
  File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3134, in save_single
    fbx_objects_elements(root, scene_data)
  File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 2932, in fbx_objects_elements
    fbx_data_mesh_elements(objects, me_obj, scene_data, done_meshes)
  File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 1179, in fbx_data_mesh_elements
    elem_data_single_int32_array(lay_uv, b"UVIndex", (uv2idx[uv_id] for uv_id in _uvtuples_gen(t_luv, t_lvidx)))
  File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\fbx_utils.py", line 494, in elem_data_single_int32_array
    return _elem_data_single(elem, name, value, "add_int32_array")
  File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\fbx_utils.py", line 441, in _elem_data_single
    getattr(sub_elem, func_name)(value)
  File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\encode_bin.py", line 143, in add_int32_array
    data = array.array(data_types.ARRAY_INT32, data)
  File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 1179, in <genexpr>
    elem_data_single_int32_array(lay_uv, b"UVIndex", (uv2idx[uv_id] for uv_id in _uvtuples_gen(t_luv, t_lvidx)))
KeyError: ((nan, nan), 34)
**System Information** Operating system: Linux-4.15.0-51-generic-x86_64-with-glibc2.27 64 Bits Graphics card: GeForce GTX 850M/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 390.143 **Blender Version** Broken: version: 3.3.1, branch: master, commit date: 2022-10-04 18:35, hash: `b292cfe5a9` Worked: never **Short description of error** Export of an element from attached file in FBX format cause error until UV is not removed. Tested on 3.2, 3.3.1, 2.79 [3.2 fbx error.blend](https://archive.blender.org/developer/F13969916/3.2_fbx_error.blend) ```lines=10 Python: Traceback (most recent call last): File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\__init__.py", line 655, in execute return export_fbx_bin.save(self, context, **keywords) File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3243, in save ret = save_single(operator, context.scene, depsgraph, filepath, **kwargs_mod) File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 3134, in save_single fbx_objects_elements(root, scene_data) File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 2932, in fbx_objects_elements fbx_data_mesh_elements(objects, me_obj, scene_data, done_meshes) File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 1179, in fbx_data_mesh_elements elem_data_single_int32_array(lay_uv, b"UVIndex", (uv2idx[uv_id] for uv_id in _uvtuples_gen(t_luv, t_lvidx))) File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\fbx_utils.py", line 494, in elem_data_single_int32_array return _elem_data_single(elem, name, value, "add_int32_array") File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\fbx_utils.py", line 441, in _elem_data_single getattr(sub_elem, func_name)(value) File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\encode_bin.py", line 143, in add_int32_array data = array.array(data_types.ARRAY_INT32, data) File "C:\Users\prati\OneDrive\Desktop\BlenderOSP\2022_lite_ninja\bin\3.5\scripts\addons\io_scene_fbx\export_fbx_bin.py", line 1179, in <genexpr> elem_data_single_int32_array(lay_uv, b"UVIndex", (uv2idx[uv_id] for uv_id in _uvtuples_gen(t_luv, t_lvidx))) KeyError: ((nan, nan), 34) ```

Added subscriber: @1D_Inc

Added subscriber: @1D_Inc

blender/blender-addons#103583 was marked as duplicate of this issue

blender/blender-addons#103583 was marked as duplicate of this issue

#103476 was marked as duplicate of this issue

#103476 was marked as duplicate of this issue

Screenshot of an error
image.png

Screenshot of an error ![image.png](https://archive.blender.org/developer/F13969922/image.png)
Contributor

Added subscriber: @scurest

Added subscriber: @scurest
Contributor

Cf #79775

Cf #79775
Member

Added subscribers: @lichtwerk, @PratikPB2123

Added subscribers: @lichtwerk, @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

@lichtwerk , looks like issue #79775 is not resolved yet

@lichtwerk , looks like issue #79775 is not resolved yet
Member

Added subscriber: @96artem1

Added subscriber: @96artem1
Contributor

Removed subscriber: @scurest

Removed subscriber: @scurest
Member

Added subscribers: @JJC, @mod_moder

Added subscribers: @JJC, @mod_moder

Added subscriber: @Mysteryem-2

Added subscriber: @Mysteryem-2

Added subscriber: @mont29

Added subscriber: @mont29

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

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

For the records, this is NOT an issue in the FBX code, but in Blender, as stated in #79775, there should be no NaN values in mesh data, this is no valid data.

Would also be good to have info about how that .blend file was generated, we cannot handle data corruption cases just by getting the end result usually, we need steps to reproduce such data corruption.

For the records, this is NOT an issue in the FBX code, but in Blender, as stated in #79775, there should be no NaN values in mesh data, this is no valid data. Would also be good to have info about how that .blend file was generated, we cannot handle data corruption cases just by getting the end result usually, we need steps to reproduce such data corruption.
Bastien Montagne changed title from FBX export error because of UV to FBX export error because of invalid NaN UV values. 2023-01-23 15:35:10 +01:00

Such cases are extremely rare, it is hard to find the exact actions sequence. So, this is because of invalid mesh data.
Is it possible to detect such data with a special function?

Such cases are extremely rare, it is hard to find the exact actions sequence. So, this is because of invalid mesh data. Is it possible to detect such data with a special function?

Thank you for your reply~ I couldn't solve the problem, so I recreated it and worked on it. ~^^;;

Thank you for your reply~ I couldn't solve the problem, so I recreated it and worked on it. ~^^;;

@1D_Inc Mesh.validate() should catch and fix these now, at least in master (not sure when UVMaps where moved to the new generic attribute system, old UVMaps did not check for invalid number values, new float attributes do).

@1D_Inc [Mesh.validate()](https://docs.blender.org/api/master/bpy.types.Mesh.html#bpy.types.Mesh.validate) should catch and fix these now, at least in master (not sure when UVMaps where moved to the new generic attribute system, old UVMaps did not check for invalid number values, new float attributes do).

Sorry, but what is 'invalid NaN UV values'~?

Sorry, but what is 'invalid NaN UV values'~?

'NaN' is a short for 'Not a Number', a computer way to represent invalid/'impossible' numbers, like e.g. the result of a division by zero. Such values should never exist in Blender mesh data.

'NaN' is a short for '[Not a Number](https://en.wikipedia.org/wiki/NaN)', a computer way to represent invalid/'impossible' numbers, like e.g. the result of a division by zero. Such values should never exist in Blender mesh data.

When I tried to merge 10 pieces and export them, I got an error. Is it possible that this problem may occur in the process of merging mash~? Or can it be caused by not doing UV unwrap~?

When I tried to merge 10 pieces and export them, I got an error. Is it possible that this problem may occur in the process of merging mash~? Or can it be caused by not doing UV unwrap~?
Philipp Oeser removed the
Interest
Modeling
label 2023-02-09 15:27:09 +01:00
Member

I thought issue is in FBX code. So the mesh itself is corrupted.
Mesh.validate() indeed fixes the problem. @1D_Inc , can you verify too?

Would also be good to have info about how that .blend file was generated, we cannot handle data corruption cases just by getting the end result usually, we need steps to reproduce such data corruption.

Perhaps we can close the report if above information is not available.

I thought issue is in FBX code. So the mesh itself is corrupted. `Mesh.validate()` indeed fixes the problem. @1D_Inc , can you verify too? > Would also be good to have info about how that .blend file was generated, we cannot handle data corruption cases just by getting the end result usually, we need steps to reproduce such data corruption. Perhaps we can close the report if above information is not available.

Thanks for the reply.^^ I wanted to know what was causing the problem and solve it, but now I can't. Because It seems that I deleted the blender file ( having problems) while cleaning up the folder~;; If I have the same problem again, I'll contact you again. Thank you~!

Thanks for the reply.^^ I wanted to know what was causing the problem and solve it, but now I can't. Because It seems that I deleted the blender file ( having problems) while cleaning up the folder~;; If I have the same problem again, I'll contact you again. Thank you~!
Member

Mesh.validate() indeed fixes the problem. @1D_Inc , can you verify too?

Would also be good to have info about how that .blend file was generated, we cannot handle data corruption cases just by getting the end result usually, we need steps to reproduce such data corruption.

Perhaps we can close the report if above information is not available.

@1D_Inc hi, any updates on this?

> `Mesh.validate()` indeed fixes the problem. @1D_Inc , can you verify too? > > > Would also be good to have info about how that .blend file was generated, we cannot handle data corruption cases just by getting the end result usually, we need steps to reproduce such data corruption. > > Perhaps we can close the report if above information is not available. @1D_Inc hi, any updates on this?

@PratikPB2123 hi. It is hard to say.
Can fbx export verify meshes before actual export to achieve the solution that doesnot require programming skills at the user side?

@PratikPB2123 hi. It is hard to say. Can fbx export verify meshes before actual export to achieve the solution that doesnot require programming skills at the user side?

For example, different software has "Audit" function which allow to checks and validate the scenes content in cases when such kind of error occurs.

For example, different software has "Audit" function which allow to checks and validate the scenes content in cases when such kind of error occurs.
Member

Can fbx export verify meshes before actual export to achieve the solution that doesnot require programming skills at the user side?

I'm not sure if this is possible.

checks and validate the scenes content in cases when such kind of error occurs.

In some cases, spreadsheet can help to identify the problem

Will close this report for now since the culprit is corrupted mesh and not the FBX export code.

"how you end up with corrupted mesh"

maybe we can track this in a separate report when you find necessary info.

> Can fbx export verify meshes before actual export to achieve the solution that doesnot require programming skills at the user side? I'm not sure if this is possible. > checks and validate the scenes content in cases when such kind of error occurs. In some cases, spreadsheet can help to identify the problem Will close this report for now since the culprit is corrupted mesh and not the FBX export code. > "how you end up with corrupted mesh" maybe we can track this in a separate report when you find necessary info.
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2023-05-16 15:26:27 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
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#102783
No description provided.