1

I have to display a 2d image and don't want to use 3d objects with .obj file.Is it even possible? And how to do it?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
chaitanya Harde
  • 336
  • 1
  • 2
  • 8
  • check this post it would be helpful https://stackoverflow.com/questions/52251070/how-to-display-png-image-in-arcore – Bilz Jan 24 '20 at 07:58

1 Answers1

0

You can use three robust approaches, in your case, to create Sceneform's Renderable:

  • First approach is to create a plane primitive with a .jpg or .png texture assigned to it.

    ModelRenderable plane = ShapeFactory.makeCube(
                                         new Vector3(5.0f, 5.0f, 0.0f), // size
                                         new Vector3(0.0f, 0.0f, 0.0f), // center
                                         material);
    
  • Second approach is to create a ViewRenderable from standard Android Widgets.

    ViewRenderable.builder()
        .setView(this, R.layout.test_view)
        .build()
        .thenAccept(renderable -> testViewRenderable = renderable);
    
  • Third approach is to import a plane made in 3d authoring tool (Maya, 3dsMax, Cinema4D, etc).

    ModelRenderable.builder()
        .setSource(this, RenderableSource.builder().setSource(
            this,
            Uri.parse(ASSET),
            RenderableSource.SourceType.OBJ)
            .setScale(2.0f)
            .setRecenterMode(RenderableSource.RecenterMode.ROOT)
            .build())
        .setRegistryId(ASSET)
        .build()
    
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220