Creating the Stars


The fall term is quickly coming to end, and our team has finished the final version of our design document. With that done, we have focused our full attention on v0.0.2, the final assignment of the term. For this iteration, I am working on implementing a feature that allows the user to see where stars and constellations are relative to their position in the environment. This process consists of gathering real positional data for each star from the SIMBAD astronomical database, maintained by the Centre de données astronomiques de Strasbourg (CDS). Then the data is used to spawn each individual star in the constellation within a Bevy application. Below I will walk you through the process of creating a prototype for this feature, where real positional data is used to spawn stars belonging to the Andromeda constellation.

Gathering the Data

The first step is to gather the data for the constellation using data available through the IAU. The database is queried for each star by identifier.

Andromeda – source: https://www.iau.org/public/themes/constellations/

The identifier used in the query is flexible. A query for “Almach”, “γ and”, or “gam and” will all return the data for Gamma Andromedae (http://simbad.cds.unistra.fr/simbad/sim-id?Ident=%CE%B3+And&submit=submit+id).

On this page, we are interested in the Right Ascension, Declination, and Parallax. With these measurements we can determine where to place the star using Cartesian coordinates.

The page for Gamma Andromedae with the measurements we are interested in circled in red.

This data is compiled in an excel sheet where calculations are done to convert the right ascension, declination, and parallax into xyz-coordinates. First the right ascension is converted from hours, minutes, seconds into degrees. Next the declination is converted from degrees, minutes, seconds into degrees. Finally, the parallax is converted from milliarc-seconds (mas) to parsecs. Once these units are converted, we can calculate the xyz-coordinates using trigonometry.

Positional data for stars in the Andromeda constellation.
Andromeda in bevy

Now that we have coordinates for each star in the constellation, we can create a system to spawn those stars in the environment. Each star will be spawned with a DirectionalLightBundle and a PbrBundle. In an new *.rs file we create a public function that takes commands, meshes, and materials as parameters. The spawn method is called to create the DirectionalLightBundle and PbrBundle at the coordinates from excel.

The coordinates from excel are inserted into the arguments for Transform::from_xyz( ) in the transform fields.

This function is completed for the remaining stars in the excel file. In a separate file, main.rs, we call this system using add_startup_system( ). For the purposes of prototyping, a 3D camera is included from the crate smooth_bevy_cameras. The end result is an application that allows a user to fly around our constellation.

Looking ahead

Creating this prototype helped me get a grasp on how it will look when stars are positioned using this process. From this point, I want to include the lines between stars that are familiar to anyone who has searched for an image of constellations. This will help make it easier to identify the constellation. The user will be able to show or hide these lines. Then the 3D models for the stars will be created and used in place of the icospheres in this prototype.

This was a look into the development process of Space Atlas. Stay tuned for more!

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *