Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on every file I try #6

Open
John-Nagle opened this issue May 4, 2018 · 9 comments
Open

Fails on every file I try #6

John-Nagle opened this issue May 4, 2018 · 9 comments

Comments

@John-Nagle
Copy link

I exported the default cube from Blender to .obj. Result:

 decimater testcube.obj  percent-vertices 90
Warning: readOBJ() ignored non-comment line 4:
  o Cube
Loaded a mesh with 8 vertices and 6 faces: testcube.obj
90% of 8 input vertices is 7 output vertices.
decimater: /home/john/projects/sl/SeamAwareDecimater/decimater.cpp:85: bool {anonymous}::decimate_down_to(const Eigen::PlainObjectBase<Derived>&, const Eigen::PlainObjectBase<DerivedTC>&, const Eigen::PlainObjectBase<DerivedCN>&, const Eigen::PlainObjectBase<DerivedTC>&, int, Eigen::MatrixXd&, Eigen::MatrixXi&, Eigen::MatrixXd&, Eigen::MatrixXi&, bool) [with DerivedV = Eigen::Matrix<double, -1, -1>; DerivedF = Eigen::Matrix<int, -1, -1>; DerivedT = Eigen::Matrix<double, -1, -1>; Eigen::MatrixXd = Eigen::Matrix<double, -1, -1>; Eigen::MatrixXi = Eigen::Matrix<int, -1, -1>]: Assertion `F.cols() == 3' failed.
Aborted (core dumped)

OK, so maybe reducing a cube while preserving seams is geometrically impossible.

The default cylinder from Blender:

decimater testcylinder.obj  percent-vertices 90
Warning: readOBJ() ignored non-comment line 4:
  o Cylinder
Failed to cast F to matrix: min (4) != max (32)
ERROR: Could not read OBJ: testcylinder.obj

I get that "Failed to cast F to matrix" error from everything I've tried - simple files from Blender, files from 3D sites.

But the "animal.obj" file provided with the source code poly reduces just fine. So the program passes its own test case.

@John-Nagle
Copy link
Author

Test objects mentioned above.
failobjs.zip

@songrun
Copy link
Owner

songrun commented May 5, 2018 via email

@John-Nagle
Copy link
Author

John-Nagle commented May 5, 2018

Triangulated the cylinder. Result:

 decimater testcylindertris.obj  percent-vertices 80 testcylindertris50.obj
Warning: readOBJ() ignored non-comment line 4:
  o Cylinder
Loaded a mesh with 64 vertices and 124 faces: testcylindertris.obj
80% of 64 input vertices is 51 output vertices.
decimater: /home/john/projects/sl/SeamAwareDecimater/decimater.cpp:87: bool {anonymous}::decimate_down_to(const Eigen::PlainObjectBase<Derived>&, const Eigen::PlainObjectBase<DerivedTC>&, const Eigen::PlainObjectBase<DerivedCN>&, const Eigen::PlainObjectBase<DerivedTC>&, int, Eigen::MatrixXd&, Eigen::MatrixXi&, Eigen::MatrixXd&, Eigen::MatrixXi&, bool) [with DerivedV = Eigen::Matrix<double, -1, -1>; DerivedF = Eigen::Matrix<int, -1, -1>; DerivedT = Eigen::Matrix<double, -1, -1>; Eigen::MatrixXd = Eigen::Matrix<double, -1, -1>; Eigen::MatrixXi = Eigen::Matrix<int, -1, -1>]: Assertion `TC.cols() == 2' failed.
Aborted (core dumped)

@John-Nagle
Copy link
Author

John-Nagle commented May 5, 2018

failobjs2.zip
Test files for above.
The triangulated cylinder is the Blender default cylinder triangulated with the default Blender triangulation. The attached image shows a valid triangulation.

Similar failure on a chair model. I can't get this program to work on anything but the provided "animal.obj".

@songrun
Copy link
Owner

songrun commented May 6, 2018 via email

@John-Nagle
Copy link
Author

Thanks.

Next problem:

capsulefail.zip

This is the "minimal textured object file" from http://paulbourke.net/dataformats/obj/minobj.html used as a demo and test case.

The mesh reduction opens up a sizable gap in the mesh between the upper and lower halves of the object. Oops.

@TheOriginalBytePlayer
Copy link

I think I may have a solution -- a lot of OBJ files have 3 UVS. which is valid, though they actually seem to only use the first 2 values as the 3rd is always zero. In any case

  1. Goto the ReadOBJ.cpp file, and to insert the line

        Count = 2;
    

just before Line 131,

       std::vector<Scalar > tex(count);

You need to do this because the decimation function requires the UVs to have exactly 2 columns and OBJ can legally have 3. By Explicitly setting it to 2 you are tossing the third value which appears to always be zero in files I’ve seen, anyway.

Similarly, OBJ files can legally have NO UVs but the library can't handle that, so make sure they have UVs assigned.

@John-Nagle
Copy link
Author

Ah. Two years later, but good info.

@TheOriginalBytePlayer
Copy link

TheOriginalBytePlayer commented Jul 3, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants