Reputation: 3563
I'm implementing an augmented reality prototype. But I have not figured out how to set video as background. There is a WebCamTexture class which can be set as a texture for GUITexture. But in this case other 3d objects are not visible.
Upvotes: 1
Views: 3105
Reputation: 1
Attach following code to your main camera and you are done
public class webcam_example : MonoBehaviour
{
WebCamTexture webcamTexture;
bool webcam_ok = false;
void Start()
{
WebCamDevice[] webCams = WebCamTexture.devices;
if (webCams.Length > 0) {
webcamTexture = new WebCamTexture();
webcamTexture.Play();
webcam_ok = true;
}
}
void OnPreRender()
{
if (webcam_ok)
{
Graphics.Blit(webcamTexture, (RenderTexture)null);
}
}
}
Upvotes: 0
Reputation: 348
create 2 cameras, one set to view all the 3d object , the other with the GUITexture.
Upvotes: 0
Reputation: 902
Upvotes: 1