Simple Assimp import and export problem
I'm just trying to understand some simple things about assimp. As a test program, I've got a simple program, below,(originally from https://stackoverflow.com/questions/...rows-exception) which imports a file then exports the data. For some reason, none of the exported files are readable by, e.g. meshlab. What I am missing?
Code:
#include <assimp/cimport.h> Code:
ply |
> the file is unreadable by meshlab
Is there an error message from `meshlab`? Please quote it. |
Thanks for responding!
Depends on the file type, "off" produces "Invalid file", "obj" says "No vertex found", "ply says "header not found". I realized that all the output files were actually the same identical file regardless of suffix, and the output is an "xml" file. So.. clearly there is something wrong with my Exporter.Export(aiscene, format->id, path) call, but I haven't figured out how to make it generate actual off, ply, obj, blah blah files. I changed the last few lines to Code:
aiReturn ret = Exporter.Export(aiscene, format->id, path, 0); (Added) I tried to change it to aiReturn ret = Exporter.Export(aiscene, "stl" , path, 0); which also produces no error and no output file at all. |
Quote:
|
Hmm, good idea. I tried 1,2,3,4 and got different file types. I suppose I need to dig through assimp and see which types are which, or figure out a better way to specify file types. Just putting in the extension didn't produce any output.
I found this https://github.com/assimp/assimp/issues/2481 which lists these types 0: dae 1: x 2: stp 3: obj 4: obj 5: stl 6: stl 7: ply 8: ply 9: 3ds 10: gltf 11: glb 12: gltf2 13: assbin 14: assxml 15: x3d 16: 3mf but it seems hit or miss. ASCII ply works, obj works, stl produces nothing.. and.. aiReturn ret = Exporter.Export(aiscene, "obj", path); actually works to make a file, just not stl or off. In addition, I tried a different .ply file and found the obj file created is only grey scale. I suspect the latter is because the ply file has color set for each vertex, and assimp is assuming some sort of texture or uv channel? |
Update: solved, kind of.. It's quite flaky, and I've only tested a ply file with vertex colors and normals, but I've got dae/collada, ascii ply and stl,3ds,x,fbx and x3d successfully made. I'm posting my code here for anyone with a similar problem.
Code:
#include <assimp/cimport.h> |
All times are GMT -5. The time now is 08:02 PM. |