trimesh icon indicating copy to clipboard operation
trimesh copied to clipboard

OBJ loading and export causing self-intersections

Open kampelmuehler opened this issue 3 years ago • 5 comments

I do have an obj file representing the following geometry

grafik

when I load this obj file with trimesh and export it again directly the mesh will have defects. This is what Meshlab shows when I run "select self intersecting faces":

grafik

Those defects are also represented as entities in mesh.outline(). For the original mesh in Meshlab the selection remains empty.

If I first convert the obj to ply in Meshlab, then load and export in trimesh no such "self intersections" are created. I write "self intersections" because really they are not visibly self intersections.

What might be the issue here?

kampelmuehler avatar Feb 03 '22 07:02 kampelmuehler

Hey, is it possible this is from merging vertices? Does it happen with trimesh.load('thing.obj', process=False)?

mikedh avatar Feb 03 '22 17:02 mikedh

Unfortunately this does not change behavior.

kampelmuehler avatar Feb 09 '22 07:02 kampelmuehler

Can you provide the before and after files?

mikedh avatar Feb 09 '22 15:02 mikedh

sample.zip

Here's how I generated them (sample.obj is the original): trimesh.load('sample.obj', process=False).export('sample_no_process.obj') trimesh.load('sample.obj').export('sample_process.obj')

kampelmuehler avatar Feb 10 '22 07:02 kampelmuehler

Thanks for the models! I'm not sure what's going on here as this is a somewhat complicated interleaved file, but I did notice if you load with m = trimesh.load('sample.obj', process=False, maintain_order=True) it has a lot more vertices and renders more nicely.

mikedh avatar Feb 10 '22 14:02 mikedh