After stumbling through some outdated tutorials, I finally figured out how to use an equirectangular 360 image as a skybox in Unity. It’s pretty cool (and surprisingly simple) - if you do it right, you should see the colors of the 360 image reflected on any CGI object you put into the scene, which will make the object look more real. If you start getting interested in this, you’re going to end up reading plenty about physically-based rendering (PBR) and global illumination (GI).
This has to do with the behavior of light and the surfaces it hits. What it really comes down to is reflection. When light hits an object, some of that light is absorbed, which is light that we don’t see. The light we do see is the light that’s been reflected by the object’s surface - for example, my wireless mouse is blue because that’s the part of the light spectrum it doesn’t absorb, in other words the light that’s been reflected. The kind of reflection we usually picture when we think “reflection” - light that has been reflected at a direct angle, without penetrating the surface - is called “specular reflection.”
So some of the light that hits an object gets reflected, and some of it gets absorbed. But there’s another kind of reflection, called “diffuse” reflection, that’s somewhere in the middle. Here the light makes its way past the surface of the object, but then gets scattered back through the surface in an indirect manner, becoming visible to us. Diffuse light like this is softer than specular light. Highly reflective surfaces have very little diffuse light, because very little light has managed to penetrate the surface before scattering.
Here’s a much more in-depth look at PBR
PBR and GI go hand in hand. GI has to do with aspects of reflected light, like color bleeding. When light hits a surface and gets reflected, that reflected light carries some of the color from the surface of the object with it, imparting it to the next surface it comes in contact with. This continues until the light gets absorbed, which can lead to a kind of chain of reflections that can make for some pretty complex lighting if you’re gunning for a photorealistic CGI scene.
If you want to learn more about global illumination, you can look at this GI Tutorial
THETA for Skybox and Global Illumination in Unity
A “skybox” is basically what you use in a CGI scene as a background. To make my skybox, I took this image I shot with the THETA and dropped it into Unity.
All you have to do is drag and drop the image into Unity, and it will show up in the “Assets” section of the screen. When it does, set its “texture type” to “Cubemap” and hit “Apply.”
After that processes, head up to the menu tabs and click on “Assets,” then scroll down to “Create” and click on “Material.” Once you have your new material, set the “Shader.” Scroll down the menu to “Skybox” and click “Cubemap.”
After you do that, there should be a a box that reads “None (Cubemap).” That’s where you want to drag and drop your equirectangular image.
Click your new material in the “Assets” box and drop it into the scene. If you’ve done these steps correctly, you should end up with something like this.
Now you can see if your skybox is working in terms of GI, if the colors of the skybox will be reflected in CG object that you drop into the scene. Head up to “GameObject” and scroll down to “3D Object,” then click on “Sphere.”
You might want to make the sphere bigger using the “scale” X, Y, and Z input boxes. This will help you see the reflected colors more clearly. I set all of mine to 5. If you don’t have a directional light in your scene (although you probably started with one) the sphere will look something like this.
You can see how the lower part of the sphere is tinted orage (from the boat) while the rest of it is tinted blue (from the water and sky). If you don’t have a directional light, you can add one by clicking “GameObject,” scrolling to “Light,” and clicking “Directional Light.” I moved mine up to where the sun is in my skybox.
This will help make your sphere more realistic, like it’s actually in the scene.
You can mess with the “Intensity” of the directional light to change how washed out the sphere is, but there you have it! You’ve managed to get a CG sphere to reflect the colors of your THETA skybox! You’ve single-handedly managed to bridge the divide between computer graphics and reality.