I am trying out the online converter for "collada|obj to gltf". I found out it provides better result than "obj2gltf". I am wondering whether there is any similar command-line tool or node model available for "collada|obj to gltf converter", or I can use it as a library in my program. Here is the link for the converter https://cesiumjs.org/convertmodel.html.
What do you mean by better results? The online tool actually uses the same code as those two repositories – it’s just a few versions behind actually.
These two tools generated different results for me. For my case, it seems the result generated by “obj2gltf” with lower quality, i.e. it seems the result loses some detail. Here are the two results. The first one is generated by the online ui tool. The second one is generated by “obj2gltf”.
That’s unexpected! I’ll look into what the version differences might be. Meanwhile, do you know if there’s anything unusual about your obj? Better yet, would you be willing to share your model? It may help us debug.
I found another old version obj2gltf here. It works as well as the online tool. I don’t think there is anything unusual with my obj file. I open the obj file on my local machine. It looks fine. Attached is my obj file.
my.obj (234 KB)
I think the difference is that old versions of the converter generated normals, whereas the new version doesn’t do it by default.
Try running the command line obj2gltf converter with the flag generateNormals
See the repo README for details: https://github.com/AnalyticalGraphicsInc/obj2gltf
Hope that helps,
I still got the same result after setting the generateNormals flag. Another thing I noticed that the old version works much faster than the new “obj2gltf”. The old version just takes about half time than the new version.
Hi I opened a pull request for a fix here: https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/89
Before obj2gltf used to generate normals on its own, but has since moved to using gltf-pipeline for tasks like these. That’s the major difference between the old and new versions mentioned here.