May 1, 2022

Creating a procedural skybox material in Unity for TRAPPIST-1E

I've been doing some world-building lately for a drama/horror/science-fiction story I've been working on and have been researching habitable worlds. One planet that has caught my attention recently is TRAPPIST-1e. 

This planet is fascinating because it is both in the goldilocks zone for its star (TRAPPIST 1) and tidally locked. So, like our moon, one side is perpetually facing the sun while the other is the other side is dark. I thought these conditions would make for an exciting lighting environment within Unity to help me visualize life on TRAPPIST-1e.

The notes below are summarized from this excellent article: Alien Skies: The View from TRAPPIST-1e. 

TRAPPIST 1 is much cooler than our sun, but also much closer. With the right atmosphere the result could be temperatures that could sustain life. However, due to frequent solar flares, the bright side would be too hot depending on the atmosphere, so life is more likely to occur in the twilight zone at the terminus between the light and dark sides of the planet.

TRAPPIST-1 lacks blue light in its spectrum and appears only about 0.5% as bright as our sun does on earth - this would cause the sky to have a yellow or possibly greenish-yellow appearance. The atmosphere would reflect light that appears bright reddish-orange against a very dark yellowish sky.

TRAPPIST-1 would appear on the horizon as a perpetual setting sun with a deeper red colour than it would typically have when viewed high in the sky.

CREATE YOUR MATERIAL

  1. Right-click in your project window and select Create > Material
  2. Name the file e.g. Alien Skybox

UPDATE THE MATERIAL SHADER

  1. Select the material in the project window to view its properties.
  2. In the Shader drop-down select Skybox > Procedural

SELECT YOUR PROPERTIES
Tip: Adjust your camera in your scene so you can see the sun.

  1. The properties for the material updates in the Inspector window.
  2. Sun: You can switch between high quality and simple or none. High Quality is larger and has more of a halo effect. For my project I selected High Quality.
  3. Sun size adjusts the size of your sun it ranges between 0 and 1. TRAPPIST-1 would appear about 8 times larger than our sun in the TRAPPIST-1E Sky so I've set to sun size to 1.
  4. Sun size convergence also allows you to adjust the size of your sun. I adjusted mine to 1.65.
  5. The atmosphere thickness impact the hazy color at the horizon line. I still wanted to see the outline of the sun (for now) so have mine adjusted to 1.25.
  6. You can adjust the tint. A applied a very light green tint (#DAE7D7) to the sky to achieve the yellow green look of the sky. This took a lot of experimentation with different ranges of color to achieve what I was looking for.
  7. For the ground I have left it dark as I intend to add a terrain to the scene.
  8. Exposure increases the brightness of the scene. I have adjusted it a bit - this world will be fairly dark but I'll make adjustments as we start to add assets to the scene.

ADJUSTING THE SUN POSITION

The position of the sun in the skybox is based on the rotation of the directional light its attached to. If you are unsure which light it is attached to or no light is set you can find that information by checking Window > Rendering > Lighting Settings).

I made the following adjustments to the directional light in our scene.

  1. I set the rotation Y to 90. If facing North, this would put the sun setting in the west (or players left) horizon (TRAPPIST-1 would appear on the horizon as a perpetual setting sun).
  2. I changed the color to bright red, this may impact our scene later, but it seems to do the most to change the atmosphere color to red. (The atmosphere would reflect light that appears bright reddish-orange against a very dark yellowish sky).
  3. I left the Mode to mixed as I'll likely be using both Bake and Realtime lighting.
  4. I changed the intensity to 0.005. (The star appears only about 0.5% as bright as our sun does on earth [1 x 0.5%=0.005]).

As it is a very dark primitive planet. Those living near the terminus would also be able to see the stars. Next I'll be looking at create my own procedural skybox shader using Shader Graph so I'll be looking up to the heavens for more inspiration soon.