augmented-realityarcoreandroid-augmented-realitysceneformarcamera

How to display images fetching from server in ARCore?


I am building an application using ARCore where i want to display images from server. I don’t want to use obj, .smf ,imgdb file, and 3D image. I have already referred many links but none of them showing how to display images fetching from server using Arcore.

val getImageURL = media["cLeft"]
    Log.e("workImageURL", "$getImageURL")
    Glide.with(this)
            .setDefaultRequestOptions(RequestOptions().error(R.drawable.ic_logo))
            .load(getImageURL)
            .into(imageCard)

    ViewRenderable.builder()
            .setView(this, R.layout.layout_ar_object_image)
            .build()
            .thenAccept { renderable ->
                andyRenderable = renderable
            }

  arFragment.setOnTapArPlaneListener { hitResult: HitResult, plane: Plane, motionEvent: MotionEvent ->

        val anchor = hitResult.createAnchor()
        val anchorNode = AnchorNode(anchor)

        anchorNode.setParent(arFragment.arSceneView.scene)

        // Create the transformable andy and add it to the anchor.
        val andy = TransformableNode(arFragment.transformationSystem)
        andy.setParent(anchorNode)
        andy.renderable = andyRenderable
        andy.select()
    }

Solution

  • In order to show images loaded from a server you would use ViewRenderables and an ImageView. Then you can load the image in the ImageView (with whatever lib you like e.g. Glide or Picasso) and attach this ImageView to a Sceneform node using the ViewRenderable.