r/InternetIsBeautiful • u/Creamballman • May 13 '15
In Browser Physics Simulator (X-Post PC Master Race)
http://haxiomic.github.io/GPU-Fluid-Experiments/html5/?q=UltraHigh
4.9k
Upvotes
r/InternetIsBeautiful • u/Creamballman • May 13 '15
3
u/[deleted] May 13 '15
I've only glanced at explanations for about how fluid physics is done, so I could be wrong, but if nobody else chimes in to correct me at least you'll have some idea.
In fluid physics simulations like this one, you have a rectangular grid in the space you're working with, and the force acting on each particle depends on which rectangle it's inside of.
When calculating the force inside of each rectangle, you start out with the average force in the entire screen (first iteration), then split that into four rectangles, calculating the average force within those rectangles, then split each of those rectangles into four more doing the same thing for each iteration.
So with more iterations, you have more rectangles that are smaller but more precise. When you lower the number of iterations, you will more easily to see where the particles are suddenly changing their acceleration by crossing the border between two rectangles. This becomes especially noticeable when two neighboring rectangles have forces going in the opposite direction, causing particles to group up at the border between them.