Camera Feed on Background — Unity Asset that uses Back/Rear or Front/Face Camera on the player’s mobile device to display the Live Video Input on the Background of the Scene. Safety First.
It doesn’t use any Motion Sensor of a Mobile Device (Gyroscope or Accelerometer) to rotate the Game World like in AR Camera Lite or in AR + VR: MR Camera.
With adding rotation of the Game Camera with the Motion Sensor of a Mobile Device (Gyroscope or Accelerometer), Camera Feed on Background can be used as a “Pseudo AR Camera” to display 2D or 3D objects as though they were in the real world.
Does your asset actually rotate the video feed of the WebCamTexture or is it simply relying on rotating a game object that displays the feed? I am looking to take in the video from the phone camera and send it to a RenderTextrure that will be streamed using Dolby.IO. The phone camera comes in at 90 degrees rotated. I can rotate the object that has the RenDerTexture so that it shows up correctly in the app, but the stream still has the rotated video. I also have a need to make sure the video is portrait instead of landscape.
P.S. I have a workaround for one Known Issue (Bug in Unity Engine) for which I submitted a bug report last year. WebCamTexture lagging can be detected on some mobile devices when orientation changing or camera switching.
Solution: use the only orientation in your game without changing it and without camera switching during the game. Vote On for resolving this bug on Unity Issue Tracker: the more votes it has, the faster the issue will be solved.
Here are just a few (not all) successful examples (Unity Assets) without this bug and with using the only orientation:
Q 1 This asset can be used to render camera feed onto unity RawImage through WebCamTexture Unity class?
A 1
Asset uses RawImage with WebCamTexture Unity class - the only mechanics provided.
Q 2 We can get “full screen” portrait mode camera feed with decent resolution, not zoomed in (image corresponds the image that you see with native camera), proper aspect ratio, properly oriented?
A 2
Asset provides fullscreen portrait or landscape mode of camera stream.
Resolution is set in the constructor such way:
new WebCamTexture(deviceName, Screen.width, Screen.height, requestedFPS)*.
It’s enough to get a good resolution and performance, you can change it as you want.
Zoom issue was fixed in the version 1.2. Check changelog. So the video will cover all the background without cutting the extra space of stream, but it will be zoomed to cover black areas because the aspect ratio of mobile screen and camera stream are different.
Q 4 - Q5 We can access WebCamTexture instance that plugin uses and use it in our part of the system. In other words this plugin does not hide WebCamTexture instance behind some kind of an api? Is this plugin open source in a sense that we can adjust plugin code if needed?
A 4 - A5
All Source Code is open. You can access the WebCamTexture outside via this method: public WebCamTexture GetWebCamTexture()
A year ago, I noticed the strange behavior during the developing apps for iOS that uses WebCamTexture class by Unity: LOGS WERE NOT DISPLAYED IN XCODE in Both Modes: Development and Non-Development.
I thought that was a temporary issue, which will be resolved in the next releases of Unity: such small bugs often happen in Unity. Moreover, the workaround is simple: you can use Console in Unity Editor to connect to the iPhone remotely and see the log.
But a year later, the problem was not solved, and I sent a bug report to Unity Team about this error.
So Please Vote ON to solve the error faster: the more votes it has, the faster the issue will be solved.
P.S. Yes, you need to always send bug reports. Yes, it takes a time, but this is extremely important to support our favorite game engine and use it with a comfort.