FBX IO: Export normals with IndexToDirect reference mode #105020
No reviewers
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#105020
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Mysteryem/blender-addons:fbx_normals_IndexToDirect"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The FBX SDK documentation says that normals should be IndexToDirect
mapped. 9 years ago, we didn't export with IndexToDirect mode because
apps at the time didn't support it well.
9 years is a long time and the apps I've tried all work with
IndexToDirect, so the export of normals has been updated to use the
IndexToDirect mode, using the already existing, but disabled code.
This will slightly increase export times, and will slightly increase
exported file size in cases that don't have lots of duplicate normals.
In the worst case scenario of exporting only geometry with the 'CORNER'
normals domain and nothing else, exports can be about 1.28 times slower
and result in a about a 1.08 times larger file size.
The FBX importer was not previously set up to handle the import of
ByVertice-IndexToDirect normals, so this has been added to ensure that
the normals of FBX IO exported .fbx files are imported correctly.
If older versions of FBX IO attempt to import ByVertice-IndexToDirect
normals, a warning will be printed to the System Console that the
mapping type and ref type are not supported and custom normals will not
be set. However, the normals of the imported mesh will still match the
expected imported normals because they are the same as the imported
mesh's vertex normals. This is only applicable to ByVertice normals
exported by FBX IO, because they are only exported when
Mesh.normals_domain
is'POINT'
, which requires no sharp edges, nosharp faces and no custom normals.
FBX SDK documentation specifies in the normals layer's detailed description that it should use IndexToDirect, though it does not elaborate on why: https://help.autodesk.com/view/FBX/2020/ENU/?guid=FBX_Developer_Help_cpp_ref_class_fbx_layer_element_normal_html
This isn't a strictly necessary change, since the Direct reference mode seems to be working fine in external apps, but it at least gets rid of having some code commented out by
if 0:
.The worst case scenario for export duration I could come up with is exporting plain geometry with no extra layers, but with custom normals, so that corner normals (the largest normals domain) are exported. In that case, export duration is 1.28 times slower:
Exporting 16 default cubes each subdivided 6 times and with custom normals:
Before: 0.59s
After: 0.75s
1.28 times slower and 1.08 times larger file size.
My typical rigged character model exports are around 1.02 to 1.04 times slower, with export times before ranging from about 3.0s to 0.2s respectively. The larger exports tend to have more data to export that isn't normals, so they are comparatively less affected.
WIP: FBX IO: Export normals with IndexToDirect reference modeto FBX IO: Export normals with IndexToDirect reference modeLGTM
I've added an extra paragraph to the description clarifying the behaviour of importing ByVertice-IndexToDirect normals with older versions of the FBX IO addon (reproduced below). Simply put, the normals of the imported mesh will be as expected, but custom normals will not be set.