Back to Trending
RepositoryCFIFinland
Avicted

Avicted/galaxy_visualization_raylib

This project visualizes 100,000 real galaxies in blue and 100,000 randomly distributed galaxies in red. The data is sourced from the GPU programming course at: Åbo Akademi University. Additional redshift survey data is also provided.

92stars
6forks
0issues
1views

Galaxy Visualization

The Course

This project visualizes 100,000 real galaxies in blue and 100,000 randomly distributed galaxies in red. The data is sourced from the GPU programming course at: Åbo Akademi University

The assignment is to use parallel programming with CUDA (or HIP) to calculate 10 billion (10 000 000 000) angles between galaxies and prove they are not randomly distributed. The students must leverage the GPU for these calculations on their own using a smaller compute cluster or supercomputer.

Note:

  • The students have to prove this on their own.
  • The expected runtime for the calculation is approximately 3 seconds.
    • It is possible to optimize the runtime to 0.33 seconds (275 ms kernel runtime) on a single GPU (my own solution tested with one AMD RX 6900 XT).
  • This program is a visualization of the data, not the solution to the assignment.
  • Additional redshift data from various surveys has been included for visualization purposes.

Prerequisites

This project can be built using clang/gcc through build.sh (raylib is the only dependency) or Meson as the build system.

Dependencies

  • Git
  • Base Development Tools (e.g. build-essential on Ubuntu)
  • Raylib (Tested with v5.5-1)
  • Clang (or GCC)
  • Meson (optional)
  • Python3 (optional, for embedded build compression)
  • gdb (optional)
  • ImageMagick (required for Windows icon embedding in mingw builds)

Installation Commands

Arch Linux

sudo pacman -S raylib base-devel meson git clang python imagemagick

Ubuntu

sudo apt-get install -y raylib build-essential meson git clang python3 imagemagick

Building

You can choose between two build modes:

  • Normal build: External asset files (45 KB binary + ~8 MB assets)
  • Embedded build: Single portable binary with all assets compressed (~6 MB)
  • Static raylib (optional): Links raylib statically while keeping system libraries dynamic

Using build.sh

# Make executable
chmod +x ./build.sh

# (Optional) download raylib subproject for static linking
meson subprojects download raylib

# Normal build (with external assets)
./build.sh

# Embedded build (single portable binary)
./build.sh --embed

# Embedded + static raylib
./build.sh --embed --static

# Build and run
./build.sh --run
./build.sh --embed --run

# Clean and rebuild
./build.sh --clean

# Show all options
./build.sh --help

Using Meson

# Normal build
meson setup build
meson compile -C build
./build/galaxy_visualization_raylib

# Embedded build (single portable binary)
meson setup build_embedded -Dembed_assets=true
meson compile -C build_embedded
./build_embedded/galaxy_visualization_raylib  # Can run from anywhere!

# Embedded + static raylib (system libs still dynamic)
meson subprojects download raylib
meson setup build_embedded_static -Dembed_assets=true -Draylib_static=true
meson compile -C build_embedded_static

# Clean
meson compile -C build --clean

If your system package does not provide a static raylib, use the Meson wrap subproject:

  • Run: meson subprojects download raylib
  • Meson will use the subproject when -Draylib_static=true is used

Cross-compiling for Windows (mingw64)

Install a mingw64 toolchain, then:

# Download raylib subproject (required for static linking)
meson subprojects download raylib

# Configure and build Windows .exe (embedded + static raylib)
meson setup build_mingw_embedded_static --cross-file ./cross/mingw64.ini -Dembed_assets=true -Draylib_static=true
meson compile -C build_mingw_embedded_static

Notes:

  • Windows builds embed the app icon into the .exe using ImageMagick during the build.

Or using build.sh:

./build.sh --mingw

Build Options

OptionDescriptionBinary Size
NormalExternal assets required~45 KB
Embedded (--embed or -Dembed_assets=true)All assets compressed into binary~6 MB
Static raylib (--static or -Draylib_static=true)raylib linked statically, system libs dynamicVaries

The embedded binary includes:

  • Fonts, shaders, and 3D models
  • All galaxy data (100k points × 2 datasets)
  • Redshift survey data (Seyfert + SAGA DR3)
  • Compressed with zlib (~40-50% compression ratio for text data)

Examples

real_data real_data


Data Sources & Attribution

This repository contains code and derived galaxy redshift data.
All original data are the property of their respective surveys and authors.
This project does not claim credit for the original data.

CfA Redshift Survey

Reference:

Huchra, J., Davis, M., Latham, D., & Tonry, J. (1983).
A survey of galaxy redshifts. I.
Astrophysical Journal Supplement Series, 52, 89.
ADS link


SAGA Survey

  • Original source: SAGA Survey III — Satellite Systems around Milky Way–mass Galaxies
  • URL / DOI: DOI:10.3847/1538-4357/ad64c4
  • Modifications: Only published redshifts relevant to this project are included; all other data excluded.

Reference:

Mao, Y.-Y., Geha, M., Wechsler, R. H., Asali, Y., Wang, Y., Kado-Fong, E., Kallivayalil, N., Nadler, E. O., Tollerud, E. J., Weiner, B., de los Reyes, M. A. C., & Wu, J. F. (2024).
The SAGA Survey. III. A Census of 101 Satellite Systems around Milky Way–mass Galaxies.
The Astrophysical Journal, 976(1), 117.
ADS link | arXiv:2404.14498


Usage & Citation

  • This repository contains code and derived datasets only.
  • Original surveys must always be cited when using the included redshift data.
  • If you use this repository for code or its cleaned dataset, you may cite it via the CITATION.cff file—but this does not replace citing the original surveys.

License

MIT License - see the LICENSE file for details

Similar Projects

Discover other similar projects and AI models.

RepositoryC
raysan5/raylib

A simple and easy-to-use library to enjoy videogames programming

35.9k
Dec 3, 2026
Repository
forthespada/CS-Books

🔥🔥超过1000本的计算机经典书籍、个人笔记资料以及本人在各平台发表文章中所涉及的资源等。书籍资源包括C/C++、Java、Python、Go语言、数据结构与算法、操作系统、后端架构、计算机系统知识、数据库、计算机网络、设计模式、前端、汇编以及校招社招各种面经~

28.2k
Nov 15, 2026
RepositoryC
Genymobile/scrcpy

Display and control your Android device

156.4k
Dec 1, 2026
RepositoryC
obsproject/obs-studio

OBS Studio - Free and open source software for live streaming and screen recording

80.4k
Nov 29, 2026
Repository
jlevy/the-art-of-command-line

Master the command line, in one page

162.8k
Jun 25, 2024
RepositoryTypeScript
clash-verge-rev/clash-verge-rev

A modern GUI client based on Tauri, designed to run in Windows, macOS and Linux for tailored proxy experience

162.3k
Dec 3, 2026
RepositoryJavaScript
nodejs/node

Node.js JavaScript runtime ✨🐢🚀✨

124.1k
Nov 30, 2026
RepositoryC++
godotengine/godot

Godot Engine – Multi-platform 2D and 3D game engine

121.3k
Dec 1, 2026
RepositoryPython
sherlock-project/sherlock

Hunt down social media accounts by username across social networks

120.7k
Dec 3, 2026