Rendering a 360 Panorama as a Skybox background in Unity

Unity (unity3d.com) is a popular tool for creating 3D (and 2D) content for Virtual Reality, video games, and simulations.

A Skybox is basically a 360-degree background displayed around everything else in your Unity scene.  By looking around the scene (rotating the camera) you can view the entire panorama assuming no other objects have been placed in the scene to block the camera’s view.

Most guides to setting up a skybox advise you to use six separate images; one for each side of a cube.  This works great – but better results can be had with even less effort by using 360 panoramas instead.

Start with a new 3D project:

svrskyboxdemo1_1

Locate a 360 still image you would like to use as the skybox, and drag it into the Assets pane.

svrskyboxdemo1_2

Select the file you added to the Assets pane, and change the Texture Type in the Inspector pane to Cubemap. Then change the Mapping to “Latitude-Longitude Layout (Cylindrical)”. Click Apply.

svrskyboxdemo1_5

Right-click anywhere in the Assets pane, and select Create–>Material.  Give the new material a name – we are using “skyboxMaterial”

svrskyboxdemo1_3

svrskyboxdemo1_6

Select the Skybox/Cubemap shader.  Drag your material from the Assets pane to the Cubemap in the Inspector

svrskyboxdemo1_7

svrskyboxdemo1_8

Now select Window–>Lighting from the top menu bar.

Drag your material (named skyboxMaterial in our example) to the Skybox in the Lighting window.  You’ll see the scene update behind it with your panorama.

svrskyboxdemo1_9

Close the lighting window.

That’s it!  You can use whatever method of panning around the scene is appropriate for your platform to look around your panorama.  On windows, this means holding down the right mouse button and dragging the mouse.

You can download the full Unity project here:

svrskyboxdemo1