Simulating the Celestial Sphere in Blender

Nightsky view can be simulated using real photos such as the ones from NASA's Scientific Visual Studio (Deep Star Maps). You can download various nightsky photos (Equatorial or Galactic) and other relevant maps (constellation figures, constellation boundaries, or coordinate grid). You can use these images in texture mapping to the Blender World to simulate the celestial sphere. This page describes how to create such a world from scratch, and the nightsky world is named “Night Sky (World)” in this example. This world setting can be saved as “asset” in Blender so that it can be reused in other Blender project.

Start a new blender file. Then, in the “Properties” tab, create a new world.

Then, in the Shade Editor, select “World”.

Add the following items in the editor. Two left parameter panels can be added by Adding “Input → Value”. The center panel named “stars-map” can be added by clicking “Background” which will take you to the node-group editor.

At later time, if you want to enter the node-group editor, click the upper-right corner icon. In the node-group editor shown below, add/connect necessary components (Texture coordinate, mapping, environment textures, etc.). In the example below, we are using three NASA maps (one for the skymap, another for bright stars, and the third one for constellation figures). For example, if you want to use two NASA maps for example (one for the star map and one for the constellation figures), you need to create two environment textures. You can add “environment texture” from the menu (Click Add then search for “environment …) or simply, drag the NASA map image into the Shade Editor. You can use .tiff or .png files directly, but .exr or .hdr files are preferred. Add as many “Add” or “Mix” as you need and the final configuration looks the following.

For the celestial sphere, we want to use a camera with a large field-of-view. For that purpose, we can use a panoramic view camera with a Fisheye panoramic type. Goto the Outliner window and select “View Layer” from where you can see camera. If no camera is available, add one.

Then, change the Panorama Type to “Fisheye Equisolid”. Be aware that this camera type only available for **Cycles* render engine so select the correct engine (from Properties window select “Render” tab to change the render type). Adjust the lens and FOV.

To see the resultant starmap background, you need to be in the render mode. You can rotate the world by clicking and dragging the middle mouse button. A rendered image from this setup is shown below (used four maps: star map, constellation boundary, constellartion figure, and RA/Dec grid). A dark curved bottom denotes a floor (i.e., horizon).

You can control the rotation of the World from a Python script. An example code is shown below.

bpy.data.worlds["Night Sky (World)"].node_tree.nodes["Group"].inputs[0].default_value[0] = 30.110472

Using a variation of this script, we can simulate diurnal rotation, seasonal rotation, horizon cutoff, atmospheric glow, etc.

The blender file created in this tutorial can be found here: NASA Star Maps as background.

Open the above Blender file in Blender, then choose “Viewport Shading” mode to be “Rendered” (See the screen capture below).

Then, rotate the skymap by click/drag the middle mouse button.

To make the result more useful and beautiful, one can add several improvements.

  • A realistic horizon (landscape with mountains or sky line).
  • Atmosphere effect (daytime/nighttime sun light effect, twilight, light pollution effect).
  • A new all-sky map can be made with “Constellation Artwork”. See the example from Stellarium below. We may be able to use Stellarium's constellation artwork. You can download individual Hevelius constellation artworks from here. Using these individual images, one has to make a master constellation-artwork skymap (edit and arrange them in some image editing software).

  • Add N/E/W/S point annotation on the horizon or viewport.
  • Create a full Python script that controls the particular teaching-moment scenario (i.e., the effect of sidereal rotation of the Earth).