How to use .mtl file for creating texture for augmanted face in Arcore

Viewed 28

I am creating a face filter AR android app using arcore. When downloading a 3D object from any website, I get only two files - an OBJ file and an MTL file. there is no PNG or any other file for texture. I have already converted OBJ to SFB file, so using SFB file RenderableModel is ready.

ModelRenderable.builder()
        .setSource(this, /* Here place a SFB file */)
        .build()
        .thenAccept(Consumer { rendarable: ModelRenderable? ->
            modelRenderable = rendarable!!
            modelRenderable.isShadowCaster = false
            modelRenderable.isShadowReceiver = false
        })
        .exceptionally {
            Toast.makeText(this, "error loading model", Toast.LENGTH_SHORT).show()
            null
        }

But, in the below code I need a PNG or XML file to create Texture.

Texture.builder()
        .setSource(this, /* Here place a PNG or XML file */)
        .build()
        .thenAccept(Consumer { textureModel: Texture? ->
            texture =
                textureModel!!
        })
        .exceptionally {
            Toast.makeText(this, "cannot load texture", Toast.LENGTH_SHORT).show()
            null
        }

I want a file to create Texture for the augmented face but android studio only accepts PNG or XML files for Texture. Can anyone please tell me how I can create texture from an MTL file?

0 Answers
Related