songrun / seamawaredecimater Goto Github PK
View Code? Open in Web Editor NEWMesh simplification with UV's boundary preserved
Home Page: https://cragl.cs.gmu.edu/seamless/
License: MIT License
Mesh simplification with UV's boundary preserved
Home Page: https://cragl.cs.gmu.edu/seamless/
License: MIT License
SeamAwareDecimater/cost_and_placement.cpp
Line 194 in c699343
Hi guys. Looking at the code of the quadratic problem, I was wondering why do you use the constant 1
as one of the unknown variable (through an equality). Is it there for numerical reasons, or something else?
Linking CXX executable decimater
CMakeFiles/DEC_LIBS.dir/decimate.cpp.o: In function `_ZNSt6threadC2IRKZN3igl12parallel_forImZNS1_12parallel_forImZNS1_16unique_simplicesIN5Eigen6MatrixIiLin1ELin1ELi0ELin1ELin1EEES7_NS6_IiLin1ELi1ELi0ELin1ELi1EEES8_EEvRKNS5_10MatrixBaseIT_EERNS5_15PlainObjectBaseIT0_EERNSE_IT1_EERNSE_IT2_EEEUlRmE_EEbSA_RKSF_mEUlmE_ZNS3_ImSP_EEbSA_SR_mEUlmmE0_SS_EEbSA_SR_RKSI_RKSL_mEUlmmmE_JSO_RKmSO_EEEOSA_DpOT0_':
/usr/include/c++/5/thread:137: undefined reference to `pthread_create'
Building on Ubuntu 16.04LTS works fine until the link. Then, the above message. How can pthread_create be missing? It's a standard library function.
Link command is:
cmake -E cmake_link_script CMakeFiles/decimater.dir/link.txt --verbose=
cmake version 3.11.1
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)
This has to be some kind of cmake problem.
Hi @songrun, thanks for the work!
I'd like to know how to reference a texture .jpg file as well as .mtl material file when loading in an .obj file to the decimator.
Thanks!
For every mesh I try, I am getting the same error
"min cost edge is infinite cost, left nums of vertices: ..."
When the decimater succeeds, it strips off the mtl references. If I add them manually, the model looks great, but in some cases there are several references to the mtl file between faces etc, it is imposible to know where it suppose to go. This is common in models with several textures.
When building in debug mode with visual studio 2015 there is an error at line 265.
the current line is assert( seam_edges.count(d) or FT(f,v) == d_tc );
should this not be assert( seam_edges.count(d) || FT(f,v) == d_tc );
Cheers,
When I try to decimate this file to 63% or less, I get a fatal assertion failure in igl::circulation
:
Assertion failed: ((EF(e,1) == ff || EF(e,0) == ff) && "e should touch ff"), function operator(), file circulation.cpp, line 30.
I'm working on macOS 11.5 using Xcode 12.5.1.
First of all, congratulations for your publication! This is are high quality results! :)
The issue:
The execution crashes during the Priority queue preparation. I don't know if it is due some logic error in the procedure or some inconsistencies with the libigl internal structures and how it reads the OBJ. The code crashes at the following line:
The error is the following:
libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: unordered_map::at: key not found
To replicate:
Use the following OBJ 3D model of a Tractor:
On a side note, it seems like there is a weird non deterministic behavior with libigl... the assertions and runtime errors show up randomly, specially if running in a debugger or release, the same line of code yields different errors.
[ 11%] Building CXX object CMakeFiles/DEC_LIBS.dir/collapse_edge_seam.cpp.o
/Users/teapoy/Documents/GitHub/SeamAwareDecimater/collapse_edge_seam.cpp:59:33: error:
no matching function for call to 'circulation'
const std::vector<int> nV2Fd = igl::circulation(e,!eflip,F,E,EMA...
^~~~~~~~~~~~~~~~
/Users/teapoy/libigl/include/igl/circulation.cpp:59:22: note: candidate function
not viable: requires 6 arguments, but 7 were provided
IGL_INLINE void igl::circulation(
^
/Users/teapoy/libigl/include/igl/circulation.cpp:12:34: note: candidate function
not viable: requires 5 arguments, but 7 were provided
IGL_INLINE std::vector<int> igl::circulation(
^
/Users/teapoy/Documents/GitHub/SeamAwareDecimater/collapse_edge_seam.cpp:61:33: error:
no matching function for call to 'circulation'
const std::vector<int> nV2Fs = igl::circulation(e, eflip,F,E,EMA...
^~~~~~~~~~~~~~~~
/Users/teapoy/libigl/include/igl/circulation.cpp:59:22: note: candidate function
not viable: requires 6 arguments, but 7 were provided
IGL_INLINE void igl::circulation(
^
/Users/teapoy/libigl/include/igl/circulation.cpp:12:34: note: candidate function
not viable: requires 5 arguments, but 7 were provided
IGL_INLINE std::vector<int> igl::circulation(
^
/Users/teapoy/Documents/GitHub/SeamAwareDecimater/collapse_edge_seam.cpp:343:24: error:
no matching function for call to 'circulation'
std::vector<int> Ne = circulation(e, true,F,E,EMAP,EF,EI);
^~~~~~~~~~~
/Users/teapoy/libigl/include/igl/circulation.cpp:59:22: note: candidate function
not viable: requires 6 arguments, but 7 were provided
IGL_INLINE void igl::circulation(
^
/Users/teapoy/libigl/include/igl/circulation.cpp:12:34: note: candidate function
not viable: requires 5 arguments, but 7 were provided
IGL_INLINE std::vector<int> igl::circulation(
^
/Users/teapoy/Documents/GitHub/SeamAwareDecimater/collapse_edge_seam.cpp:345:7: error:
no matching function for call to 'circulation'
Ne = circulation(e,false,F,E,EMAP,EF,EI);
^~~~~~~~~~~
/Users/teapoy/libigl/include/igl/circulation.cpp:59:22: note: candidate function
not viable: requires 6 arguments, but 7 were provided
IGL_INLINE void igl::circulation(
^
/Users/teapoy/libigl/include/igl/circulation.cpp:12:34: note: candidate function
not viable: requires 5 arguments, but 7 were provided
IGL_INLINE std::vector<int> igl::circulation(
^
4 errors generated.
make[2]: *** [CMakeFiles/DEC_LIBS.dir/collapse_edge_seam.cpp.o] Error 1
make[1]: *** [CMakeFiles/DEC_LIBS.dir/all] Error 2
make: *** [all] Error 2
problem encountered during make, LIBIGL set and built
Hello songrun,
A great tool you developed!
I have an issue working with Decimater.
It fails on heavy obj models (tried 35 Mb and more), though works for smaller models (< 20 Mb).
The last model I tried (with options 'percent-vertices 50') failed with
The model itself:
Large.zip
OS: Centos7 x86_64. IDE: CLion
Could you please help to resolve this issue?
Regards,
Alexey
Hi,
Thanks for providing the useful tool!
I was trying it on a mesh with overlapped uv map and the uv coordinates are a bit outside of the (0,0)~(1.1) uv domain (as shown below). The program fails on it. I wonder what's the reason for the failure so that I'll just avoid those kinds of models in the future.
Input mesh: https://drive.google.com/file/d/1Rbl1WPEEpDGTx-AWTkkO6MsVRazFUshE/view?usp=sharing
A part of the output log:
...
23443 1 69814 2
70274 2 51069 2
126520 1 126470 2
32157 1 67235 1
31828 0 78128 1
37579 1 69885 0
16843 1 33013 0
29863 1 32811 0
70336 0 96295 1
32087 1 23234 2
82274 1 70046 0
29407 1 70353 2
31744 1 38811 1
31876 2 67898 2
69687 0 104916 1
25744 1 32854 2
110846 1 70429 0
19626 1 70421 2
32608 0 86636 1
32655 0 75544 1
46613 1 84398 0
32962 2 29681 1
26482 1 32196 2
31526 1 70352 2
62337 1 32711 2
# seam vertices: 36906
# seam edges: 46356
computing initial metrics finished
# edges: 317687
building PriorityQueue succeeds.
Killed: 9
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.
I am trying to add mesh decimation to my engine using your SeamAwareDecimater.
Unfortunaletly the decimate_down_to method always return false.
Even that small 2 triangles example fails:
`
const int inNbVertices = 4;
// 4 Vertices
Eigen::MatrixXd V(inNbVertices, 3);
{
V(0, 0) = 0.0; V(0, 1) = 0.0; V(0, 2) = 0.0;
V(1, 0) = 0.0; V(1, 1) = 1.0; V(1, 2) = 0.0;
V(2, 0) = 1.0; V(2, 1) = 0.0; V(2, 2) = 0.0;
V(3, 0) = 1.0; V(3, 1) = 1.0; V(3, 2) = 0.0;
}
// 4 texture coordinates
Eigen::MatrixXd TC(inNbVertices, 2);
{
TC(0, 0) = 0.0; TC(0, 1) = 0.0;
TC(1, 0) = 0.0; TC(1, 1) = 1.0;
TC(2, 0) = 1.0; TC(2, 1) = 0.0;
TC(3, 0) = 1.0; TC(3, 1) = 1.0;
}
// 2 faces
const int inNbFaces = 2;
Eigen::MatrixXi F(inNbFaces, 3);
Eigen::MatrixXi FT(inNbFaces, 3);
{
{
F(0, 0) = 0; F(0, 1) = 3; F(0, 2) = 1;
F(1, 0) = 0; F(1, 1) = 2; F(1, 2) = 3;
}
FT = F;
}
// Perform decimation.
const int target_num_vertices = 3;//75%
const int seam_aware_degree = int(SeamAwareDegree::Seamless);
Eigen::MatrixXd V_out, TC_out;
Eigen::MatrixXi F_out, FT_out;
const bool success = decimate_down_to(V, F, TC, FT, target_num_vertices, V_out, F_out, TC_out, FT_out, seam_aware_degree);
assert(success);
`
Am i doing something wrong?
It is not working even for the model: animal.obj
Getting the below message. What is the problem? Can you please check?
Thanks in advance
min cost edge is infinite cost, left nums of vertices: 117121
i am getting this error for the mesh
./decimater FootBace.obj percent-vertices 10
Failed to cast F to matrix: min (3) != max (4)
Here is my mesh, link
can you please help
I have built decimater.exe, but it mostly stopped working after print computing initial metrics finished
, even on 3ds max default teapot
I have attached the teapot.obj and decimater.exe that I built: decimater and teapot.zip
I'm using latest Win 10 64 bit, Cmake 3.9.1.
For libigl: I copied folder igl
from libigl\include\
to C:\Program Files
For Eigen: I copied root folder eigen
to C:\Program Files
Then build using latest Microsoft Visual Studio Community 2017
Cmake response in cmd: https://pastebin.com/f47FTGW7
Full build output log in Visual Studio: https://pastebin.com/Sj2zZPPR
CMakeOutput.log: https://pastebin.com/LDpeatDb
Please check and see what am I missing, I still very new to these build process. Thank you!
(I'll be very appreciate if anyone can provide working pre-compiled binary)
Unless I'm missing something there doesn't appear to be any mapping of output vertices to their original source vertices.
Without that it's not possible to pull other vertex-attributes from the source mesh (such as bone-weights and indices), barring slow brute force projection of the new vertices onto the old mesh to sample the values - which is nuts.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.