View on GitHub


Tutorial on creating planets of the solar system in Blender using Python scripting

Download this project as a .zip file Download this project as a tar.gz file

Creating planets of the solar system with Blender

These instructions will guide you through creating planets of the solar system in 3D using Blender and its Python API. At the end, you will have written a Python script which creates your planets, their orbits and even animates their rotation from scratch in one go. If you get stuck at some point, you can contact me at

Have fun!


Following files are provided/needed:

Other things you need:

It helps, if you are already a bit familiar with Blender's graphical user interface. Look at e.g. the Blender manual or follow these short Blender basics videos.

Ready? Let's get started!

Basic instructions

If this works, then you can go ahead, expand the script and experiment with the following tasks. If it didn't work, check the output in the console from which you started Blender for error messages.


More planets

So far, all these things can be done much faster via the interface. But such a script becomes very useful when creating more than one planet at once. Let's do this!

Sun material adjustments

The Sun is special, since it is a self-glowing star. Thus its material needs to be adjusted. In general, you can always discover the available attributes for objects and materials via the Python Console:

Colors and texture


Axial tilt

Extra: Add rings

Simple orbit paths

Extra: Orbit eccentricity

Camera Animation (may be skipped here)

Orbit animation

We will now let the planets move along their orbit paths.

Rotation animation

Planets also rotate around their own axes, that's given by rotperiod in the file. This gets slightly more complicated than just adding animation keyframes for the z-rotation values, because the planet's axes are already tilted. If a z-rotation is added, then the planet would rotate around the current z-axis, not around the planet-axis. You can see this easily with Saturn and its rings or Earth, when changing the z-rotation value in the 3D view, properties panel (enable with N if it is hidden).

We therefore use a special trick: we add an axes object for each planet and assign it the axial tilt. Then we clear the rotation of the planet and parent it to the axes object. This has the effect that the planet is basically unrotated, but inherits the tilt from its parent axes object. Now it's possible to keyframe the z-rotation of the planet!

Render your animation

Further improvements

The solar system that we built up to now is still lacking in many details. Here are some suggestions to improve it further:

If you made it this far: thanks for staying with me and congratulations! I hope you enjoyed this tutorial. For comments and suggestions, mistakes or questions, please send a mail to

Interested in my final version of the Python script, which includes the steps explained in this tutorial? I've uploaded it here: It doesn't contain the 'Further improvements' steps, however, since so far I didn't have enough time to include them all. If you manage to finish these, I would appreciate if you share your final version! :-)