X3D Exporter generates duplicate edges and splits the mesh when exporting with Triangulate #49420
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#49420
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
System Information
Windows 10, NVidia GTX 780
Blender Version
Broken: 2.76, 2.78 RC1, 2.78 RC2
Worked: Unknown
Short description of error
When running the x3d exporter with Triangulate enabled some of the vertices in the mesh get saved multiple times resulting in duplicate vertices and edges. The result is a "cut" in the surface that can be opened up by moving one of the duplicate vertices or edges.
The attached screenshot shows the original mesh (to the left, with one of the edges that get duplicated selected) and the mesh after exporting and then reimporting the mesh with Triangulate enabled (to the right) with the "cut" opened to show which edges are being duplicated.
Exact steps for others to reproduce the error
duplicate_edges_repro.blend
Changed status to: 'Open'
Added subscriber: @MichaelStahre
I have already done some analysis of the bug and discovered the following:
In io_scene_x3d/export_x3d.py down by line 750, when the vertices that get duplicated are being stored in vert_tri_list, the key that is stored in vertex_hash is a tuple containing the uv coordinates of that vertex. From my observation there seems to be a risk of some of the faces that are enumerated over that contain the same edges having slightly different UV coordinates stored (which seems like it might be a float precision problem.)
The solution I am using to get around this which seems to work is to replace line 736:
with
Which means I'm really just rounding it down to 7 decimal points, at which point the precision error seems to go away on the meshes I have gotten the problem in.
This might not be the root cause (as it might be a bug that the UV coordinates differ) which is why I am submitting this as a bug rather than a patch.
I am also not sure if there is a reason why the UV coordinates are stored as the key instead of the vertex index (v_idx), it is possible that using that index instead of relying on the UV coordinates might be a better solution.
Added subscribers: @mont29, @Sergey
@mont29, see you in the addon maintainers! ;) Mind having a look here? :)
Added subscriber: @souljedi
The workaround I described turned out to not work for cases where a split is actually intended, since any vertices that are at the same coordinates will end up being merged.
My new approach, which so far seems to work, was to still round the coordinates down to the 7th decimal but to also add the vertex id to the key when matching on uv.
So
instead becomes
And I then just made sure to pass in v_idx to vertex_key when looping through the faces right below in the code.
It's been a while since this was commited, anyone how can find the time to review this? Thanks
sorry to bother. Any updates on this?
any feedback would be greatly appreciated so that we can move forward with other exporter contributions for the blender community.
Sorry to bother again. Any news on this? We submitted it over a year ago.
This issue was referenced by
4ecd2f7a5f
Changed status from 'Open' to: 'Resolved'
Pushed a fix in 2.8's version of the add-on now, based on your solution. No need to use the vertex index though, keys are used in a per-vertex context already.