too much vertices when exporting

spinku
2013-08-19
2013-09-01
  • spinku
    spinku
    2013-08-19

    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.

    Thanks.

     
  • 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.

     
    • spinku
      spinku
      2013-08-20

      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.

       
  • Kim Kulling
    Kim Kulling
    2013-08-20

    Are these dublicated vertices completly redundant ( all texture coordinates, colors, pos, etc. )?

    Kimmi

     
  • spinku
    spinku
    2013-08-20

    http://www.sendspace.com/file/7021ak

    this is a zip file with:

    • a complete minimal example that reproduces what I'm trying to do
    • it also reproduces the behaviour that I'm trying to avoid
    • the .3ds file is the dummy file that I import as command line argument
    • the .obj file is the output that I obtain from my software

    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.

     
    Last edit: spinku 2013-08-20
  • Kim Kulling
    Kim Kulling
    2013-08-22

    Thanks for the file. I will take a look into it.

    Kimmi

     
  • 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.

     
    • spinku
      spinku
      2013-09-01

      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.