[ cassette - portfolio ] [ project - origami-sunset ]



this project is a night-sky map tool in C++! it renders a database of 5000 stars and constellations in pure C++ (using GLFW to present on desktop).


the right ascension (RA) and declination (DEC) of each star is stored, along with its visual magnitude, name, and a few other attributes, which allows it to be placed on a unit sphere around the virtual camera, and drawn with a size according to brightness.


i implemented a few rendering tricks to reduce the amount of computation being performed (since the renderer is CPU-based), such as eliminating the depth (Z and W) component of the transformation, and performing the transform from view space to raster space in (almost) a single step.


this delivers a 0.3ms frame time for 5k stars on a single thread. i will later be bringing this codebase to an embedded microcontroller (hence the pure-C++, CPU-based rendering), which will have a lot less computing power. early testing (without optimisation enabled) has shown a 9ms frame time on the device (still comfortably above 60fps).



the constellation and star data is sourced from Wikipedia 'List of Stars in [X]' articles combined with research using Stellarium (an excellent existing night-sky explorer). however, i've been working to replace my current database with a more comprehensive one.


i've written data processing code to read in various scientific catalogs of stars, galaxies, nebulae, star clusters, etc, and standardise and merge the entries into a single master catalog (which will then be exported into the main project, since performing catalog deserialisation and deduplication is actually *really* intensive, taking about a minute to complete and hitting a gigabyte of memory at peak; not viable for an embedded microcontroller).


catalog-tool can decode Henry Draper, Hipparcos, New General Catalog, Messier, Flamsteed, and Bright Star Catalog, and most of the merging code is also complete. i intend to also load the Harvard Revised catalog, which will then be merged with the existing data. this will likely require manual cleanup as many Messier objects do not have descriptive names (e.g. the Pleiades will simply be named M45. i would want access to both the common name and the Messier identifier).


this will give me a much more complete dataset, with more information about each object. it does increase the dataset size to 300k, which is quite a significant increase from 5k, so i may need to implement some additional culling behaviour (such as culling celestial objects within offscreen constellations).


i also plan to implement tracking of the planets, sun, and moon, which will depend on being able to configure the current time, latitude, and longitude, and perform an additional transformation to correct for this.