From the feedback I receive for my developer blog posts I get to help a lot of new Unity3d VR developers get started. And one question I get asked a lot is about how to display panorama images.

I thought I’d write up a quick post about some ways you can incorporate those into Unity3d.

One common way is to create a 3d mesh of a sphere, and map a panoramic texture to the inside of it. However, an alternative way is to use Unity’s Skybox feature and render your image via a skybox material.

Firstly, you need to get a panoramic image…

Obtain a Panorama

One common format is the cylindrical projection (or more correctly an Equirectangular ) image. it’s a single rectangular image that wraps 360 degrees horizontally and 180 degrees vertically. It looks like this:

You can capture these types of images with a camera such as a Ricoh Theta S

Another common type of panorama is a cube map. The cube map has been a common way of creating skyboxes for games:

Many popular panorama creation software tools can output in cube map format.

One great tool I love for creating artificial space scapes is Spacescape which can output cube maps.

Use Unity’s SkyBox feature

So as I said above probably your first inclination is to assume you need a spherical mesh to map the image onto. But actually, even though I would say that is the most flexible way, you can use Unity3d’s built in skybox feature. The benefits of this is that you don’t need any meshes or to even write any code at all. You can quickly add this to your scene. The drawbacks is that Unity will typically create a larger texture making your app size larger.

OK, but lets assume we’ll use a skybox.

Step 1. Drag your image into Unity

If you don’t already have an image, download this one.

Step 2. Set the texture import settings to match the type of panoramic projection:

Firstly select Advanced (not cubemap – even if you have a cubemap).

Then, for cylindrical choose the mapping as “Latitude-Longitude Layout (Cylindrical).

And set your texture size as 4096 (larger then 4096 will fail to render on the GearVR):

If you have a cubemap single image, the choose the mapping as “6 Frames Layout (Cubic Environment)”.

If you have a cubemap comprised of 6 separate images, then for each one import as a standard texture but importantly set the Wrap mode to “clamp” to avoid seam lines.

Step 3.Create a Material for the texture

Create a new material., and for the shader choose “skybox/cubemap” and drag your texture onto the material.

If you are using 6 seperate images, the for the shader choose “skybox/6 sided” and drag each image onto the matching property.

Step 4. Add the Material as the Scene’s Skybox

Open the Scene’s Lighting settings (via the menu Window -> Lighting -> Scene tab)

At the top, under Environmental Lighting, drag the material onto the Skybox property:

Step 5. Done !

Set the project to VR mode (in Player Settings) and hit play in the Editor. You will now have a great panorama image to view !

Below is a unity package with a demonstration scene: