Python Making a pretty n-body simulation

Click For Summary
SUMMARY

The forum discussion centers on enhancing the visual quality of an n-body simulation created in Vpython, which currently outputs low-quality visuals. The user seeks to incorporate fog, lighting effects, and relative particle sizes while maintaining the ability to navigate the animation from different angles. Recommendations include using Blender, an open-source game engine, and exploring OpenGL for advanced rendering techniques. Additionally, the Python Imaging Library (PIL) is suggested for applying Gaussian blur effects to improve visual aesthetics.

PREREQUISITES
  • Familiarity with Vpython for n-body simulations
  • Basic understanding of Blender for 3D rendering
  • Knowledge of OpenGL for advanced graphics programming
  • Experience with the Python Imaging Library (PIL) for image processing
NEXT STEPS
  • Learn Blender for creating high-quality 3D visualizations
  • Explore OpenGL bindings for Vpython to enhance rendering capabilities
  • Investigate Gaussian blur techniques using the Python Imaging Library (PIL)
  • Research advanced lighting and fog effects in 3D simulations
USEFUL FOR

Developers and researchers working on simulations, 3D graphics enthusiasts, and anyone looking to improve the visual quality of scientific visualizations in Python.

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

  • · Replies 19 ·
Replies
19
Views
4K
Replies
10
Views
5K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K