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.
Create a new Material and name it ricoh360_skybox (for example). Change its Shader to “Skybox/Panoramic”.
Open Window -> Rendering -> Lighting Settings. Then just drag that new Material you created into the “Skybox Material” box.
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;
}
}
Save script
In Unity, create an empty gameobject and attach the script to it.
Drag in the “ricoh360_skybox” material in the “Cam Material” field under the script component of your new gameobject.
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#.
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
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?
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.