Page MenuHome

Mesh tool to 'unsplit' while preserving custom normals
Open, NormalPublic

Description

Some exporter generate split geometry to preserve 'sharp edges' (like Blender used to do not so long ago). However, now that we support custom normals, it would be nice to have e.g. an object-mode 'unsplit' modifier to remove doubles while preserving custom normals.

See T47540 for a usecase.

Details

Event Timeline

Bastien Montagne (mont29) raised the priority of this task from to Normal.
Bastien Montagne (mont29) updated the task description. (Show Details)
Bastien Montagne (mont29) set Type to Bug.
Bastien Montagne (mont29) changed Type from Bug to To Do.

So
Add Modifier --> remove doubles , that's as far as I got.
how would this work? Can I get more details? Is there something that currently works like a manual process that this would automate?

Hi! Has anyone done work on this? I'm a beginning developer and I'd like to give this task a go. I have @Robert Fornof (amdbcg)'s question also: Does the modifier need to do anything besides remove doubles?

Hey everyone - I'm new here, and I'm looking to complete this task. I have a patch that I believe should resolve this. To minimize redundant code, I added some small functionality to the existing weld_verts bmesh operation, where I mark edges that become duplicates after merging vertices as sharp edges. I've also added an "Unsplit Vertices" object-mode modifier, which basically performs the remove doubles bmesh operations with auto smooth enabled. This works well for the meshes that I've tried. In particular, this works nicely for the mesh in T47540. I'm curious about what people think of this solution. I'll submit my patch via the patch submission webpage.

I have looked into this over the past few days.

Seeing no reason why the regular remove doubles and merge vertices operations should not preserve custom normals, I tried to figure out what was going on. It seems that it is not caused by the merging itself, but rather by the addition/removal of faces as part of the merging process. The simple act of deleting a face via "Mesh > Delete > Only Faces" changes the custom vertex normals of adjacent vertices. This seems very surprising to me, as for each vertex, there is exactly one custom vertex normal per face it is part of. Given a vertex surrounded by 6 faces, I would have expected that deleting one face would cause the corresponding vertex-per-face normal to disappear, while leaving the other 5 vertex-per-face normals untouched.

I have looked at the BM_face_kill function to try and figure out what was going on. However, I could not see any reason for why the other vertex-per-face normals would be affected, as all it seems to do is delete the custom data for the face and its loops.

At this point, I feel like there might be some fundamental misunderstanding on my part about how custom split normals work. I am willing to look into this further, but could use some pointers on what is going on and if/where I am mistaken.