Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use ARCore with OBJ and MTL files

When played with the Android ARCore Samples, I noticed that the sample use the next line:

mVirtualObject.createOnGlThread(this, "andy.obj", "andy.png"); 

andy.png is the PNG file texture to "stretch" over the andy.obj 3D object.

I want to replace the model and the PNG file, with items from Google Poly.

But when downloading an obj file from Poly, I'm getting obj + mtl files.

I guess that the mlt is the texture file like the PNG, but I can't use it.

Can I convert it to PNG file? Or use mtl file in ARCore?

like image 619
David Avatar asked Dec 24 '17 23:12

David


1 Answers

The .*mtl is the material file that is referenced from the OBJ and defines stuff like textures and lightning configuration. The OBJ loading library used in the ARCore sample is very basic so you have to find a better one or implement the OBJ file loading on your own. Another option would be to use a 3D library for Android that already provides model loading and hides the low-level OpenGL stuff. For examples of these high-level libraries see https://stackoverflow.com/a/48456836/385536.

like image 146
Steven Mohr Avatar answered Oct 24 '22 02:10

Steven Mohr