简体   繁体   中英

Programmatically convert 2D image to 3D renderable using android sceneform

All the tutorials and blogs out there show how to build Renderable:

ModelRenderable.builder()
               .setSource(this, <Path of 3D model>)
               .build()
               .thenAccept(renderable -> myRedenderable = renderable)

using the sceneform plugin in android studio. But I would like to build a 3D Renderable on the fly from a 2D .png image or something uploaded by the user. How can I achieve that?

Use ViewRendarable to place a 2d View

// Build a renderable from a 2D View.
    CompletableFuture<ViewRenderable> solarControlsStage =
        ViewRenderable.builder().setView(this, R.layout.file_name).build();

To find more detail about placing 2D View Look at google Ar solar system sample

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM