0
$\begingroup$

I am loading a set of vertices, a subset of which are part of a triangle mesh that I would like to use blender for per-vertex normal calculation. However, when I export to .obj, the unconnected vertices are thrown away. Is it possible that I can export to .obj format without losing them?

$\endgroup$
2
$\begingroup$

A quick experiment gave the answer to this question, which in short can be solved by changing the OBJ importer settings rather and toggle "Lines" off (since the exporter is fine and does export isolated vertices).

For this test I generated this geometry and exported it to OBJ:

Test geometry

Since an OBJ file is a simple text file, it was possible to open the file and see that the isolated vertex was indeed exported and does exist in the file:

# Blender v2.74 (sub 0) OBJ File: ''
# www.blender.org
mtllib exportToObj_detached_verts.mtl
o Cube
v -1.000000 -1.000000 1.000000
v -1.000000 1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v -1.000000 1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v 1.000000 1.000000 1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -1.000000
v -1.000000 1.000000 -2.031537
v -1.000000 1.000000 -4.031537
v 1.000000 1.000000 -4.031537
v -1.000000 1.000000 3.735121
v -1.000000 1.000000 1.735121
v -1.000000 1.000000 4.733686   # <<< THIS IS OUR ISOLATED VERTEX
vn -1.000000 0.000000 0.000000
vn 0.000000 0.000000 -1.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
usemtl None
s off
f 4//1 3//1 1//1
f 8//2 7//2 3//2
f 6//3 5//3 7//3
f 2//4 1//4 5//4
f 3//5 7//5 5//5
f 8//6 4//6 2//6
f 11//6 10//6 9//6
f 2//1 4//1 1//1
f 4//2 8//2 3//2
f 8//3 6//3 7//3
f 6//4 2//4 5//4
f 1//5 3//5 5//5
f 6//6 8//6 2//6
l 12 13

So this hinted that the problem is not with exporting, but with what happens when you import your exported OBJ file back into Blender. When I imported with the default values the isolated vertex was indeed gone.

To solve this, you can change the importer settings by setting the "Lines" toggle off. This option means that if you have edges that aren't part of faces ("lines" in OBJ jargon), they will still be imported as edges, but isolated vertices that are not part of edges are discarded.

OBJ import settings

If you toggle if off, it will import the isolated vertices and edge verts, but will not create edges:

Import with "Lines" turned off

Bottom line, the OBJ exporter works fine, the importer is the one causing you trouble.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.