Python Making a pretty n-body simulation

AI Thread Summary
The discussion revolves around enhancing the visual output of an n-body simulation created in Vpython, where the user seeks to improve the low-quality rendering of particles. Key desires include adding fog and lighting effects, managing relative particle sizes, and enabling camera movement for different viewing angles. Suggestions from participants include using Blender, an open-source game engine, which is praised for its capabilities in astronomy visualization. There is also a mention of OpenGL as a potential tool for achieving better graphics, though the user is currently focused on exploring Blender. Additional advice includes using the Python Imaging Library (PIL or Pillow) for applying Gaussian blur effects to improve the visual quality of the simulation. Overall, the conversation emphasizes the pursuit of more sophisticated visual techniques to enhance the simulation's presentation.
jimbo007
Messages
41
Reaction score
2
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!
 
Technology news on Phys.org
jimbo007 said:
View attachment 96366 View attachment 96367 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!

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.
 
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
 
I don't know anything about vpython, but does it have OpenGL bindings? This would be fairly easy to do in OpenGL.
 
  • Like
Likes Silicon Waffle
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
 
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.
 
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
 
Blender is awesome and can really let you do some cool things.
 

Similar threads

Back
Top