Write an interactive visualization for a galaxy collision simulation
Zylatis Code and Eng DK30 Quarantine 2020 1 2
Description
I currently have a janky C++ N-body sim which works okay, however there is no good visualization support (apart from dumping data to file, making images, then turning into a movie). I’m getting more an more interested in OpenGL and game engine programming and so my project is to turn the nbody sim into a self contained visualizer which runs in real time and allows some user input/camera control, and also looks pretty.
I also might try do some coding streams though I am in Sydney and so times might be weird for people in the wider world.
Recent Updates
This week wasn’t super productive but I did spend some time on a bit of a tangent looking at the sim code itself rather than the visualisation part. I continued with Cherno’s OpenGL series so that was good but I also revisitied the Barnes Hutt alg to try work out why it was giving different results. I think I have identified the discrepancy but it’s a bit concerning as it’s basically to do with the order of adding large/small numbers together, specifically floats, which is a known problem but honestly using doubles shouldn’t be an issue, so this is a problem, to be continued…
I don’t know if I’ll learn enough OpenGL before the end of DK30 to get the visualisation up but I’m definitely taking forward steps!
Also for some context, as mentioned this simulation already works (though the Barnes Hutt alg is still buggy) and it is possible to do visualisations, just not super nice ones. An example of two Plummer spheres (balls of stars) done with the existing code can be found here
https://www.dropbox.com/s/qb2e9uv49lgp52n/large_sim.MP4?dl=0
So i’ve got the imGUI stuff compiling better but I got lost down a rabbit hole of trying to understand why a parallel (via openmp) part of my code wasn’t working (notably trying to use the symmetry of Newtonian force to save some cycles but I was getting a different answer when I increased the number of threads, was quite odd, no obvious race conditions occuring). In the end I think it’s best to not be a dog with a bone, put that on the back burner, and get back to the task at hand. So I will be dumping the old code on a separate archive branch and begin some basic tidying up of the code in preparation for better visualization. In order to do said visualisation I plan to get through as much of Cherno’s OpenGL series as I can this week, which I think culminates in batch rendering which will definitely be useful when I have thousands of particles!
Estimated Timeframe
Apr 24th - May 24th
Week 1 Goal
Fix compile time with imgui and get basic 3D scene rendering. The goal here is to just get some dots in a 3D scene. I suspect this will be challenging and might bleed into week 2
Week 2 Goal
Possibly some overlap with week 1 but if all that is done then start work on UI/UX for a fixed camera situation.
Week 3 Goal
Make as pretty as possible (floor reflection, star effects, camera effects)
Week 4 Goal
Try to fix current (buggy) implementation of Barnes-Hutt alg to enable larger sims