You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Blender 3.5.0
# www.blender.org
mtllib cube.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
vn -0.0000 1.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vt 0.625000 0.500000
vt 0.375000 0.500000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.875000 0.500000
vt 0.625000 0.250000
vt 0.125000 0.500000
vt 0.375000 0.250000
vt 0.875000 0.750000
vt 0.625000 1.000000
vt 0.625000 0.000000
vt 0.375000 1.000000
vt 0.375000 0.000000
vt 0.125000 0.750000
s 0
usemtl Material
f 1/1/1 5/5/1 7/9/1 3/3/1
f 4/4/2 3/3/2 7/10/2 8/12/2
f 8/13/3 7/11/3 5/6/3 6/8/3
f 6/7/4 2/2/4 4/4/4 8/14/4
f 2/2/5 1/1/5 3/3/5 4/4/5
f 6/8/6 5/6/6 1/1/6 2/2/6
And load it with tobj:
let model = tobj::load_obj("assets/cube.obj",&tobj::LoadOptions::default()).context("failed to load mesh from obj file")// Discard material information.map(|(meshes, _)| meshes)?
// Get first model only.into_iter().next().ok_or(eyre!("obj file does not contain a model"))?;dbg!(&model.mesh.positions);
Note how the second vertex in this output does not match the second vertex from the OBJ file.
The vertices (and all other data) is re-ordered according to the order they are used by the list of faces even though I did not specify any reordering. To me this is very unexpected and it leads to problems if I e.g. re-export the obj after some manipulation and an outside application expects the order to stay constant - or if you want to debug something and want to use vertex ids to identify them in an outside application.
Am I using the library wrong or is this undocumented intentional behavior?
I exported the default cube from Blender:
cube.obj
And load it with tobj:
However, I get the following output:
dbg!(&model.mesh.positions);
Note how the second vertex in this output does not match the second vertex from the OBJ file.
The vertices (and all other data) is re-ordered according to the order they are used by the list of faces even though I did not specify any reordering. To me this is very unexpected and it leads to problems if I e.g. re-export the obj after some manipulation and an outside application expects the order to stay constant - or if you want to debug something and want to use vertex ids to identify them in an outside application.
Am I using the library wrong or is this undocumented intentional behavior?