Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Making a pretty n-body simulation

  1. Feb 23, 2016 #1
    nbody1.png nbody2.png Hi all,
    I have recently created an nbody simulation in Vpython for a few thousand particles where each particle is about 4000 times the mass of our Sun. Vpython is doing exactly what I want it to do the only problem being the output is extremely low quality (black spheres on a white background). I was seeking help on how to jazz up the output so it looks something like in the above 2 screenshots.

    Things I have: location of each particle at each point in time
    Things I want: fog + lighting of particles and able to take care of relative particle sizes like Vpython
    Extra thing I want: be able to scroll around the animation to look at it from different angles (Vpython does this automatically for me)

    Thanks in advance!
     
  2. jcsd
  3. Feb 24, 2016 #2
    You could look into using an open source games engine such as blender.

    I worked on an astronomy visualisation project and that is what we used. Though I was working on Web scraping, so can't give you much more info than that.

    I think it would meet your needs though.
     
  4. Feb 24, 2016 #3
    Great thanks BOAS I did have a brief 5 second look at blender so it's good to hear your endorsement for it. I will focus my attention on blender now
     
  5. Feb 24, 2016 #4
    I don't know anything about vpython, but does it have OpenGL bindings? This would be fairly easy to do in OpenGL.
     
  6. Feb 24, 2016 #5
    Hi newjerseyrunner,

    I did see something mentioned about OpenGL but don't know enough about it to answer your question. I'm currently exploring the blender suggestion.

    Thanks
     
  7. Feb 25, 2016 #6

    Ibix

    User Avatar
    Science Advisor

    Depending on your hardware and required frame rate you might be able to get away with just plotting all your stara as hard points (rather than circles) in whatever colour and intensity and applying a Gaussian blur. Check out the Python Imaging Library (PIL or its fork, Pillow) which provides Gaussian blurs in its ImageFilter module.
     
  8. Feb 25, 2016 #7
    Lots of good suggestions thanks everyone. I will get around to all 3 suggestions eventually but looks like blender will keep me occupied for a while
     
  9. Feb 26, 2016 #8
    Blender is awesome and can really let you do some cool things.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook