OBJ File for ARCore Application Development

4k views Asked by At

What is the significance of the andy.obj file in the ARCore Sample?

Let's say if we replace the andy.png with a new image, how can we generate .obj file for the new image?

4

There are 4 answers

2
PhilLab On

The OBJ file describes the geometry, the png file the texture to "stretch" over this 3D object. You have to use a 3D modelling program like Blender to create a new model.

This is how you export OBJ files in Blender: https://blender.stackexchange.com/questions/121/how-do-i-export-a-model-to-obj-format

enter image description here

5
JohnLXiang On

The sample code only can handle the simplest OBJ models that only have 1 texture file.

Fo those complicated OBJ models, they usually come with a MTL file that refers to several different texture files. To be able to handle that ,you need some extra work on the existing code. Please check the code I implement for this case if you are interested @https://github.com/JohnLXiang/arcore-sandbox . Specifially ,you can take a look at ObjectRenderer.createOnGlThread().

0
Andy Jazz On

For creating a new .obj model for your AR app you need to use 3D authoring software like Autodesk Maya, Autodesk 3dsMax, Blender, SideFx Houdini, Cinema 4D, etc. These applications can help you create a high quality polygonal model with corresponding .mtl texture file.

But you should know that Sceneform supports 3D assets not only in OBJ format (where animations aren't supported) but also in FBX (with animations) and in glTF (animations not supported).

  • .obj
  • .fbx
  • .glTF

Sceneform's ASCII and Binary Asset Definitions are also welcome:

  • .sfa
  • .sfb

Supported material files (aka textures for your 3D assets) have the following extensions: MTL, BIN, PNG, JPG and native Sceneform's SFM.

  • .mtl
  • .bin
  • .png
  • .jpg
  • .sfm

Hope this helps.

0
Derzu On

To export a texture as image in Blender do the following:

Select your object and enter in edit mode. Select all vertices/faces (press 'a'). Then start the UV Mapping, press 'u'. And Select one of the options of the UVMapping. You must test the best option for your model. I'm not sure which UV Mapping mapping option the ARCore uses.

enter image description here

Then go to the UV/Image Editor:

enter image description here

Export UV Layout at the menu, and save your image.

enter image description here