Moving a working webcam texture background project into an oculus VR project, can only see background now instead of the webcam video feed?
I am messing around with a possible augmented reality project utilising webcams and an oculus rift. I want to bring up overlays to the user's view, with the webcam always as the background layer. My project without Oculus enabled works fine:
But when I simply enable VR support (Oculus SDK) in edit -> project settings -> player, I can no longer see the webcam when i run it, neither in the scene view or through my CV1 oculus: Clearly it is showing the blue background setting instead of the background texture i am telling it to in code. When I move the oculus around, at the bottom i can only just see a slither of the webcam image poking through. Is there a simple layering issue i am not aware of?
I have tried this but I couldn't get it to work - I am not sure what the settings of the "WebCam" Material that he has in his Raw Image in the inspector, and alas I do not even really know what that material is. My naive thought is that since I have set the background texture to be the webcam texture, that should handle everything:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class webCam : MonoBehaviour
{
public RawImage rawimage;
void Start()
{
GUITexture BackgroundTexture = gameObject.AddComponent<GUITexture>();
BackgroundTexture.pixelInset = new Rect(0, 0, Screen.width, Screen.height);
WebCamDevice[] devices = WebCamTexture.devices;
WebCamTexture webcamTexture = new WebCamTexture(devices[0].name);
BackgroundTexture.texture = webcamTexture;
webcamTexture.Play();
}
}
I also tried this and this but I run into issues as they seem to be for older versions of unity that used options that no longer exist (well, were likely replaced by better ones).
I have to apologise because this is actually my first foray into Unity, so if I have missed out on fairly basic concepts then that is why. I intend to do some tutorials when I have time, but this is for a rapid prototyping project for work so I was really just hoping to get a basic demo of webcam(s) feeding into the oculus rift.
Thank you for your help
Your answer
Follow this Question
Related Questions
Game view color is different when running VR 0 Answers
multiple video sources AR (ARToolKit or Vuforia) 0 Answers
Help me doing teleportation with oculus touch 1 Answer
WebCamTexture nullpointerexception 1 Answer
Priview The Screenshot for User 0 Answers