Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

Setting SceneView background as transparent #263

Open
itanbp opened this issue Aug 17, 2018 · 14 comments
Open

Setting SceneView background as transparent #263

itanbp opened this issue Aug 17, 2018 · 14 comments
Labels
feature request New feature or request

Comments

@itanbp
Copy link

itanbp commented Aug 17, 2018

Hi,
I'm trying to set the SceneView's background color to be transparent, however, the documentation states:

the background color of the Scene is set to getColor() (the alpha of the color is ignored)

Is there a way to do so?

The purpose is to create a "semi-ar" feature (for devices that aren't supported by Arcore) by combining the camera's feed, and a SceneView with a transparent background.

Thanks!

@dsternfeld7 dsternfeld7 added the feature request New feature or request label Aug 17, 2018
@dsternfeld7
Copy link

There is currently no way to do so. It would be possible for us to add this as a feature, however there will be a hit to performance if we do so.

Can you give us more information about what your use case is for? Since a SceneView is a type of Android SurfaceView, by default, nothing in the android view hierarchy will render behind it. You can force a SurfaceView to render on top, but then nothing in the view hierarchy will render above it.

@itanbp
Copy link
Author

itanbp commented Aug 18, 2018

@dsternfeld7 setting SurfaceView on top looks like a suitable solution.
Actually following this how to make surfaceview transparent SO post, I created custom view TransparentSceneView extending SceneView. In the constructor I added

setZOrderOnTop(true);
SurfaceHolder sfhTrackHolder = getHolder();
sfhTrackHolder.setFormat(PixelFormat.TRANSPARENT);

It didn't work (the camera feed was still hidden by the TransparentSceneView), I assume this is the feature you referred?

Currently many users can't use my app as Arcore's supported devices list is still limited, so I believe offering a basic feature that gives a glimpse of the AR fealing, can be a good compromise until arcore will be common on many Android devices.

@Brianvdb
Copy link

@itanbp did you find a solution already?

@itanbp
Copy link
Author

itanbp commented Aug 22, 2018

@Brianvdb I'm waiting for @dsternfeld7's response

@JessHolle
Copy link

It is my understanding that this requirement should be solvable via external textures -- as per discussion on #169

That said, I've not actually coded this -- and how-to code in this regard would be greatly appreciated.

The fact that ARCore supports fairly few devices and that there are other AR libraries and other use cases for mixing 3D and a camera background makes this a recurring question/request.

@itanbp
Copy link
Author

itanbp commented Aug 23, 2018

@JessHolle well said!

@JessHolle
Copy link

P.S. #227 seems like another hugely necessary piece to work well with a real camera without ARCore.

@romainguy
Copy link

Making the SurfaceView itself transparent is not enough, Sceneform needs to setup the internal renderer to render to a transparent target. But instead of making the 3D scene transparent you should simply display the camera feed in the 3D scene by using an ExternalTexture (it's what ARSceneView does).

@gorastudio-ceo
Copy link

We need transparent in Scene. Can you make this feature in priority, please 🙏

@tharinimoorthy
Copy link

We need transparent background in Scene. Can you make this feature in priority, please

@fzaiatz
Copy link

fzaiatz commented May 31, 2019

+1 would be great to allow 100% transparent background for SceneView.

About the ExternalTexture solution: is it possible / any idea the best way to update a texture contents frame by frame from raw data (byte[])?

@AbhisKmr
Copy link

I'm also facing the same issue please do something for this

@theguyontheleft
Copy link

Would love to be able to have a transparent background for SceneView as well.

@brako
Copy link

brako commented Mar 18, 2020

I would like to have this feature too. I am mirroring the content of a SceneView using an ExternalTexture to display it in an another SceneView. For now I use the same technique as the Chromakey video sample to have a transparent background. But it won't work if I have some semi-transparent items in my scene.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests