Creating Procedural Skyboxes

In Unity

In a previous project, I wrote about creating a skybox out of images, but we can also procedurally create our own!

Usually, we can already find a new scene populated with the default skybox, if we want to change this, we can open up our Lighting window to alter the Environment settings.

Alternatively, we can create our own Material in the Project window. This will create a standard material, but if we enter the Shader menu at the top of the Inspector, and select one of the Skybox options — in this case procedural.

Now we have a similar situation to the default skybox above and can change settings to suit our scene. For this example, I’m going to try create a foreign planet atmosphere, so if we were to expand on our interior scene to include outdoor elements, we have a skybox already in place that fits.

From top to bottom we have the following:

Sun Size — Self explanatory, changes the size of the big bright ball in the sky! Although, the drop down menu above allows us to disable this altogether if we wish!

Sun Size Convergence — This dictates the effect that seemingly blurs the edges of the sun, somewhat softening or sharpening, and spilling out respectively.

Atmosphere Thickness — Alters the density of light allowed to pass through, higher settings allow for a smokey-like haze.

Sky Tint and Ground Colour — Allows for custom color properties.

Exposure — Standard brightness exposure settings.

Only a few variable changes allows for a drastic difference to the default skybox!

We can also simulate our sunlight by using a Directional Light. Back in our Lighting window, a directional light can be passed in as our Sun Source. On top of the typical lighting settings, the key element to procedural skyboxes, is that we can simulate the sun’s position by rotating the directional light in the scene. Adding functionality to this could easily generate a day-night cycle in our game or scene.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store