Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Vive Tracker/Webcam alignment

Discussion in 'AR/VR (XR) Discussion' started by jeffcrouse, Sep 4, 2019.

  1. jeffcrouse

    jeffcrouse

    Joined:
    Apr 30, 2010
    Posts:
    18
    I am working on an AR project where I need a bunch of trackers to line up with a webcam feed. So far I have made a little rig like this:



    The Camera GameObject that sees the Vive controllers (Vive Camera) is parented to the TrackedObject that is the Tracker with the "R" In the picture, if that makes sense.



    The results I get are like this:



    As you can see, the alignment matches up in some cases, but gets way off in others.

    So my question is: what other factors do I have to account for to improve the alignment? And are there any utilities that might help with this?

    I am currently using a Logitech Webcam C930e, which has a 90 degree FOV, so I thought changing my Unity camera to the same FOV would be necessary, but that makes the results much worse.

    Thanks in advance!

    PS: I am using AVProCamera for the webcam stream and there is a horrible lag! But that is a separate issue.
     
  2. jeffcrouse

    jeffcrouse

    Joined:
    Apr 30, 2010
    Posts:
    18
    Update: Re: FOV - I completely missed that Unity allows you to pick the FOV Axis, and it defaults to vertical. So I was setting the Vertical FOV to 90 degrees (the horizontal FOV of my Logitech C930e). Once I fixed that, I got much better results. Still not perfect, though. So if anyone has any additional tips, I'd love to hear them.

    Also, when it comes to matching Vive trackers to a webcam stream, the Vive trackers are MUCH faster then my USB 2.0 webcam. Believe it or not, the webcam lag is not super noticeable if you are *only* looking at the webcam feed. It only becomes noticeable when you overlay the Vive trackers on top. So I created SteamVR_TrackedObject_Plus, which adds the ability to set a global lag time on the trackers (via a GameManager class, linked in the comments at the top of the Gist) so that they line up with the webcam.

    https://gist.github.com/jeffcrouse/50cada719e7b6f9201fc29802a427da4

    I've heard that USB 3.0 Webcams don't have as much lag, so I'll try that also, but this is a fine solution for now.

    It also allows you to set a serial number for each device so you can reliably know which TrackedObject is which. The GameManager class prints out all of the devices and their serial numbers on Play so you can copy and paste into the editor field. Someone could definitely create a more elegant solution to this, but this works for me at the moment.

     
    Last edited: Sep 6, 2019