2

I want to make an Android app which can convert .OBJ files into .GLB files.

I've researched this a fair bit but I haven't yet found any library that I'm confident I can use in an Android app for .OBJ to .GLB conversion. I had initially thought that the Assimp library was going to be the best bet: http://cms.assimp.org/index.php. Having looked more closely, however .GLB seems only to be listed as an import format and not as an export format: https://github.com/assimp/assimp So that presumably that means I can use Assimp to convert from .GLB to another format but not into .GLB from another format.

I'd be most grateful for any suggestions on alternative strategies that might be worth investigating. There must surely be some solution to this, but I can't immediately see what it could be!

CKP78
  • 630
  • 8
  • 19
  • Does this need to happen offline, or could you use an API? obj2gltf is the most reliable option but should probably run on a server. – Don McCurdy Mar 06 '18 at 15:17
  • Also, if you can find an OBJ _parser_, then there are Java libraries for serializing to glTF... you'd just need to pass along the data. Also, perhaps [jgltf-obj](https://github.com/javagl/JglTF/tree/master/jgltf-obj)? – Don McCurdy Mar 06 '18 at 15:19
  • Hi Don. I looked at obj2gltf but came to the same conclusion - since it's in JavaScript it would have to run on a server, which I think wouldn't be ideal. I'm looking into jgltf-obj right now, as it happens - this seems to be the most promising option. – CKP78 Mar 06 '18 at 16:41
  • One thing I've found about the jgltf libraries is that some of the code requires Android API 24 or higher. I'm planning now to investigate the Assimp alternative, as suggested in KimKulling's answer. – CKP78 Mar 07 '18 at 08:08

1 Answers1

0

You can use the Assimp-lib build for your android version ( shall work for 4.1.0 with android-cmake as far as I know ). Then you can use the functionalities to import an obj-file and export it as an glb-file. To write files there you will need to use th android-filesystem.

A short explanation cqn be found in our wiki how to build assimp for android ( check this here ). Or you can try our special build script, which is located here.

If you are facing any issues just create an issue report.

KimKulling
  • 2,654
  • 1
  • 15
  • 26
  • Thanks, I'll look into this. I was put off from exploring Assimp more thoroughly, since GLB was listed explicitly there as an import format, but not as an export format. In the supported export formats section, it doesn't mention GLB explicitly, but lists glTF 1.0 and 2.0 saying that they have 'partial' support. But I'll look into it, thanks. – CKP78 Mar 06 '18 at 16:56
  • @CKP78 Did you test this method? What solution did you find finally? Thanks. – toto_tata Oct 05 '21 at 10:14