Closed virtualritz closed 4 years ago
Thanks for reporting this. It happens on Windows too, with this OBJ.
There's something about that OBJ that vtkOBJReader doesn't like. If I import the OBJ into MeshLab and then export it back to OBJ with just verts and faces then it works fine in Ready. (Try: knotty01_recoded.zip)
Looking at the code for vtkOBJReader.cxx, it makes sense - it doesn't support the f 1// 6// 1343// 1296//
format that your OBJ uses.
~I'll take a look at filing this as a bug in VTK.~ In the meanwhile you have a workaround - either re-encode the OBJ or try a different format.
And just a note to say that for best results in Ready you probably want to subdivide your mesh a little first. e.g. in MeshLab:
Filters > Remeshing... > Turn Into a Pure-Triangle Mesh
Filters > Remeshing... > Subdivision Surfaces: Loop
Of course Ready shouldn't crash. And looking into this a bit more, it seems we should be catching these sorts of errors - Paraview (which uses VTK) gives a polite message when trying to load this file:
ERROR: In C:\bbd\7cc78367\build\superbuild\paraview\src\VTK\IO\Geometry\vtkOBJReader.cxx, line 590
vtkOBJReader (00000159E9F42C60): Error reading file near line 1352 while processing the 'f' command
So Ready should do the same, at the very least.
Maybe Ready could also offer automatic triangulation on import?
Hi @virtualritz. That wouldn't help in this case though - vtkOBJReader just can't read this kind of OBJ file, because of the format of the f
lines.
~I think the format of the OBJ is technically valid so it's a bug in VTK. Until that is fixed it's just a question of how Ready handles the error. (We could write our own OBJ reader but I'd rather not go down that route.)~
Another possibility is that this is a bug in Wings3D - maybe that f 1// 2// 3//
thing isn't valid after all. See this discussion: http://www.wings3d.com/forum/showthread.php?tid=865
From the next release, Ready will print an error message in this situation instead of crashing.
The OBJ format issue is either a bug in Wings3D or in VTK or both. Or possibly neither, if there's no agreement on what the OBJ format means.
The original OBJ spec is indeed not clear iff 1//
is a valid or invalid OBJ token.
It says double slashes are used when the texture index is absent as in f vi//ni
where vi and ni are the vertex- & normal indices.
But it doesn't explicitly say that having trailing double slashes is invalid.
I have been using Wings3D since 2003. As a VFX professional I imported meshes from this app into every major DCC app. Maya, Houdini, XSI, etc. No crashes/errors/issues.
I've written several OBJ parsers myself and they've always been dealing well with this specific syntax. My MacBook Pro running Catalina previews the Wings3D OBJ files in the macOS Finder just fine.
But the strongest argument is this: the Maya OBJ importer was based on the original Wavefront OBJ importer because Maya was created by Alias|wavefront before the latter got bought by Autodesk, many years later.
IMHO, if the OBJ reader of the format's inventor eats it w/o hiccups so should any good 3rd party one. :)
@virtualritz I'm sympathetic to this viewpoint. I agree that the spec isn't very clear. But there are clear examples in the spec of vi-only faces and so I think it makes sense for Wings3D to follow that since there's no reason not to. ("Be conservative in what you output...") Let's see how they respond.
I think there's an argument to be made that vtkOBJReader should accept f vi//
just to keep the peace ("...and liberal with what you accept.") given that there is at least one piece of software in the real world outputting this format and many packages accepting it, as you helpfully point out. But the place for that discussion is on the VTK issue tracker, not Ready's. We are downstream users of VTK in this case, along with ParaView and many other pieces of software. That's why I have closed the issue here (now that we no longer crash).
Indeed. :) I filed an issue upstream here.
To reproduce:
The OBJ was generated in Wings3D.