How to Catch the Player’s Eye

January 31st, 2018

Accessing The Vive’s Built In Camera


Every Vive headset has a small camera that sits right in the middle.  It’s not a great camera but I needed to figure out how to access it from inside Unreal for a project I’m working on. I looked and looked for some tutorials on how to accomplish this but all I found were links to extra plugins I could download and bunch of really complicated work-arounds, but it seemed like it should be really simple. Well, it turns out it is.


What you have to keep in mind is that the Vive external camera is just a webcam, so you can access it like any other camera attached to your machine. To do this we are going to make use of the Unreal Media Framework (docs here). First let’s create a media player. Something that will open up the stream from the Vive’s camera and write it to a texture. You can create one from the “create menu”.  I’ve named mine “MP_ViveCam”.

It should prompt you to see if you’d like to create an output texture as well.Click yes and you should see both in your content browser.

Now we need to create a material that uses the texture output we just created. Create a new material and drag the texture from the content browser into the material.

Set the shading model to unlit and drag the output pin from the texture to your material’s emissive channel.

Now all we need is an actor that ties everything together.  Create a new actor class and give it some sort of static mesh or plane. For the purposes of this example I’m using a media plane component. Set the material on your geometry to the newly created material we just made.

Now add a variable to your actor and make it’s type the Media Player class you created earlier. To wire this all up we need the path to the Vive camera. Luckily Unreal makes this pretty simple. There’s a function you can access called “enumerate video capture devices”.

If we call this it will give us a list of all the available video sources on the machine we are running on. To specify the vive we can loop through them looking for the one named “HTC Vive”.

**Note: The image above this should have a connection going from the finish execution pin of the play node back to the for loops break node.


And that’s it. You should be able to place your actor in a scene and it will stream directly from your Vive’s camera to any geometry you put your material on.

back to blog