I am trying to add a video textured geometry inside the scene. For POC, I am trying to map the texture of plane geometry. Eventually, I would be loading it on other geometries like cylinders. The video is being played but transparency is not being set. I have added a transparent property to material and format as RGBA to texture property
const video = document.getElementById( 'video' );
video.play();
const texture = new THREE.VideoTexture( video );
texture.format = THREE.RGBAFormat;
When using VideoTexture, minFilter and magFilter are already set to THREE.LinearFilter.
Notice that you need a user interaction before starting the video (otherwise you violate the autoplay policy and it won’t work). Besides, you should definitely add a MP4 version of your video since WebM is not supported by all browsers. Use the following example as a code template:
I have been trying to get video with alpha working on all devices. On desktop browsers (Chrome, Safari) webm and mov (codec hvc1) are working great when using them as videotexture with format sRGBA.
But none of the mobile devices work: video (iOS = mov, Android = webm) is shown without alpha.
On Quest2 Oculus browser the video (webm) doesn’t load at all (the video element control shows a spinning pause button). here i might have to change to another codec.
Anyone experienced the same and found a solution? Especially for the Quest2 I am eager to hear a solution for videotexture with alpha.
FYI: this is the video element for the video texture:
<video autoplay="" loop="" muted="" playsinline="" preload="metadata" crossorigin="anonymous" controls="" style="display:none">
<source src="movie-A.mov" type="video/mp4; codecs="hvc1"">
<source src="movie-A.webm" type="video/webm">
Sorry, your browser doesn't support this video.
</video>
Interesting @Jo_Mantelers
My curiosity itches me. I tried with FF and Chrome, and it now works on desktop and Android 7.0.
Is it still not working for you on iOS and Quest2 with webm?
Not related but I think for HTML you can remove the ="" and simply quote:
<video autoplay loop muted playsinline preload="metadata" crossorigin="anonymous" controls style="display:none">
<source src="movie-A.mov" type="video/mp4; codecs='hvc1';">
<source src="movie-A.webm" type="video/webm">
Sorry, your browser doesn't support this video.
</video>
I just tested transparent video textures (webm+hvc) and can confirm it works on Desktop+Mobile including iOS, but not on the native Oculus Quest 2 browser. It works on Firefox Reality for Oculus though.