Galaxy Simulator

Christiana Ushana - CPE 471 - Spring 2016 - Shinjiro Sueda

About

For my final Project in CPE 471, I decided to create a galaxy simulator. Outer space - it is the boundless freedom that lies outside of our reach, the incomprehensible matter that envelops us all, and the untainted unknown. My infatuation with the extensive world outside of our own inspired my creation of this project. This two-dimensional simulator begins its render as three separate galaxies spinning amongst themselves. When provided with a toggle, the galaxies "integrate", thus displaying a beautiful congregation of the three black holes and thousands of stars orbiting each other.

Stars

Each star uses a variation of the inverse square law. These stars orbit a single black hole (the center of the galaxy) and retain their own unique acceleration and velocity based on their location surrounding the center. The location of each of the stars is "pseudo-randomly" generated using a function with the time of the initial run of the program as the provided seed.

Black Holes

The center of every galaxy known to man has been theorized to retain a black hole. Black holes have a gravitational pull so strong that light is not able to escape - hence the appearance of it being black. When the toggle is pressed, the galaxies will move in relation to one another in the same way that a star does toward the center of its own galaxy.

Fragment Shader

Each star of its respective galaxy has been given a unique color. This makes it easier to view the congregation of the galaxies when they begin their rotation through and around each other.

Matrix Stack

By applying a transformation matrix, the orientation of each galaxy can be rotated, scaled, or translated. In this simulation, the original coordinate system of each galaxy has been rotated.

Camera

This simulation provides an A3 camera view. By clicking and dragging the screen, the user is able to view the simulation from different angles.

Controls

- The camera can move around the scene by clicking and dragging the mouse.
- Pressing the space bar will reinitialize all variables and begin the simulation from its "birth." The camera position is not reset.
- Pressing 'q' will begin the convergence of the galaxies.

"The Birth"

In the beginning of the render, the stars are randomly placed within a square for each galaxy. As mentioned previously, they are all given an initial velocity - this velocity is perpendicular to the direction of their acceleration. Thus, when the galaxies begin to spin, they will naturally form the "arms" of a galaxy. This happens because the outer stars will take longer to orbit around the galaxy than the inner stars.

birth.png

Shorter Arms - The arms form naturally based on the nature of the equation used.

shortArms.png

Longer Arms - The longer the simulation runs, the more circular the galaxies appear.

lengthyArms.png

"Integration"

Once the toggle is pressed, the integration of the galaxies will begin.

Integration Shot 1

IntegrationShot1.png

Integration Shot 2

IntegrationShot2.png

Integration Shot 3

IntegrationShot3.png

Integration Shot 4

IntegrationShot4.png

Video of Simulation

Resources


© 2016, by Christiana Ushana. All rights reserved.