4

I have couple of 3D objects in .obj and .fbx format with included mtl and texture files. I would like to know which is the best library to render those in Android. All I want to achieve is to display the 3D object inside activity, and add touch gestures (drag and pinch zoom).

SmugDoodleBug
  • 329
  • 4
  • 21
Sumit Sahoo
  • 2,949
  • 1
  • 25
  • 37
  • well that's amusing. Anyways for now trying with Rajawali but unable to load mtl file which is associated with obj. – Sumit Sahoo Sep 17 '17 at 12:42
  • There's numerous libraries for 3D rendering on Android. LibGdx is an easy one to use and loads both .obj and .fbx. – WLGfx Sep 18 '17 at 08:31
  • @WLGfx let me try that. I didn't got it in any google search. Hope it works. Will update soon :) – Sumit Sahoo Sep 19 '17 at 09:34
  • The link for LibGDX: https://libgdx.badlogicgames.com/ – WLGfx Sep 19 '17 at 09:37
  • Yeah I already got and able to create an Android project but getting some weird error while loading the obj file. Trying to replicate the same from https://xoppa.github.io/blog/loading-models-using-libgdx/ – Sumit Sahoo Sep 19 '17 at 10:35
  • I am getting this error : com.badlogic.gdx.utils.GdxRuntimeException: java.lang.IndexOutOfBoundsException: index=-235648 out of bounds (limit=1495736) – Sumit Sahoo Sep 19 '17 at 11:48
  • Usually a limit on a single mesh is 64k vertices, so you will need to chop that down. Any other problems with the .obj files are also fixed when using fbxconv that you get with LibGdx. If in your modelling app you can split the meshes up then that will be fine. Sorry for the late reply. – WLGfx Sep 20 '17 at 20:32
  • Thanks for the heads up. So it has to be done from Blender for example right? Even Rajawali library was showing the same kinda error. Kinda new to this 3D thing so got confused – Sumit Sahoo Sep 20 '17 at 22:26
  • Yes, you can have multiple meshes in an object, just keep each mesh below 64k vertices. Blender might even split them for you, but I don't know for sure. – WLGfx Sep 22 '17 at 11:58

1 Answers1

4

After trying both Rajawali and libGDX I can say Rajawali is a bit easier to implement if the intention is not game development. Here is the link to Rajawali library : GitHub Link

Their support is really good and devs reply quite quickly and resolve issues when reported at GitHub.

Sumit Sahoo
  • 2,949
  • 1
  • 25
  • 37