• Jack Chen

NOC: Galaxies Simulation

My sketch this week is inspired by the predicted collision between the Milky Way and Andromeda Galaxies in the far future. As the two galaxies near each other, the stars surrounding each galaxy changes position as they interact with the other stars and the two black holes in the center of both galaxies' strong gravitational pull.

This is a video with more info about the collision:


A visualization of the collision:

I wanted to create a simplified version of the way stars group together to form galaxies and then change course when in the vicinity of other stars/galaxies.

Sketch, Version 1: https://editor.p5js.org/ukpfilms/sketches/Z0QSkIPzh

My sketch is modified from the flocking sketch example from this week's materials. I hard coded the values for alignment, cohesion, and separation to make the particles cluster together a bit but also have enough room to move around. Then I added a life time counter for the particles to simulate new stars being born then dying. The particle lifetime is also linked to the color and alpha of the particles so the stars are bright and red when they are born then get dimmer and more blue as they die. The size of the particles also changes randomly to mimic the look of stars flickering in space.

I tried adding some attractors in the sketch and use gravity to attract the stars to spin around points in the map to make it more similar to real galaxies having a big black hole in the center which attracts the stars to rotate around it, but I wasn't able to implement the function in properly. I realize the edges() function does not work with gravity attractors since particles will just keep showing up on the other side and get attracted faster in one direction, but even without the edges function the attractor still does not work properly


Sketch with an attempt to add attractors (does not work): https://editor.p5js.org/ukpfilms/sketches/TLWDRO821

Finally, I added a Perlin noise pixel background to simulate the look of nebulas in space for a more dynamic visual, but the sketch runs very slow with the Perlin noise background added.

Sketch with Perlin Noise Background (runs slow):


13 views0 comments

Recent Posts

See All

©2019 Zikang Chen 

Film making, videography, photography