Search Unity

Multiple webcams with WebCamTexture

Discussion in 'Editor & General Support' started by cjdavies, Oct 23, 2013.

  1. cjdavies

    cjdavies

    Joined:
    Jun 23, 2013
    Posts:
    7
    I'm trying to achieve a stereoscopic webcam feed into Unity using 2x identical PlayStation Eye webcams WebCamTexture.

    Unfortunately WebCamTexture doesn't seem to have been written in a particularly sensible fashion identifies cameras by 'name' rather than by a unique identifier. If you have 2x identical webcams connected to the computer it will only identify 1 of them - calling WebCamTexture.devices.length will return 1 (presumably because the second camera overwrites the first or the second is ignored because it already has an identical entry for the first). If you Google on this issue you'll find that it has been brought up multiple times but I haven't been able to find any solution.

    I have tried using regedit to change the 'Device description', 'Friendly name' 'Display name' of the webcams from 'PS3Eye Camera' to 'PS3Eye 0' 'PS3Eye 1'. Windows Device Manager then shows them with their new names, but WebCamTexture still sees them as 'PS3Eye Camera'. The only remaining reference to 'PS3Eye Camera' is the 'Driver assembly description' but after searching replacing every single remaining instance of 'PS3Eye Camera' in regedit with other strings I cannot change this value.

    I'm beginning to suspect that WebCamTexture just considers any two cameras that use the same driver to be the same camera can't differentiate between them, even if they have different names/identifiers.

    Does anybody have any ideas? This seems like a really dumb shortfall that should never even have reached production code or at least should have been fixed very quickly.

    (In these pictures there are 2x PlayStation Eye webcams connected via USB, whilst the 'BisonCam' is the laptop's built-in webcam. Ignore the second image, there doesn't seem to be any way to delete an attachment...)
     

    Attached Files:

    Last edited: Oct 23, 2013
  2. cjdavies

    cjdavies

    Joined:
    Jun 23, 2013
    Posts:
    7
    For anybody who comes across this via Google, the only viable solution I have found is to use the CL-Eye Platform SDK write your own webcam handling logic instead of using WebCamTexture. This guy seems to have succeeded in doing just that, but the accompanying blog post is in Japanese (the code is still useful of course);

    http://d.hatena.ne.jp/hecomi/20130731/1375279561

    Edit: I got his unitypackage working with my 2x PS Eye cameras, but I had to downgrade to Unity 4.1.5f1 make sure to select development binaries when installing the CL Eye SDK (*not* redistributable binaries).
     
    Last edited: Nov 7, 2013
  3. dyadica

    dyadica

    Joined:
    May 12, 2014
    Posts:
    5
    Hi, just to let you know this seems to have been resolved within version 4.6. I am currently running two Logitech C310 cameras inspired by your Mirrorshades work using WebCamTexture with no issue.
     
  4. bin223

    bin223

    Joined:
    Sep 5, 2020
    Posts:
    2
    How can you solve it? I am also currently troubled by this problem and cannot run two cameras. unity2019