|
|
Hey,
Well, I guess the first thing you need to consider is how accurately you
want to model the blobs. If you're familiar with the principles behind lava
lamps, you could use a fluid dynamics model to simulate two liquids (that
are obviously insoluble and don't mix) that have varying densities. Usually
in a lava lamp, you have water (which is the perfect choice, since it has a
massive heat storage capacity) and an organic substance (with a lesser heat
storage capacity). This is important, since the densities change with the
temperature of the material. The organic material then heats up faster when
reaching the hot light bulb at the bottom of the tank, expanding a bit and
at the same time reducing its density, which makes it float upwards (its
density becomes lower than that of water). When reaching the top, the
organic blobs release the heat and shrink, again gaining in density and
sinking back to the bottom of the lamp.
Now there are 3 ways to model a lamp like that:
- firstly, you have the whole nine yards:
Take a simulation and put in parameters for two liquids, one with constant
and one with varying density, depending on the height of the coloured liquid
(the higher it goes, the cooler it gets - you could even simulate the heat
transfer for more accurate results). I'm not very good at fluid dynamics, so
this is a bit much for me too - anyone want to check up on this method?
- secondly, there is the simplest method:
Just make a single blob object and move the components around (don't worry
about them colliding), add some random variation in the velocities and act
upon the components using forces computed in much the same way as you would
in the first method - the higher the blob gets, the more it accelerates
downwards (or decelerating upwards, whichever you prefer). Although this
method does not take into account the properties of surface tension, which
would make blobs that come into contact with one another, accelerate towards
each other to 'fuse'. So we make a compromise...
- the third method is a mix of both:
Make a blob object to simulate the organic substance (don't worry about the
surrounding liquid just now...). Choose a number of spheres to represent a
number of blobs (say about 50?) and assign a temperature to each one of
these components (you will calculate the acceleration from these values).
Then you run a step simulation, changing the temperature with each step and
moving the spheres according to the acceleration and initial speed. The
amount of change in temperature varies with the height - the higher it goes,
the faster it loses heat. Also, the bigger the component is, the slower it
cools down (the rate of change is proportional to the inverse square of the
radius, I think... I'll have to check).
Now the difference between this and the second method is that when two
components touch, they start pulling each other together to form a bigger
blob - that's why you check for colliding spheres and add velocities when an
intersection is found. That gives quite believable results, much better than
you'd get with the second method.
That's about it - the second and third method are doable if you have a basic
knowledge of Newtonian physics and heat exchange.
But you gave me quite a good starting idea - I think I'll try and make a
lava lamp of my own and post the source. But gimme a day or two to work out
the physics. Any questions on the specifics of this implementation, just
post 'em here. :)
Have phun,
-Klemen
Post a reply to this message
|
|