How to play an Alpha video inside an Unlit sphere in Unity? - unity3d

I'm trying to play an Alpha Video inside a sphere which has a StereoPanoSphereMaterial using a shader "GoogleVR/Demo/VideoDemo InsideShader" and is used to play a 360 degree video.
I'm using a GoogleVR/Unlit/TransparentOVerlay shader on a Quad to run my Alpha Video inside the sphere. It appears to be running fine when I run it in the editor but when I run it on my device it just shows a blank Quad which is supposed to be transparent and the video cannot be seen as well.
I've tried playing it with other given shaders as well like FX/Flare, Unlit/Transparent to no use.
Any tips on how to play an Alpha video inside my 360 degree video sphere?
Game View in the Editor
Scene View in the Editor
View on Phone

So for anybody following this thread. The problem is that GVR SDK apparently do not support .mov format as of now even when Unity does. So we converted the video in a .webm format and it is working not to the best of our expectations but does the job of playing the Alpha Videos inside the sphere playing the stereoscopic video for now.
Also note that out of the shaders present in default with Unity only FX/Flare shader works well with this format to play videos in VR.
P.S. I also tried to place a PNG image as a component inside the view, even that is not working for now, even when it works in Unity.

Related

Transparent video in Android AR Scene

I am looking to solve the problem of displaying a transparent video in the AR scenes using Unity ARFoundation and Android platform.
I mean, accurately with a simple effect presented for the iOS platform: https://www.youtube.com/watch?v=vralbqaeqrk
In the normal 3D application I use the transcoded .Webm file and I achieve the intended purpose.
Using the same solution in the AR (ARCore) scene the background color is visible.
Can you use specialized/dedicated assets? Or should I stop dreaming about such a result using Unity and Android?
You need to make sure that your video clip does have an alpha channel then just click keep alpha property in video importing section and hit apply. However it will only show if your video does have an alpha.
Then just attach a Video player component to the gameobject which has a Mesh renderer.
Make sure the Render mode is Material override and Material property tells unity on which map of the material video output will be displayed.
If you want to play it on UI, just make a render texture and assign it to RawImage and assign the Video player with following settings.
Lastly make sure the render texture you created does have support for alpha.

Unity how to play video on plane without being affected by lighting

I'm trying to play a video in Unity. I figured it can be done with the VideoPlayer, so I put a VideoPlayer with a RenderTexture on a Plane and created a Material for the Plane that utilises this texture to render the video.
This works fine.
However, the video appears way to bright compared to the original content. You can see this on these pictures:
I found this video https://www.youtube.com/watch?v=KG2aq_CY7pU which looked promising but afterall didn't change the result, the video still appears way too bright.
Here is how I configured the Material
This is how the GO structure is set up
Config of the VideoPlayer
and the config of the Plane
How can I play the video just "normal" like I would see it in VLC Player or any other video player?
P.S. Not sure if it is important but I'm working on an AR Project with Vuforia, where the video is supposed to be played on the image target. But it makes no difference if I play the video on the target or in a scene in Unity, it is the same effect.
Thank you!
Don't use the emission. Instead rather simply use a Shader that is Unlit (basically meaning no shadows, it is always fully illuminated).
In your case you can simply use the built-in shader
Unlit -> Texture and should be fine,

Minimising the shaking or jumpiness of AR video when played over marker image using Vuforia in Unity3D

I am playing video over image target using vuforia plugin in unity3d. It is simple green screen video. I am using shader to remove it.
Sometimes when video played over image target it becomes too shaky and jittery and thus reducing the AR experience. How can I avoid or reduce it.
I tried multiple ways to get rid of it but no success. Here is what I tried:
Previously I was embedding the video in a Plane then I used Quad
but no success.
I tried to change AR camera (World Center Mode) to different
values like FIRST_TARGET,CAMERA and SPECIFIC_TARGET but still same problem.
Also my vuforia target image has 5 rating in vuforia database.
What could be the solution to this problem. Any help would be highly appreciated. Thanks!

How can I turn off camera video background in Unity ARKit

I'm trying to build a "lights-off" feature in my ARKit app, where I basically turn off the camera video background and only show my 3D content, sort of like VR.
Could someone please help me figure out how to turn off the the video background. I can see that a material called YuVMaterial is being used to render the camera texture but setting that to single color actually covers the entire screen and doesn't show my 3D content either.
You can uncheck the UnityEngine.XR.ARFoundation.ARCameraBackground component under the main AR camera, it will just render a black background.
In Unity, you can switch between cameras while using ARKit. The main camera has a run time spherical video applied to it, so it's not actually your device camera, but a rendering of what the device camera sees. By switching cameras, you can effectively "turn off" the background video image, but still take advantage of the ARKit properties. Have fun.

Sphere not rendering in Unity for Google Cardboard

I was following this blog post on how to implement 360 degree video in Unity. At the end, I used ffmpeg to split the video into individual frames as recommended. I also set the first frame as the texture for each material on each sphere. The end result looks like this
bad sphere
The big problem though is that once I build and run it on my phone or just play the scene itself, the sphere simply fails to render. Could this be caused by the texture being the first frame? Or am I making some other sort of error? Many thanks.
Movies in Unity are usually rendered as textures on objects. On mobile the issue becomes that the device only wants to display video in a video player, so the Unity class MovieTexture is not supported.
I am having success circumventing this, and successfully rendering 360-video on the inside of a sphere using a Unity plug-in from the Unity Asset Store called, Easy Movie Texture.
For working on a Mac, here's what I did:
Download the Easy Movie Texture plug-in from the Unity Asset Store
Open the Demo Sphere demo scene from Assets/EasyMovieTexture/Scene
Create a new (empty) Prefab to your project, and drag the Sphere GameObject from the Demo Sphere scene onto the Prefab.
Reopen your Cardboard scene and drag the new videosphere prefab into your hierarchy.
Open your source 360-video in Quicktime
File -> Export -> 720p
Change file extension from '.mov' to '.mp4'
Drag your new mp4 file into your projects Assets/Streaming Assets directory. Note: don't import through the menu system, as this will force Unity to convert to OGG.
On the "Media Player Ctrl" script component of your videosphere GameObject, locate the "Str_File_Name" field and provide the FULL filename of your newly exported video file. Make sure to include the extension as part of the string, "mymovie.mp4".
Pretty sure that's everything. Hope it helps other folks stuck on this problem.
Final note, the video will only render on the device. In the editor you will only see a white texture on the sphere. You have to publish to the device in order to see your awesome 360-video.