I have coded a small C++ program that uses Assimp and it runs fine, but it generates a file on disk that contains a lot more vertices than what is needed to represent the model, the behaviour is basically: triangulate the original mesh, allocate 1 vertex each time that vertex is being used by some face, and the result is that I have a ton of duplicate vertices.
Assimp::Exporter *exporter = new Assimp::Exporter();
exporter->Export(scene, "obj", "/tmp/try.obj",0); // no really good flags for this
I would like to remove the double vertices and export a really compact version of my mesh, I also tried all the aiProcessPreset_ and aiProcess_ without finding one that I'm happy with.
I also would like to ask if Assimp provide any kind of retopologizing functions or is able to export faces as quads.
Use aiProcess_JoinIdenticalVertices on import to join all identical vertices. This requires an Index Buffer for rendering then, but most applications should be fine with this.
Concerning quads: There is no post processing step to create polygons from triangles, but existing quads should be handled just fine. So be sure to not use any triangulation option when exporting from your modelling application, and don't use aiProcess_Triangulate on importing.
Thanks, but the problem still exist, I tried
const aiScene *scene = importer.ReadFile(pFile,aiProcess_JoinIdenticalVertices);
but the exported object is exactly the same as before, as I said in the first post I also tried various combination for the flags without getting really different results.
Are these dublicated vertices completly redundant ( all texture coordinates, colors, pos, etc. )?
this is a zip file with:
as you can see the obj is full of duplicate vertices that I'm not able to remove, yet, also note that this duplicates are introduced by assimp itself because they are not present in the 3ds file.
Thanks for the file. I will take a look into it.
Can't say anything about that specific file, but I'll leave a general warning here: getting the very same data to the target file is IMPOSSIBLE, especially after it went through the complex conversions and post processing that you need to fit 30+ file formats into one data structure.
I understand that but not even the flags aiProcessPreset and aiProcess are doing that much, 1 thing is the internal representation of a data structure, another thing is exporting to a specific file while setting some flags that are supposed to do something.