FBX Export: Fix export of meshes with polygons in different order to loops #104498

Merged
Bastien Montagne merged 1 commits from Mysteryem/blender-addons:fbx_fix_unsorted_loop_start_pr into main 2023-03-21 12:06:23 +01:00
Member

It was being incorrectly assumed that polygons should always be in the same order as loops.
Exporting such a mesh would raise an error during the export or rarely export geometry layers assigned to the wrong polygons.

Polygons and per-polygon data are now sorted into the same order as loops.

In most cases, polygons will already be in the same order as loops, so this will only add about 0.6ms per 1M polygons exported to the export duration due to a single order check per mesh. With many smaller individual meshes this increases, due to overhead per mesh, up to about 6ms per 1M polygons when each mesh has only 1000 polygons.

In the case where the polygons of a mesh need to be sorted, the main cost is an upfront sorting cost:
For polygons almost already in order, this is about 0.05ms to 0.6ms to 35ms for 100_000, 1M and 10M polygons respectively.
For polygons in random order, this is about 6ms to 85ms to 1300ms for 100_000, 1M and 10M polygons respectively.
There is an additional cost per per-polygon data array to be sorted in the same way, which is about 1ms per 1M polygons per number of arrays to be sorted. There is currently a maximum of two such arrays to be sorted per mesh.

It was being incorrectly assumed that polygons should always be in the same order as loops. Exporting such a mesh would raise an error during the export or rarely export geometry layers assigned to the wrong polygons. Polygons and per-polygon data are now sorted into the same order as loops. In most cases, polygons will already be in the same order as loops, so this will only add about 0.6ms per 1M polygons exported to the export duration due to a single order check per mesh. With many smaller individual meshes this increases, due to overhead per mesh, up to about 6ms per 1M polygons when each mesh has only 1000 polygons. In the case where the polygons of a mesh need to be sorted, the main cost is an upfront sorting cost: For polygons almost already in order, this is about 0.05ms to 0.6ms to 35ms for 100_000, 1M and 10M polygons respectively. For polygons in random order, this is about 6ms to 85ms to 1300ms for 100_000, 1M and 10M polygons respectively. There is an additional cost per per-polygon data array to be sorted in the same way, which is about 1ms per 1M polygons per number of arrays to be sorted. There is currently a maximum of two such arrays to be sorted per mesh.
Thomas Barlow added 1 commit 2023-03-21 04:21:32 +01:00
It was being incorrectly assumed that polygons should always be in the same order as loops.
Exporting such a mesh would raise an error during the export or rarely export geometry layers assigned to the wrong polygons.

Polygons and per-polygon data are now sorted into the same order as loops.

In most cases, polygons will already be in the same order as loops, so this will only add about 0.6ms per 1M polygons exported to the export duration due to a single order check per mesh. With many smaller individual meshes this increases, due to overhead per mesh, up to about 6ms per 1M polygons when each mesh has only 1000 polygons.

In the case where the polygons of a mesh need to be sorted, the main cost is an upfront sorting cost:
For polygons almost already in order, this is about 0.05ms to 0.6ms to 35ms for 100_000, 1M and 10M polygons respectively.
For polygons in random order, this is about 6ms to 85ms to 1300ms for 100_000, 1M and 10M polygons respectively.
There is an additional cost per per-polygon data array to be sorted in the same way, which is about 1ms per 1M polygons per number of arrays to be sorted. There is currently a maximum of two such arrays to be sorted per mesh.
Thomas Barlow requested review from Bastien Montagne 2023-03-21 04:24:25 +01:00
Bastien Montagne approved these changes 2023-03-21 12:06:06 +01:00
Bastien Montagne merged commit 4140febae1 into main 2023-03-21 12:06:23 +01:00
Bastien Montagne deleted branch fbx_fix_unsorted_loop_start_pr 2023-03-21 12:06:23 +01:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 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#104498
No description provided.