Hi! More than 10 years have passed since the creation of the simulation, to my surprise, the video is still popular. I will try to briefly answer the questions that might arise. First of all, I've also made N-Body simulation, you can find it on my GitHub: github.com/DrA1ex/JS_ParticleSystem/blob/main/README.md#n-body-simulation About Simulation in the video: The simulation simulation is simplified, it's not an N-Body (each particle interacts with each other). All calculations been made for one point, which is controlled by the mouse. In order to implement precise calculation of physics, it will be necessary to do optimizations (e.g. clustering of points), otherwise the performance will be so much lower (the complexity of calculations instead of O(N) will be O(N^2)), but even with optimizations it will not be possible to achieve a significant increase in performance, since for a precise gravity calculation will need to calculate the interaction of each point with each other. For 1 thousand points, this will be up to 1 million operations. In my simplified version, 1 million points requires 1 million operations. You can try GPU (best for Desktop) in-browser simulation via WebGL: - 500,000 particles: dra1ex.github.io/WebGL_ParticleSystem/?particle_count=500000 - 1,000,000 particles: dra1ex.github.io/WebGL_ParticleSystem/?particle_count=1000000 - 2,000,000 particles: dra1ex.github.io/WebGL_ParticleSystem/?particle_count=2000000 - 4,000,000 particles: dra1ex.github.io/WebGL_ParticleSystem/?particle_count=4000000 My MacBook Pro 16 can simulate ~2,500,000 in 60fps Or you can try CPU (best for mobile) simulation via HTML5 Canvas: - 100,000 particles: dra1ex.github.io/JS_ParticleSystem/?particle_count=300000 - 500,000 particles: dra1ex.github.io/JS_ParticleSystem/?particle_count=500000 - 1,00,000 particles: dra1ex.github.io/JS_ParticleSystem/?particle_count=1000000 My IPhone 11 Pro can simulate ~600,000 in 60 fps At this moment I've made 3 main versions: - DirectX 9 (you see it in the video) version uses CPU for physics calculation, uses AVX vectorization for speedup. Points are drawn through the billboard technique (for texture mapping). Maximum number of points in real-time: about 1 million. - DirectX 10 version uses GPU for physics calculation. It's rendered through geometry shaders (a polygon is created from a point). The calculations located in shader, and results of iteration are dumpred into memory via the StreamOut technique. Maximum number of points in real-time: about 10 million. - WebGL 2.0 version uses GPU for physics calculation. Used Transform Feedback technique for GPGPU physics calculation. Number of points in real-time: about 5 million (maybe more). So what about source? - DirectX 9 version: github.com/DrA1ex/ParticleSystem - DirectX 10 version: github.com/DrA1ex/D3D10_ParticleSystem - Windows Forms version: github.com/DrA1ex/GDI_ParticlesSystem - JavaScript version: github.com/DrA1ex/JS_ParticleSystem - WebGL version: github.com/DrA1ex/WebGL_ParticleSystem I used DirectX for rendering, but the implementation can be done on any engine: OpenGL, Vulkan, Metal, even HTML5. I choose DirectX because 10 years ago there were more manuals about DirectX on the Internet. I'm also thinking about implementing a gravity simulation in WebGL (JavaScript or WASM), but a precice N-Body simulation with calculation optimization and of course with source code. So tell me, do you interested in such a simulation?
@9551Dev2 жыл бұрын
wow playing with this is really mesmorizing. looks very nice !
@water_is_wet2 жыл бұрын
great work
@JanPBtest2 жыл бұрын
What happened at 0:48 ?
@buttafan40102 жыл бұрын
Like a description of star birth, star death by super nova, black hole and void formation.
@Hibbyhubby2 жыл бұрын
yes for Precise N-Body Simulation!!! good work
@m.sierra52586 жыл бұрын
The youtube compression algorithm REALLY doesn't like this
@roygalaasen5 жыл бұрын
Oh man, not even in 720p could The compression algorithm handle, but it is not really weird. “Noise” like this require bandwidth to be rendered properly, and the compression algorithm is trying the hardest to keep the bandwidth down. Conflicting interests to say the least.
@m.sierra52582 жыл бұрын
@@roygalaasen Upscaled to 4k could probably handle it :D
@vincentschumann9372 жыл бұрын
@@m.sierra5258 double/triple the bitrate at 720 and it would look fine
@jaredf62052 жыл бұрын
Need to upload it to Vimeo. They have much higher bitrates if your connection can handle it.
@vitorstreetboys2 жыл бұрын
TRUE
@AlexNize12 жыл бұрын
I was changing the simulation parameters while recording video
@cicik574 жыл бұрын
you should not, instead you d better create many simulations with different params and compare but still amazing work, dud
@KK-pq6lu3 жыл бұрын
Edge artifacts? Looks like the particles can wrap?
@soliderarmatang56642 жыл бұрын
This is why I love KZbin, because of videos and people like this! Thanks for all the links!
@mikaelpaavola47812 жыл бұрын
This is so rad man. Cool of you to share the code!!
@yougeo8 жыл бұрын
Nice bit code appears to be 2d forces only. Also would be nice to see without infinite walls bounce of particles.
@AvZNaV10 жыл бұрын
What CPU are you running? Intel i81 @ 50GHz?
@samb72917 жыл бұрын
He is using his GPU. its magnitudes faster than that
@ShredST6 жыл бұрын
@@samb7291 The description says it's using an AVX particle system, so presumably it's running on the CPU.
@ylliimeri2 жыл бұрын
Nice looking simulation. But it doesn't seem to conserve angular momentum. At one point all particles were rotating in the same direction.
@monkeyman55132 жыл бұрын
You still conserve angular momentum when you have backwards rotation from the total momentum if other particles have extra angular momentum in the opposite direction to cancel it out
@ylliimeri2 жыл бұрын
@@monkeyman5513 well, true, but it doesn’t seem to be the case here. If you look at 3:10 all the particles are rotating counterclockwise, and unless a few of them rotate clockwise at very high speeds the angular momentum isn’t conserved. Btw, the initial angular momentum seems to be zero.
@srijanraghavula2 жыл бұрын
Beautiful simulation
@iinRez2 жыл бұрын
*This is what the Universe is doing. To us it's billions of years, at this scale it's 6 minutes.* *We are currently in the expansion period of this undulating phenomenon.*
@shivas30034 жыл бұрын
the nightmare for compression algorithm ^^
@vaughnalexander312 жыл бұрын
this video has been blessed by the algorithm
@AlexNize11 жыл бұрын
GPU version can. ~ 5m (2m pixels at FullHD) particles at 60 fps on GTX670
@grecinos212 жыл бұрын
I downloaded the CUDA SDK and the samples. After installing it, I was able to play with some of the demos and they are great! I have VS 12 and it is having a tough time loading the demo programs. The CUDA docs say that the samples are compatible with VS 8 and 10. Needless to say, I was unsuccessful at compiling them. My goal is to be able to animate an n-body simulation in 2-d w/o collision detection. Say, 100000 little circles and perhaps a planetoid for kicks.
@nullbeyondo3 жыл бұрын
This is beautiful.. I just wish KZbin didn't hate this video :D
@caseyford33682 жыл бұрын
It depends on what particles you're using and many other variables.
@shinshia2 жыл бұрын
After 10 years, algorithm finally bring me here
@marquizzo7 жыл бұрын
Thank you for sharing the source code!
@jyxtheberzerking48242 жыл бұрын
new xbox screensaver just dropped, looks awesome. edit: OLD xbox screensaver rediscovered, looks awesome.
@marianotrebino60278 жыл бұрын
Good job man!!!! Its beautiful, the only physics is the newtons gravity law? Do you apply any external force? Can you explain it to me or share a resource? I want to do something similar. Thank you!!!
@Azakadune2 жыл бұрын
Well that’s the only force you’d need. I’m guessing there ain’t any collisions based on how it behaves?
@jsstt2 жыл бұрын
"What are you watching son?" Chaos.
@Ryrzard9 жыл бұрын
We have just witnessed a star's life from beggining to the end.
@Ryrzard8 жыл бұрын
What do you mean?
@ImperativeGames8 жыл бұрын
I would say it represents Universe, with Big Bang and stuff like that
@Ryrzard8 жыл бұрын
Where was this big bang? I don't really see it here.
@ImperativeGames8 жыл бұрын
TheFarciarz777 When it all goes into one point, then everything explodes and new Universe created.
@Ryrzard8 жыл бұрын
Well, you can't really simulate a Big Bang in an euclidian space. Besides, plenty of stuff in the universe goes into a very close space and explodes after some time.
@nazardidkovskyi8 жыл бұрын
Hi, again) Do you use 3D space in this program? And do you use such parameters as mass of particles? Do this program compute force for all particles?(I mean the force with which each particle interacts with all 499 999 other) Because I can't get such performance in my program, though I'm using multithreading.
@AlexNize8 жыл бұрын
+Nazar Didkovskyy, привет. Это не N-Body симуляция, каждая частица взаимодействует только с одной. К тому же z-координата фиксирована и не рассчитывается.
@NimerionTech8 жыл бұрын
Hello Nazar. I just saw this video and your comment, and once encountered a similar problem, but with Flocking simulation. What I've learned was that you don't really need to go over all the other entities in your world to get them collide successfully. You can simply either make a grid model on which you can detect if the neighbor positions (sells) are empty, or not for every object. OR you can do a QuadTree which will increase the performance drastically. I've never tried a QuadTree, tho.
@patrickthepure6 жыл бұрын
See multilevel fast multipole method. It reduces the complexity from N^2 to somewhat like NlogN in these kind of situations.
Just stumbled upon this video and it’s pretty cool. I understand the GPU aspect of improving runtimes but what other approximations did you make? Did you use the fast multipole method to speed up the approximation?
@cmilkau2 жыл бұрын
0:48 What's going on here? Looks weird, like a sudden change in mean impulse.
@StanislavMarchevsky12 жыл бұрын
Это просто космос!
@timoakeley60859 жыл бұрын
truly amazing
@kazimierzmarkiel54002 жыл бұрын
What this animation is modelling? Gravitation itself causes the mass focusing in the the gravity center. What is causing the rotation of mass, repeated many times asymetric explosions, the changes of the center of gravity in the space ? Stary
@anchorcult7 жыл бұрын
BEAUTIFUL AN AMAZING MOMENT! GLAD I COULD BE A PART OF IT! OOIIOO
@emanueol2 жыл бұрын
great resources :) simple question, imagining you just have 3 particles.. does calculation use same location/vel/accl of each particle on beginning of each frame to calc (using newton f=m1*m2/D^2) or something more exotic ?
@aadiduggal18602 жыл бұрын
you can just use Newton's law as that's complex enough for a numerical solver. For the case of 3 particles, each particle would have a force vector in 2 directions. From that, you numerically integrate the summed forces which would result in position. For say, particle 1, we can simulate its acceleration (ẍ) as a function of its position to the other 2 particles (x1, x2, x3) as per Newton's law, f_i = m_i * ẍ_i = m_i * m_j / x_i ^ 2 ( where f_i is the force acted on the ith particle to the jth particle). The math would be something like this: f1 = m1 * ẍ1 = m1 * m2 / x2^2 f2 = m1 * ẍ1 = m1 * m3/ x3^2 (f1 + f2)/m1 = ẍ1 = m2/x2^2 + m3/x3^2 From this, you can probably tell a pattern that the other 2 particles would follow a similar procedure. In total we would have (assuming G = 1) : ẍ1 = m2/x2^2 + m3/x3^2 ẍ2 = m1/x1^2 + m3/x3^2 ẍ3 = m1/x1^2 + m2/x2^2 This is a fully defined system of differential equations which can now be numerically integrated with respect to time by a computer, giving us the positions of x1, x2, x3 which can be plotted with time and animated. You would, of course need the initial conditions for x and ẋ. Extending this to 500,000 particles would result in a system of 500,000 differential equations, which can really only be solved if you do some further optimization (and probably will need a supercomputer) which I'm not too familiar with. UPDATE: So it seems that the way this video works is that the particles are following the user's mouse. That's the same thing as here, with the difference being that your mouse would define the initial position coordinates of a very, very big mass. This video is NOT an N-body, so each particle is not being attracted to the other. Each particle is very small (pretty much 0 mass) and ONLY being attracted to the mouse. This greatly simplifies the calculations. Still, it's kinda cool to see everything coalesce into a sphere given enough time (which is why planets are round).
@emanueol2 жыл бұрын
@@aadiduggal1860 thanks for confirming :) I think you got typo on first x1 equation: I think instead of: ẍ1 = m2/x2^2 + m1/x1^2 should be ? ẍ1 = m2/x2^2 + m3/x3^2
@aadiduggal18602 жыл бұрын
@@emanueol yep, thanks for catching that.
@Broxzier12 жыл бұрын
Nicely done!
@riki_XD2 жыл бұрын
A 10 years old comment !
@Broxzier2 жыл бұрын
@@riki_XD A one-day-old reply!
@NAANsoft2 жыл бұрын
Do you include the time propagation of gravitaion - i.e. that gravity is propagating with the speed of light, not with infinite speed?
@Khepramancer5 жыл бұрын
0:48 Was that spontaneous?
@matthewsupra2 жыл бұрын
Mesmerising
@Xonatron11 жыл бұрын
Are they attracting each other, or just the center mass? I'm guessing the latter.
@professionalgoob2 жыл бұрын
This is amazing!
@mitchellkeenan435610 жыл бұрын
Best film i've ever seen
@szilardorosz3714 жыл бұрын
do the particles collide or just gravitate?
@christopherrogers5322 жыл бұрын
lol nothing like seeing a random video like this bob to the surface of youtube and getting sucked in. :)
@ShredST4 жыл бұрын
Was inspired to write my own version after watching this video.
@SolarMusicZ2 жыл бұрын
How are they all together and then all of a sudden shoot apart again?
@korek37877 жыл бұрын
Very stable formation :D
@NeoVamp10 жыл бұрын
Ran it at 15 million, holy shit NICE CODE!
@buttafan40102 жыл бұрын
Like a description of star birth, star death by super nova, black hole and void formation.
@jdahllquist682310 жыл бұрын
Fascinating. I kept waiting for it to form a galaxy. I wonder why it can collapse to a near sphere then burst out again? Simple rules can lead to complex behavior.
@עמריטפלא9 жыл бұрын
J Dahllquist It bursts out because of momentum reservation: One of the partical gets so close to the overall origin of gravitation, that it gets flung at a huge velocity, resulting in the movement of the other particals.
@MaxAltair7 жыл бұрын
J Dahllquist Looks like particles doesn't have collision.
@Scelenaarwen6 жыл бұрын
it doesn't. This is from a website where when you hold left click you attract the particels when you hold right click you repell them. The bursting out is just the guy pressing the rght mouse button. You won't get that type of behaviour just out of a purelly attractional force. Only if a particle gets acceleated really fast to the center of mass and gets sling-shot outwards, but not a bulk of the cloud bursting.
@AltumNovo2 жыл бұрын
@@Scelenaarwen Not true. Every head of a supernova?
@ShredST6 жыл бұрын
I'm reading the source code and I just got to the AVX part. Man, it's going to be a long night. Edit: fuck it, I checking out an older commit.
@AlexNize12 жыл бұрын
It's CPU only. GPU version can simulate 5 million particles in real time.
@grecinos212 жыл бұрын
I've been searching on and off for some years for someone to publish a simple gravity simulation that uses DirectX. I think your's is the best I've found yet! I've been tinkering around with your code. I was trying to see if I can convert it into a particle simulation whereby each particle is attracted to all others. I've yet to figure it out. Can you please give me some insight on how I might go about doing this?
@JoeCenatiempo2 жыл бұрын
Look up multi body physics and the three body problem perhaps
@dejanpopovic79038 жыл бұрын
Why do all the bodies coalesce towards the end of the simulation? I thought they would continue their respective eccentric behavior?
@ItsNotAllRainbows_and_Unicorns7 жыл бұрын
There might be a dissipative term involved
@marceliwanicki28436 жыл бұрын
From the comments i assume that the program involves some user input so the guy is probably changing stuff
@cicik574 жыл бұрын
is it attraction to center or fair calculation for every pair of particles?
@Astromath2 жыл бұрын
Attraction to a point (the mouse)
@cicik572 жыл бұрын
@@Astromath not between particles?
@Mahishasur2 жыл бұрын
Music?
@nenotu84004 жыл бұрын
Did you used Blender or something like After Effects to make this
@bitterlemonboy2 жыл бұрын
no he used opengl
@TH0M26108 жыл бұрын
What are the colors corresponding to ?
@matthewbarnes70299 жыл бұрын
...such beauty...
@potatocrusher19222 жыл бұрын
Why did it bounce back ?🤔
@arc82162 жыл бұрын
Can you see any Lagrange points?
@nothsim2 жыл бұрын
Closed loop universe?
@Reuleaux992 жыл бұрын
Cool simulation! Why did this happen?? 5:19
@grecinos212 жыл бұрын
I sent a reply earlier this week. Not sure what happened. Anyways, lol, yes, I’ve been searching for some years, but only every 3 to 4 months. In particular, I’m searching for an n-body simulation that takes advantage of today’s GPU’s. I would like to find one that I can modify and recompile. I’ve yet to find one, even the original source from this video. I tried your recommendations. I used the compiler of their choice, but no go. I’m real frustrated.
@nielsdaemen5 жыл бұрын
KZbin compression raped the quality!
@evanwonisch7883 жыл бұрын
RK4? Or Euler? Or something else?
@ishaanlohani2 жыл бұрын
"And then there was Light" -God
@ger10izq922 жыл бұрын
wonderful
@megadalton30062 жыл бұрын
At 2:02, did we just witness a virtual big bang?
@WiocorEnergy12 жыл бұрын
Great simulation ;-)
@Markus97059 жыл бұрын
Wonderful.
@gountzas2 жыл бұрын
*"when the center of gravity is literally the center of your screen"*
@eduardositedotcom10 жыл бұрын
Wonderful!!!
@Razorcarl2 жыл бұрын
So cool
@solcarzemog523210 жыл бұрын
Are particles elastic and bounce agaist each other?
@FreekHoekstra10 жыл бұрын
there seems to be no collision, so they pass through the centre of gravity and their inertia caries them forward. untill they slow down due to the gravity again and go towards the centre
@ps4games1642 жыл бұрын
law?
@karlsoriso23042 жыл бұрын
pov: isagi is about to do somethin lit
@NTC3 жыл бұрын
holy... amazing!!! and inspiring
@LordBackuro2 жыл бұрын
Kinda looks like what i imagine the Universe to be like
@d.........2 жыл бұрын
War between gravity and entropy.
@grecinos211 жыл бұрын
I'm not sure what the deal is, but my replies keep getting deleted. Anyways... I installed the CUDA SDK, and was able to run the demos. They are great, and close to what I want to accomplish. My goal is to make a 2d Nbody sim with 50-100k particles. Pretty much, just for the eye-candy. I have VS 12, and the CUDA samples were made in VS 8 and 10. Needless to say, I was unable to compile the samples (yet). I think I need to set the Path, referencing the CUDA's libraries, includes, etc.
@prostytroll2 жыл бұрын
I don't see any consistent circular motion...
@bsgsujgd34062 жыл бұрын
this is great to watch once youve studied astrophysics
@Knowledge.o.Everything2 жыл бұрын
Name of simulator or this software
@rejeenaldflores50397 жыл бұрын
how did you do that?
@1.41422 жыл бұрын
It went supernova
@sleeppy669 жыл бұрын
this is from an app for the apple ipad ( the original)
@MisterClassified10 жыл бұрын
Is that a supernovae at 5:20.
@mm-ov2gg2 жыл бұрын
Just need some otherworldly music and it's perfect
@SimSoupYT2 жыл бұрын
computers this good existed in 2012?
@YoungDegenerate2 жыл бұрын
Darkness cannot exist without light and light Cannot exist without darkness.
@h3nnn4n12 жыл бұрын
Real time? How? gpgpu?
@StefanoBusnelliGuru2 жыл бұрын
Gravitation on a toroidal manifold :D
@lol532-t2g8 жыл бұрын
Now we can create our own virtual universes using OpenGL, can't we?
@karolakkolo1237 жыл бұрын
No, we would have to know all the physics rules and equations, but for now we don't know very much about our universe. Including dark energy, antimatter, and other elementary particles that we yet have to discover
@bitterlemonboy2 жыл бұрын
Have fun trying to gather the computing resources for that
@swarog33 жыл бұрын
I am just trying to implement the Einstein's gravity. Later I dream to make a little atom. At the end I want to create a world with animals having artificial intelligence brains.
@SeanSkyhawk2 жыл бұрын
This is basically gravity on a toroidal plane
@darchojandreoski24512 жыл бұрын
Der Weltraum Raumschiff sagte 3 Milliarden Pixel orteten wir Jahr 1988 /1989 auf Planet Erde
@zloykushnir11 жыл бұрын
Thats fucking awesome!
@DigitalAlligator3 жыл бұрын
2d or 3d
@xirustam3 жыл бұрын
Does it really work in real time?... 500.000 x 500.000 = 250.000.000.000 calculations per frame.
@C0braGameplays5 жыл бұрын
It looks like there is black hole in there
@sirahmad2 жыл бұрын
the animation is beautiful but i still didn't understand how its relate to newton law of gravity
@openleft42142 жыл бұрын
Got really confuse when I thought this was a GR sim.
@zackbarkley75932 жыл бұрын
Do the same simulation using MOND theory.
@JohnDoe_12379 жыл бұрын
damn, you need some really cool music for this video!