Making Skyboxes Directly in Unity

Robert Prehn
acrossthegalaxy
Published in
2 min readOct 19, 2016

Here’s how you can create skybox assets directly in Unity.

All the tutorials I could find were actually for creating skyboxes in Blender and importing them to Unity. They all follow the same rough procedure — use the blender vertex painting tools to paint on a sphere, then reflect that skybox onto a cube, and then unwrap the cube into a texture. I’m bad at Blender (but learning!), and so I was looking for another way to do the same thing.

I figured out that in a few steps, you could do something similar directly in Unity:

  1. First, you make a new blank scene where you will compose your skybox. The camera “background” should be the background / default color of your skybox. Since my skybox is stars in space, my background was black.
  2. Then you place objects in your scene that you want to bake into your skybox — in my case, this was bright spheres that served as stars. In your case, you could have mesh clouds or even particle systems. Since I needed to place a lot of “stars”, I made a script to place them procedurally. You could place objects by hand. Billboards are great for this. Since this scene will be reduced to a still image, billboard effects are not noticeable. In my case, I also included a few “nebula” billboards.
  3. Once your scene is composed the way you want, you attach this script to your camera:

Run the scene. When you hit a key, the script will capture a cubemap from the camera’s perspective and save it as a cubemap texture asset. You can then use the Skybox > Cubemap shader to create a skybox usable in your main scene.

I like this approach for a couple of reasons. You can re-use familiar 3D assets to create a more cohesive look between skybox and scene. It plays well with procedural generators. You could even tweak this approach to do procedural skyboxes at load time.

Hope it helps.

--

--