Stream Ricoh Theta to Unity Skybox

Note: This was done with the Theta Z1, but should work with the others too.

Thought I’d share this here to help improve the quality of projects people are working on.

I noticed a lot of people are projecting the cam texture on a “inverted” sphere. The problem is that sphere’s are still polygons and create “edges” in your 360 image. It’s not pretty or professional. Even worse is if you decide to use it in room-scale VR - the sphere won’t move with you and it’ll just be weird (unless you make the sphere huge). The better way of doing it is to put it directly on the scene’s skybox.

  1. Create a new Material and name it ricoh360_skybox (for example). Change its Shader to “Skybox/Panoramic”.

  2. Open Window -> Rendering -> Lighting Settings. Then just drag that new Material you created into the “Skybox Material” box.

  3. Create a new script and call it “getRicohStream” (You can change it, but don’t forget to change the class name too).

Enter this C# code inside:

using UnityEngine;

public class getRicohStream : MonoBehaviour
{

    static WebCamTexture ricohStream;
    string camName = "RICOH THETA Z1 FullHD"; // Name of your camera. 
    public Material camMaterial;  // Skybox material

    void Start()
    {

        if (ricohStream == null)
            ricohStream = new WebCamTexture(camName, 3840, 1920); // Resolution you want

        if (!ricohStream.isPlaying)
            ricohStream.Play();

	if (camMaterial != null)
            camMaterial.mainTexture = ricohStream;

    }

}
  1. Save script

  2. In Unity, create an empty gameobject and attach the script to it.

  3. Drag in the “ricoh360_skybox” material in the “Cam Material” field under the script component of your new gameobject.

  4. Press Play.

(FYI - I couldn’t get the Ricoh Theta Z1 4K drivers working at the time of this post. That’s why I’m using “FullHD” instead for now.)

If anybody has suggestions for making it better, please do, as I am by no means a professional in Unity or C#.

2 Likes

This is awesome. I’m going to put this link on an upcoming list of development docs. Should I attribute this to RicoB? Or, do you want your full name?

It will be linked off of a new site at theta360.guide.

Below is how I envision a dropdown menu off of “Docs” in the navbar.

That’s a great idea to have those docs, but you don’t need to put my name. I like to help where I can, not because of recognition, but rather because I know how grateful I would have been finding this information back then. So why not pass it along and help people progress with their projects and move on to the next headache quicker haha. Plus, it’ll look cleaner with just the title :wink:

1 Like

Hey, thanks for this guide, it works really well!

I mean Unity hangs when I try to do this three or four times in a row, but then it will work and once it works it keeps running without a problem.

I would like to know if you know how to rotate the skybox? At the moment the ‘straight ahead view’ in unity is directly onto the stitch line between the two cameras. I tried to rotate the empty child object that the script is attached to, with no luck, also rotating the camera didn’t help. Is there some other way to rotate the image?

I’m not sure I understand the question. Do you mean that when you rotate the camera (virtual camera in Unity), the orientation of the video stream doesn’t change in the headset?

invert-camera

There’s an older discussion here:

Yes exactly! I could rotate but the video did not rotate.

What I realised works is to go to the skybox in the inspector, and there is a rotate variable there, but it is only in X, but that was good enough for me.

1 Like

The last time I used it, I was able to rotate all three axis, x,y,z. I haven’t tried it in a while.

This is old.

That looks great, but I see the issue is that you’re rotating the camera, but I have this set up for VR, and so the main camera is not functional.

Will play around with it, I’m sure there’s a VR camera tab somewhere :slight_smile:

it does not work with me, I got this error.

Couldn’t config the stream!
UnityEngine.StackTraceUtility:ExtractStackTrace ()

Are you using this driver?

Live video is not displayed on a Computer [RICOH THETA Z1] | RICOH THETA