Create a lava lamp-like animation

I recently saw something that made me wonder how to create a realistic (2D) lava lamp , similar to an animation, screen saver or game.

Of course, one could model the physics of lava using partial differential equations and translate this into code. However, this is likely to be very difficult (due to several factors, not least of which is the inherent irregularity of the wax drop geometry and a large number of variables) and is probably computationally too expensive to calculate in real time.

Analytical solutions, if found, would be useless because you would like to have some degree of randomness (or stochasticity) in the animation.

So the question is, can anyone think of an approach that will allow you to animate a realistic looking lava lamp in real time (say 10-30 FPS), on a regular desktop / laptop computer, without modeling physics in any detail ? In other words, is there a way to "cheat"?

+3
source share
2 answers

One way to cheat is to use the probabilistic game of Conway's life , or it is an imitation of a forest fire .

+6
source

LavaLite is open source. You can get the code with the xscreensaver-gl package on most Linux distributions. He uses metaballs .

+4
source

Source: https://habr.com/ru/post/1788604/


All Articles