by Edward K. Chew
[Last updated 2004-04-25]
This screen saver simulates the convection of free-flowing particles enclosed
in a cube that is being heated from the bottom. Warmer particles expand and
turn red. They tend to get displaced by the more concentrated cold blue
particles pushing their way down—hence the convection.
I wrote this thing over a weekend when I was sick at home. It is my first
screen saver, my first experience with Cocoa, the first time I have worked
directly with OpenGL, and the first time I have used XCode. (I am more of
a Carbon/CodeWarrior kinda guy.) Anyway, I am a bit in over my head, so
please bear with me!
Convection requires Mac OS X and OpenGL 1.1 or later.
To install the screen saver, drag it into the Screen Savers folder within your
Library folder. Now it should appear in your System Preferences.
(There are as yet no configuration options in this early release.)
The Test screen looks wrong.
There is something funky about the test display mode you enter when you
hit the Test button in the screen saver configuration. The particles
all look flat and white, and the animation is quite jerky. I have no
idea what is causing this, but am looking into it.
UPDATE: I managed to fix the white particle problem,
though the movement can still be jerky on some machines. This problem
appears to be limited to the Test mode, however. I notice some screen
savers which do a lot of computation and rendering like GLTron blank out
the test screen altogether, which makes me think I am not alone here!
Lone particles are sometimes seen darting around wildly.
Nearby particles repel each other, and occasionally, when one gets too
close to another, they fling each other away with extreme speed. An
adjustment to the physics model may fix this.
Sucks a lot of power.
People with laptops might want to forego this screen saver, as it is
quite CPU-intensive. Alas, I doubt there is much I can do about this.
Too much jitter.
I developed this screen saver on a 400 MHz iMac, but noticed that on
newer machines, things zip around like crazy. Physics simulations
like this are full of compromises. If I lower the energy level of
the particles, they may move less frantically but not produce as
much interesting behaviour. At some point, I will probably make
this thing configurable so you can play with the gravity, repulsion,
temperatures, etc. to your heart's content.
UPDATE: I have added some digital noise filtering
to reduce the amount of high-frequency jitter. I found that this
was what was most irritating on fast computers. I wanted to be able
to see the overall circulation patterns without all that bouncing
around. Ultimately, I may still need to slow down the simulation
on ultra-fast computers, but I think this has helped a fair bit.
Added more elaborate perspective effects which view the cube
at various angles and distances.
Improved particle rendering is activated when a faster CPU is
Added a high frequency noise filter on the motion of the
particles to reduce the excessive jitter. This makes it easier to
follow the circulation patterns, especially on faster computers.
Fixed a bug which caused the calculation thread to continue
running in System Preferences even when you selected a different
screen saver. (Thank you anonymous tipster!)
Minor fix to the random number generator.
Fixed a bug which caused objects to turn white and look
two-dimensional. This only occurred when you tested the screen saver
straight out of System Preferences. The Test screen is still
problematic. On some machines, the movement is slow and jerky,
(though it seems to work fine when you deploy the screen saver
Particle movement calculations are now performed in a separate
thread from the one which refreshes the screen. I tried to be
careful in how I went about this, but please let me know if any
problems arise because of it.
Convection is freeware. I do not offer any guarantees or assume any
responsibility for damages incurred after its installation.
Use it at your own risk.
Convection may be distributed in its unmodified form but not sold. E-mail me
if you have any questions or comments.