I’m currently testing out a few ideas for piecing together a galaxy simulation, and I was wondering if it was possible to simulate gravity in particle systems. Clearly, “gravity” is already applied by default, but this is only a representation of what we see every day on earth; I’m talking about simulating gravity as seen on an interstellar level, where it is more apparent that masses are attracted to each other due to the curvature of spacetime.
I’ve been wondering if I can approximate this in some way; i.e., is there a way that I can set up a particle system with varying particle sizes so that smaller particles gravitate towards larger ones over time (in the real world, of course, they would both gravitate towards each other - just at different rates - but I think that in a simulation as large as this, that wouldn’t be very noticeable)?
If there isn’t already a feature like this in Blender, where would be the best place to start on scripting something like this (I’m familiar with some aspects of Python in Blender, but primarily in editing mesh objects - not so much in working with the physics engine).
I actually stumbled upon this by accident, I don’t know if it’s exactly what you are looking for but I ended up with something of a galaxy.
Created a sphere, then go to quick explode, call this sphere the exploding sphere (put it on another non-visible layer, as it will be used as a particle object).
Then create another sphere to emit particles, call this sphere the emitter, add a particle system to it and have the particles spew (velocity) from the normal (gravity off 0.0).
Then I set the exploding sphere to the particle system as an object.
This is as far as I remembered as I trashed the source since it wasn’t what I was looking for but I remembered animating it and it looked like a galaxy. I think this may be a starting point, but it’s still pseudo and not true interstellar gravity.
Technically you could create a particle system, where each particle has a force.
1: Turn off gravity in the Scene menu
2: Create the particles, and under the Force Field Settings:
- check the self-effect box
- Set Type 1 to Force
- change strength to a negative value
- change the power to 2
Then you just have to make sure that the particles are injected into the right place. Note you can keyframe the strenght so you can emit the particles freely, and then later increase the strength to give you gravity. You may have to play with the strength and the paritcle mass and size (check the multiply mass with size checkbox) to get the right effects
Sandra, thanks for the tip! I’ve actually just been using an emitter object without the explode modifier - I have it spitting out particles for ~200 frames and I let the vortex force field (among other force fields) shape them, but I’m definitely going to try what you posted, as I’m curious to see how it’ll turn out.
BiggR, you are a life saver! I didn’t really know about the capability for particles to effect each other in that way. I actually ended up leaving the “self-effect” box unchecked, as I had two particle systems. One only had a few particles - these shape the clusters -, and the other had several thousand. The several thousand then clustered around the few, but the few weren’t attracted to each other. This produced (after tweaking the strength, power, and flow settings) something like this:
Which is pretty much exactly what I was hoping for (obviously, I would need to apply this to my spiral galaxy with the already-existing force fields, but for a test, it worked really well).
Photox; hmmm… In this case, I was planning on faking the formation of a galaxy and having it look really cool. But it would be pretty neat to simulate the motion patterns of a group of masses with newtonian laws as well (if not in the same project, perhaps in a different one).