ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Traffic Jam Simulation

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Eric Olson
Traffic Jam Simulation
on Dec 15, 2012 at 6:03:47 pm


I am working on an animation explaining how traffic jams form. The way they happen is the lead car brakes and then the cars behind it must slow down. The lead car eventually accelerates out of the jam but if the cars behind it are coming in faster than it accelerates out, the jam will continue to grow.

I've had no problem showing the case where the jam is staying the same size, where the cars are moving in and out at the same speed. I just key framed one car to slow down and then used the echo effect with a slight displacement in time.

But how do I show the the jam piling up behind while cars are still moving forward and accelerating out of the jam? (I mean without keyframing everything manually?) Is there a way to loop things (or echo things) while gradually moving the point where the cars are slowing down?

Any help is appreciated.


Return to posts index

Tom Daigon
Re: Traffic Jam Simulation
on Dec 15, 2012 at 7:09:35 pm

This simulation at first glance looks like it would benefit from the use of Expressions in AE.

I will leave it to folks more skilled then I to elaborate on that thought ::D

Tom Daigon
PrP / After Effects Editor

(Best viewed at 1080P and full screen)
HP Z820 Dual 2687
64GB ram
Dulce DQg2 16TB raid

Return to posts index

Eric Olson
Re: Traffic Jam Simulation
on Dec 16, 2012 at 4:23:33 pm

I thought I'd found a solution using particle playground, a keyframed property map and the echo effect. But now it looks like the x-speed property doesn't work in the ephemeral property mapper. Can't get the speed to change no matter what min-max I enter.

Anyone else have this problem?


Return to posts index

Walter Soyka
Re: Traffic Jam Simulation
on Dec 17, 2012 at 3:02:45 pm

Eric, simulation of this type is not very practical to do in Ae.

After Effects expressions have no memory -- they are evaluated anew every time a frame is rendered, and they have no way of knowing what has happened on previous frames (nor what will happen on subsequent frames). To have knowledge of a past event, the expression must calculate it from scratch.

To illustrate: if calculating the value for a layer's property for the second frame of a simulation depends on a value from that property on the first frame, it must calculate both the first and second frame. Then on the third frame, it would have to calculate the first, second, and third frame, and so on. The problem compounds when you add multiple layers, as in a traffic jam simulation, where each layer depends on the previous layers.

The entire simulation-to-date must be calculated on every frame for each additional layer. The longer the simulation or the more actors in it, the greater the likelihood of your expression timing out and your render failing.

(This is probably why Newton calculates its simulations outside of After Effects).

If you can think of way to express the position of a car in the traffic jam based on its time and index in the jam only, then you can write a good expression to help animate the jam. Otherwise, you're better off animating by hand or writing a simulation elsewhere and outputting Ae keyframe data.

As for Particle Playground, that ephemeral x-speed property is not what you want it to be -- it's for defining the instantaneous speed of the particle at the position already defined by the simulation; it does not modify the simulation itself to reposition the particle. If you turn motion blur on, you'll see how the particle's speed, but not its position, can be affected by this property.

Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog - What I'm thinking when my workstation's thinking
Creative Cow Forum Host: Live & Stage Events

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved