• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by MSFX · Apr 03, 2013 at 10:13 PM · camerawebcamtexture

fullscreen webcam texture behind everything?

I have a model in my scene which my camera is orbiting and I want to have a webcam texture fullscreen behind it, sort of like augmented reality...

So, how can I render a fullscreen webcam texture behind the model in the scene no matter what direction the camera is pointing?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Apr 17, 2014 at 09:25 AM 0
Share

Go here for much example code http://answers.unity3d.com/questions/232168/how-can-i-get-the-device-camera-aspect-ratio.html

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by utahwithak · Aug 20, 2013 at 05:16 PM

Follow this guide to create your layers and cameras. then create a guitexture and apply the webcamtexture to that.

http://answers.unity3d.com/questions/9729/how-can-i-display-a-flat-background-2d-image-not-a.html

 public void Initialize(){
     Debug.Log("Initialize");

     BackgroundTexture = gameObject.AddComponent<GUITexture>();
     BackgroundTexture.pixelInset = new Rect(0,0,Screen.width,Screen.height);
             //set up camera
     WebCamDevice[] devices = WebCamTexture.devices;
     string backCamName="";
     for( int i = 0 ; i < devices.Length ; i++ ) {
         Debug.Log("Device:"+devices[i].name+ "IS FRONT FACING:"+devices[i].isFrontFacing);
         
         if (!devices[i].isFrontFacing) {
             backCamName = devices[i].name;
         }
     }
     
     CameraTexture = new WebCamTexture(backCamName,10000,10000,30);
     CameraTexture.Play();
     BackgroundTexture.texture = CameraTexture;
             
 }`
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image biffboff · Oct 22, 2014 at 11:45 PM 0
Share

Stupid question - but how to I add the code above to Unity to the texture? soz - im new :) !

avatar image mariamjasmine · Jan 21, 2017 at 04:28 PM 0
Share

I set up my cameras and layers, but where do I attach this script? You never specify this.

avatar image
0

Answer by Statement · Apr 04, 2013 at 12:18 AM

Create another camera that is looking at your textured plane (or just blit it to screen). If you go for the camera approach, just set it to draw before the other cameras you're using by setting its depth. The "normal" camera shouldn't clear color, depth only.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Projection mobile camera on a texture, at the same time using it as AR camera. Is it possible? 0 Answers

How to use device camera to click picture then store it in resources folder in runtime? 0 Answers

Unity Webcamtexture Camera very slow when using markerless ar unity asset 0 Answers

How to get best resolution from phone camera WebCamTexture? 2 Answers

WebCamTexture, correct resolution and RATIO.And FPS 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges