Android AR apply textures to glb model

43 views Asked by At

I have a 3D model without texture (a white ball) which is correctly rendered using this method

private fun createObject(anchor: Anchor) {
    renderableSource = RenderableSource
        .builder()
        .setSource(this, Uri.parse("ball.glb"), RenderableSource.SourceType.GLB)
        .setRecenterMode(RenderableSource.RecenterMode.ROOT)
        .build()
    
    ModelRenderable
        .builder()
        .setSource(this, renderableSource)
        .setRegistryId(Uri.parse("ball.glb"))
        .build()
        .thenAccept(Consumer { modelRenderable: ModelRenderable ->
            placeModel(
                modelRenderable,
                anchor
            )
        })
}

I would like to have 3 buttons on the screen, and by clicking one of these buttons I would like to change the texture of the ball I am rendering. I already have 3 different PNG files to render, but I don't know which method to call to change the texture of the model.

0

There are 0 answers