Making a pretty n-body simulation

Click For Summary

Discussion Overview

The discussion revolves around enhancing the visual output of an n-body simulation created in Vpython, specifically focusing on improving the quality of the graphical representation of particles. Participants explore various tools and techniques for achieving better visuals, including the use of fog, lighting, and different rendering methods.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant seeks advice on improving the visual quality of their n-body simulation in Vpython, specifically desiring fog, lighting, and the ability to manipulate particle sizes.
  • Another participant suggests using Blender, an open-source game engine, as a potential solution for enhancing the simulation's visuals.
  • A different participant mentions the possibility of using OpenGL for rendering, questioning whether Vpython has OpenGL bindings.
  • One participant proposes an alternative approach of plotting stars as hard points with color intensity and applying Gaussian blur using the Python Imaging Library (PIL or Pillow).
  • Several participants express enthusiasm for Blender, indicating it could meet the original poster's needs.

Areas of Agreement / Disagreement

Participants generally agree that Blender is a promising option for improving the simulation's visuals, but there are multiple competing suggestions regarding other methods and tools, such as OpenGL and Gaussian blur techniques. The discussion remains unresolved regarding the best approach to take.

Contextual Notes

Participants have varying levels of familiarity with the suggested tools, and there is uncertainty about the capabilities of Vpython in relation to OpenGL. The discussion does not resolve which method is superior or most suitable for the original poster's needs.

Who May Find This Useful

Individuals interested in computer graphics, simulation visualization, or those working with Vpython and seeking to enhance their graphical outputs may find this discussion beneficial.

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   Reactions: 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
5K
Replies
10
Views
5K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 7 ·
Replies
7
Views
4K
  • · 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