@@monad_tcp Hello, sorry to bother you, but what do you mean by that? Are the defects the empty lines between circles at the end? And what are you referring to when you say it happens in nature too?
@@EliorFureraj15 I'm not too well read on the subject. but I believe they are speaking of how the balls naturally fall into a perfect tesselation, however between the large clumps are empty spaces. and in nature, crystal structures form these sort of semi-perfect tesselations that don't always perfectly fit together. lmk if I helped at all, and if not I'd love to try and explain it a bit more :)
@@TheRealFlenuan I was thinking the same thing with propagating against the flow. It can fascinate you without beeing accurate. It's just a fun thing to think about.
@@TheRealFlenuan it's only inaccurate because the engine can't cope with granting infinite force propagation beyond n particles from the initial collision, such that the original particle must assume there's a solid floor somewhere beneath it, and now gravity goes out the window. "Turtles all the way down" should become the textbook name of this problem. Feel free to use it.
It's parallelized using a threads pool library I made. But it's far from perfect, there are some bugs and the threads workload isn't very well balanced.
for some reason, when I watched the video, I imagined orchestra music playing in my head that got higher in pitch every time you increase the circle drop rate
2:00 I like that shock wave that traveled backward. I remembered there is a similar phenomenon in trans-sonic flow. Been a while since i took fluid dynamic.
I've played around with these before, you see a different kinds of fluid dynamics in these systems, you can drag large objects through it and it'll simulate the vacuum area that gets dragged behind it along with the turbulence you would expect... All that from simple repulsive balls..
Omg i didn't expect such a simple simulation to produce actual crystal grain structures identical to real materials. Including correctly simulated point imperfections and lattice faultlines! Suuuuuper cool! Ive only seen this in textbooks before, but not animated. The point imperfections were actually even flickering in this simulation, bringing them out even more! Also very interesting that there was a certain average size to the grains produced.
@@waldolemmer The increased render time is just waiting for the screen refresh. Notice how it's glued to a 16ms total frame time (60fps) even as the sim time increases. If you look at the code, you can see that the key "E" on the keyboard is bound to both creating an emitter and to enabling vsync. It has nothing to do with trajectories (they were always being calculated) and it has nothing to do with instantiating anything.
you could see a well-established crystal structure near the beginning and molecular skips in the lattice causing all of the worm like lines travelling about.
Found it interesting how the render time kept going down as physics time increased, even when you zoomed out/in. Also you should have gone to the millions :P
1:51 is the view count for this video for when I’m watching. Crazy to think each ball represents one of us watching. How 44,000 views seems relatively low for a RUclips view count but how large is actually is
Looks like the engine couldn't keep up and there was interpenetration especially at the larger 'flow' sizes where there was a reverse wave travelling back up the stream.
This is a really nice simulation of objects generation on your computer, molecular structures, and hexagons. You can see the granules of the structure move as it grows slowly but at the end where they grew fast they are small. And hexagons because when there’s a gap between a bunch it stays till the weight of the one above it collapses it.
I did not try to compare but I'm sure on the performance it's way faster because it's very basic. It jus handles circle - circle collisions. I made it for massive and inaccurate scenario like an army of zombies.
It is strange that the deep(defined by zone, density, and relative inactivity) parts aren't forced to settle and change into a pasive state until a neighboring zone is agitated.
There should be error in physics implementation. Balls didn't preserve energy correctly on hit. So you can see stream spread go up phenomenon, which should not be
Just added the repo in the description. The Github is a bit messy but you can find the collision detection and response code in include/access_grid.hpp and include/collision_solver.hpp
@@PezzzasWork thank you very much! I've tried to implement something similar myself but the collision response became buggy when i put ball on top of another for some reason
@@MichaeltLoL I've got the same kind of bugs tons of times while experimenting with physics. It's generally because the response is too high which leads to instability because energy is "created" . For this project in particular I used a very empirical approach with some "magic coefficients" that appeared to work fine. What also helps is to solve collisions multiple times, it can really absorb position correction overshoots which happen really often when you have a complex system with a lot of bodies. Honestly what I've learn from all my physic projects is that if you want to do things seriously, it is not that easy!
Would love to know more about the implementation, making a particle sim myself. What spatial partition methods did you use? Did you have a system to stop ticking entities which weren't moving above a given threshold? Thanks!
@@PezzzasWork Always great to find down to earth implementations that just work well! I'm not very familiar with C++ so I have a harder time parsing the source which is why I asked, thanks for the reply! I've been using a Octree myself but I'm finding difficulty inserting entities in a way that spatially proximate entities will also be close in memory as to reduce cache misses... maybe I should have started with a grid!
I have seen an approach to optimize such problems. All the balls in the "crustal structure" which are not moving don't need to be updated. It's possible to create an importance map of all the balls and update them accordingly. But either way your engine is pretty good👍🏻👍🏻
This is just a free particle engine at this point. Kinda neat to see as you zoom out how much more liquid like it acts I think you might be able to improve on that physics time by implementing something like settle detection, which would recognize when the object is no longer being acted upon by any forces and stops calculating it's position. This might drastically reduce the amount of time to calculate physics and the amount of object jitter.
I assume that "render" time is the amount of time rendering the scene, "physics time" is the amount of time computing the features to render, and "frame time" is gross time per frame. The frame time was stable at 16 msec for awhile -- that's an interesting number because anything faster than 16.7 msec isn't visible on a monitor with a 60hz refresh rate.
It took a lot of balls to make this video.
many balls were used in the making of this video
@@kaidatong1704 Let's spend a week celebrating the balls of different orientation and color 🌈🏴
180000 to be exact
@@explosifiy How long did it take to count them?
I wonder if you could make a more accurate simulation of water by applying a constant force back and forth on the balls so they wiggle a lil
This also shows crystal grain structure pretty well, really cool
first I though, a bit buggy, then I remembered, those defects also happens in nature, not a bug at all
@@monad_tcp Hello, sorry to bother you, but what do you mean by that? Are the defects the empty lines between circles at the end?
And what are you referring to when you say it happens in nature too?
@@EliorFureraj15 I'm not too well read on the subject. but I believe they are speaking of how the balls naturally fall into a perfect tesselation, however between the large clumps are empty spaces. and in nature, crystal structures form these sort of semi-perfect tesselations that don't always perfectly fit together.
lmk if I helped at all, and if not I'd love to try and explain it a bit more :)
@@EliorFureraj15 there's a video about this ruclips.net/video/xuL2yT-B2TM/видео.html
@@capsey_ I got that within same recommendation section, almost next to this one. see screenshot for proof imgur.com/a/tp3G2UC
It's fascinating watching the waves propagating against the flow.
That's how traffic jams flow!
It's not accurate physics lmao
@@TheRealFlenuan I was thinking the same thing with propagating against the flow. It can fascinate you without beeing accurate. It's just a fun thing to think about.
@@TheRealFlenuan it's only inaccurate because the engine can't cope with granting infinite force propagation beyond n particles from the initial collision, such that the original particle must assume there's a solid floor somewhere beneath it, and now gravity goes out the window. "Turtles all the way down" should become the textbook name of this problem. Feel free to use it.
@@TheRealFlenuan These are the sames waves that cause this ? ruclips.net/video/DvtbQs7hWXw/видео.html
80k circle collisions in a respectable framerate well done! Maybe some of the computation can be batched and parallelized for additional speed.
Maybe he is using sleeping
CUDA/OpenCL/AMP - to help
But because he use SFML, he can use amp.h
It's parallelized using a threads pool library I made. But it's far from perfect, there are some bugs and the threads workload isn't very well balanced.
Imagine if he could also implement multi-threading support!
for some reason, when I watched the video, I imagined orchestra music playing in my head that got higher in pitch every time you increase the circle drop rate
Good
What you are searching for is Hall of the Mountain King
@@suwedo8677 this is exactly what was playing in my head
It's called "Synesthesia".
@@suwedo8677 совершенно не то
2:00 I like that shock wave that traveled backward. I remembered there is a similar phenomenon in trans-sonic flow. Been a while since i took fluid dynamic.
just noticed that. and it happens on like multiple levels afterward so cool
I've played around with these before, you see a different kinds of fluid dynamics in these systems, you can drag large objects through it and it'll simulate the vacuum area that gets dragged behind it along with the turbulence you would expect... All that from simple repulsive balls..
Dear Fellow Scholars, this is Two Minute Papers with Dr. Károly Zsolnai-Fehér.
😂
Beautiful and satisfying!
Okay
3:44 is a moment when you can spot a kangaroo right there.
Looks good. Now shake it!
Amazing! It's not even close to number of atoms in a water drop!
The Matrix has some serious computing power..
It just goes
...The matrix
I like how this is an indirect simulation of imperfect crystal formation
You're supposed to watch this while listening to "In the hall of mountain king". Trust me, i tried it.
youre right lol
This video deserves more views
Well the algorithm caught onto it so here we go
@@LuciSheppyLive thats exactly what i was gonna say lol
Interesting watching the various types of waves and phase transitions.
2:06 that effect when some wave moves up against flow is very funny :) what is it ?
It's actually a bug when collision doesn't handle velocity update correctly resulting in the object moving in the wrong direction :D
@@PezzzasWork nice bug
1:30 thats a nice laminar flow right there. i also like how the "fluid" animation seems to get better with each step up
"Hey guys look a my rainbow balls"
- youtube recommend page 2021
That looks like a water simulation in the end
youtube reccomended me this for no reason, but kinda satisfing tho.
@RUclips Algorithm oh poop
Omg i didn't expect such a simple simulation to produce actual crystal grain structures identical to real materials. Including correctly simulated point imperfections and lattice faultlines! Suuuuuper cool! Ive only seen this in textbooks before, but not animated. The point imperfections were actually even flickering in this simulation, bringing them out even more! Also very interesting that there was a certain average size to the grains produced.
Thank you! This is really inspiring.
Are you telling me 180k objects are iterated every 40ms along with a collision detection algorithm running for every single one?
Interesting how having an emitter active gives you an increased render time. See 0:16 when it goes up.
I think that's due to having to perform trajectory calculations instead of just dropping the balls, that's just a guess though.
probably because it has to instantiate and create a whole bunch of new balls, though I haven't looked at the engine at all
It's vsync
@@waldolemmer The increased render time is just waiting for the screen refresh. Notice how it's glued to a 16ms total frame time (60fps) even as the sim time increases. If you look at the code, you can see that the key "E" on the keyboard is bound to both creating an emitter and to enabling vsync. It has nothing to do with trajectories (they were always being calculated) and it has nothing to do with instantiating anything.
you could see a well-established crystal structure near the beginning and molecular skips in the lattice causing all of the worm like lines travelling about.
That was like beautiful 3 dimensional water physics sometimes
That was a very helpful deconstructed video processing demonstration.
At the end I was waiting for the whole thing to be turned upside down
damn I am really impressed. I probably couldn't even run 1/10000 of that using my code before my computer would explode. This is so fast.
What's that strange wave of a strange mess going upwards the right flow of balls between 2:35 and 2:52 , then going down?
Found it interesting how the render time kept going down as physics time increased, even when you zoomed out/in. Also you should have gone to the millions :P
I never thought I’d witness a resinace cascade first hand
1:51 is the view count for this video for when I’m watching. Crazy to think each ball represents one of us watching. How 44,000 views seems relatively low for a RUclips view count but how large is actually is
Now 1:58
i did something like this in code bullet's marble calculator, it didn't go well on that old chromebook
Looks like the engine couldn't keep up and there was interpenetration especially at the larger 'flow' sizes where there was a reverse wave travelling back up the stream.
1 engine was harmed in the making of this video
That is incredible stability considering
This is a really nice simulation of objects generation on your computer, molecular structures, and hexagons. You can see the granules of the structure move as it grows slowly but at the end where they grew fast they are small. And hexagons because when there’s a gap between a bunch it stays till the weight of the one above it collapses it.
Wow the resulting structure actually has a temperature
Short answer: 180K
Long answer: This video
That's pretty impressive. I assume you put some kind of optimizations into how static collisions are calculated?
This is so mesmerizing
Plot twist: this uses the collision system he was trying to make that time
If everything had a friction of zero would it act like a fluid?
That's pretty good! Have you compared it to box2d?
I did not try to compare but I'm sure on the performance it's way faster because it's very basic. It jus handles circle - circle collisions. I made it for massive and inaccurate scenario like an army of zombies.
@@PezzzasWork "assume 5000 pergectly cyclical massless zombies" 😁
if you would give them less friction it could be a realistic water simulation
but how did you handle that many collisions without any unacceptable lag?!? Amazing work dudee
end result is great album cover material
Frame time's gangsta unless he puts bunch of TNT's in there.
Money you make per second in idle games be like:
It's amazing, the power of today CPUs..
as an average SFML enjoyer, and still learning, i love this video
I call this limitation on simulated force propagation the "Turtles all the way down" problem.
is it position-based verlet? are you using shock propagation? it looks suspiciosly stable at the bottom.
This is how rock layers are formed.
It is strange that the deep(defined by zone, density, and relative inactivity) parts aren't forced to settle and change into a pasive state until a neighboring zone is agitated.
I was kinda hoping for a full-width barrage at the end, but cool video anyway!
There should be error in physics implementation. Balls didn't preserve energy correctly on hit. So you can see stream spread go up phenomenon, which should not be
will be perfect with "In the Hall of the Mountain King" music ^^
Could you put people on that land you created?
I would like to know what errors are in the engine
How on earth the physics time just stops growing?
Wow looks awesome! Just a quick question. Wouldn't it make sense to put all the the calculation inside a computeshader?
the thumbnail made me think it's powder toy
Would it be possible to get collision detection/response code?
Just added the repo in the description. The Github is a bit messy but you can find the collision detection and response code in include/access_grid.hpp and include/collision_solver.hpp
@@PezzzasWork thank you very much! I've tried to implement something similar myself but the collision response became buggy when i put ball on top of another for some reason
@@MichaeltLoL I've got the same kind of bugs tons of times while experimenting with physics. It's generally because the response is too high which leads to instability because energy is "created" . For this project in particular I used a very empirical approach with some "magic coefficients" that appeared to work fine. What also helps is to solve collisions multiple times, it can really absorb position correction overshoots which happen really often when you have a complex system with a lot of bodies. Honestly what I've learn from all my physic projects is that if you want to do things seriously, it is not that easy!
It looks like when you put a magnet up to a tv
Would love to know more about the implementation, making a particle sim myself. What spatial partition methods did you use? Did you have a system to stop ticking entities which weren't moving above a given threshold? Thanks!
I am using a fixed grid and nothing special happens to static objects, my approach is very basic :)
@@PezzzasWork Always great to find down to earth implementations that just work well! I'm not very familiar with C++ so I have a harder time parsing the source which is why I asked, thanks for the reply!
I've been using a Octree myself but I'm finding difficulty inserting entities in a way that spatially proximate entities will also be close in memory as to reduce cache misses... maybe I should have started with a grid!
Why does render time lowers when number of balls increases?
What happens if you take away most of the friction? Like to the point it acts like water?
How can i compile this, Or is there a Pre compiled EXE?
I see you're using my favorite cereal kix as a demonstration
Oh wait it's more like cap'n crunch oops all berries
The final looks like Perlin noise
I wanted you to invert gravity at the end :(
you’re varying the color based on the number of the balls? the color changed slower in the beginning.
180000 objects
GD creators: gotta crank those numbers up, those are rookie numbers
this is amazing
someone make a physics based game out of this
You can try "The powder toy"
@@pashadanilov3490 oh yeah thats s childhood game
Everybody gangsta till the wall starts peeing
Great example of sedimentary deposits over time
Ok now add a function where she loves me back
why does render time go faster with more balls?
Damn, i want to read your code). How i can do that in java?
No way, it's too slow.
I guess it's a C(#/++) engine
Cyberflix C++
I have seen an approach to optimize such problems. All the balls in the "crustal structure" which are not moving don't need to be updated. It's possible to create an importance map of all the balls and update them accordingly.
But either way your engine is pretty good👍🏻👍🏻
You have to be careful though. Sometimes that type of optimization can lead to some not being updated when they should be getting updated
@@vibaj16 Yes, I think a conservative approach to creating the importance map is key👍🏻
Could you please add the solution file to the Github? I don't know how to open it
How gtx particle system can be .-.
Why did I hear my computer fans kick up when I started playing this video?
Damn, it barely made a dent in the performance until that second waterfall showed up, and even then it stayed above what'd convert to 30fps
Frame time doesnt mean fps it isnt the same 30 ms frame time is something arround 10 fps
@@dayone3363 I'm aware, I calculated the fps
40ms per frame comes in at about 25fps because 40ms fit 25 times in a second.
Timur Begach No, that would be around 3 fps
Bit rate does BRRRRR
How do you use multithreading? Like how is the work divided up, then re-integrated?
The fact that they don't move down and stay clumped at the side means that there is plenty of optimization going on on behalf of realism.
how does render time decrease ?
pretty colours
my pc would die at the second ball
Awesome video! How do you compile the project?
My physics engine would start to lag at around this moment 0:45 and of course I made it in LuaU.
this is gonna blow up
I want to play around with this so much right now
This is just a free particle engine at this point. Kinda neat to see as you zoom out how much more liquid like it acts
I think you might be able to improve on that physics time by implementing something like settle detection, which would recognize when the object is no longer being acted upon by any forces and stops calculating it's position. This might drastically reduce the amount of time to calculate physics and the amount of object jitter.
What's the difference between render time and frame time?
I assume that "render" time is the amount of time rendering the scene, "physics time" is the amount of time computing the features to render, and "frame time" is gross time per frame. The frame time was stable at 16 msec for awhile -- that's an interesting number because anything faster than 16.7 msec isn't visible on a monitor with a 60hz refresh rate.
What rule did you use to color the balls?
I am using 255*sin(0.001 * i + 2pi / 3 * k)^2 with i being the index of the object and k the index of the color component (r 0, g 1, b 2)
I wonder what those numbers would look like if these were squares lol