picture home | art | events | music | rack extensions | downloads | pixel blog | qt_tools

omino pixel blog

pixels, motion, and scripting
/\/\/\/\
david van brink // Fri 2007.11.23 18:51 // {after effects}

Salmonella

To foster a bit of post-holiday spirit, and promote safe food-handling all year round, I thought I’d try to animate something like salmonella bacteria. Salmonella can grow on turkey, and can survive months in plain water at room temperature, and looks like this:

So, in After Effects, I made some that are slightly stylized.

First we need a single flagellum. So we animate a white dot across a narrow comp, with some wiggle, and an adjustment layer with Echo effect to get a trail.

loopedTentacleXY_demoWide.mov

click for
http://omino.com/pixelblog/content/2007/salmonella/loopedTentacleXY_demoWide.mov

Then we add a Transform effect to the adjustment layer, and, using a pick-whipped expression, slave the Anchor property (of the effect, not the layer) to the position of the moving dot. Now it’s standing still. I reduced the comp size, here, as well.

loopedTentacleXY.mov

click for
http://omino.com/pixelblog/content/2007/salmonella/loopedTentacleXY.mov

The wiggle is a little more than meets the eye. It’s contrived so that, on the 10-second comp, it is actually loopable over 9-seconds. This is done with a cross-fade between the wiggle now, and the wiggle 9-seconds previously. Also, the last second, from time=9 to time=10, must be identical to the first second, time=0 to time=1, for the echo-tail effect.

wiggleXY point control expression:
// This expression is a wiggle that's bigger in X than Y
w1 = effect("sourceWiggleXY")(1).wiggle(.4,20,2,.2);
w2 = effect("sourceWiggleXY")(1).wiggle(1.4,37,2,.2);
[w1[0],w2[1]]

wiggleXYLooped point control expression:
// This expression loops the wiggleXY expression.
loopStart = 1;
loopEnd = 10;
fadeDuration = 1; // how long to crossfade
matchDuration = 1; // how long before to exactly match
               // (so history trails coincide)
// ----------
loopDur = loopEnd - loopStart;
now = (time - loopStart) % loopDur + loopStart;
then = now - loopDur;
amtNow = 1;
if((loopEnd - now) < (fadeDuration + matchDuration))
{
	// we're in the crossfade portion...
	amtNow = (loopEnd - now - matchDuration) / fadeDuration;
	if(amtNow < 0)
		amtNow = 0;
}
amtThen = 1 - amtNow;
valueNow = effect("sourceWiggleXY")("Point").valueAtTime(now);
valueThen = effect("sourceWiggleXY")("Point").valueAtTime(then);

result = valueNow * amtNow + valueThen * amtThen;
//result = amtNow;
result

Great! Now we have a waving flagellum to use as needed. We attach 10 flagella to a peanut-shaped masked solid, err, body, varying the angles. Each flagellum has its in-point at 1-second, and uses Time Remap and loopOut("cycle",0) so that our bacteria can live more than 9 seconds. Also, each flagellum's layer has been slid in time at random, so they all wave differently (but in a 9 second loop).

Be careful about Motion Blur when doing looping tricks like this; just turn it off. Sometimes it draws crazy blurs at the loop point.

Here's our happy bacterium:

salmonellaSolo.mov

click for
http://omino.com/pixelblog/content/2007/salmonella/salmonellaSolo.mov

Lastly, we put it into a Particle Playground. I've been using After Effects for, oh, coming on 5 years now, but only just now am really learning Particle Playground. Maybe I imagine that it's still an off-limits "Pro Edition" feature or something. Anyway, it's definitely worth learning. Tricky and clever stuff! Here's some bacteria in it.

salmonella.mov

click for
http://omino.com/pixelblog/content/2007/salmonella/salmonella.mov

Mmm, salmonella-ey!

This is pretty render-intensive. For a real project I'd probably prerender the bacterium over a couple of minutes, perhaps swimming faster and faster. Then I'd drop the movie in as footage, and choose a section of the movie for how fast its swimming.

In these posts I'll tend to gloss over a lot of stuff, like how I precomped the bacterium to make it smaller, or made the tentacle layer duration 10:01, not 10:00, for loopability. The minutiae are less fun to write about, and I figure you're smart enough to fill in the gaps, right? But! Here's the After Effects project, for closer inspection.

And enjoy those Thanksgiving leftovers. Store from 35-40F and eat within 5 days, or store below 0F and eat within 3 months.

Comments are closed.

0.0426s
(c) 2003-2013 omino.com / contact poly@omino.com