androidaugmented-realityarcoresceneformsceneview

How can I overlay a video onto background of SceneView behind a 3d model?


I rendered a 3D scene without the use of the camera and AR session following the website(https://developers.google.com/ar/develop/java/sceneform/build-scene).

What I want to do is to put the video onto that green background after I bring a selected video from the gallery. I know how to import a video and change the color of the background(sceneView.setBackgroundColor(Color.MAGENTA);)

The image is like this. (https://developers.google.com/ar/develop/java/images/sceneview.png)

first time I thought that if I locate a video view behind this "SceneView" in the XML layout and then make the background transparent, it would be working, but it didn't work.

The code below is not working.

    activity_ux.xml

  <VideoView
      android:id="@+id/videoView"
      android:layout_width="match_parent"
      android:layout_height="match_parent" />


  <com.google.ar.sceneform.SceneView
      android:id="@+id/sceneView"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:alpha="1"
      />


    MainActivity.java

      sceneView = (SceneView) findViewById(R.id.sceneView);
      sceneView.setBackgroundColor(Color.TRANSPARENT);

Do you know how to make it? Do you have any idea to approach to my purpose?


Solution

  • This is not supported at the moment, AFAIK - there is an open request for it on GitHub: https://github.com/google-ar/sceneform-android-sdk/issues/263

    You may be able to achieve what you want by adding a surface into the scene and playing your video on this. The approach is:

    There is an example included with Scenefrom which may help - link in this answer: https://stackoverflow.com/a/56932459/334402