Articles Archive
Articles Search
Director Wiki
 

Multi-track cycling animation

October 22, 2000
by Pat McClellan

Dear Multimedia Handyman,

I have 35 3D animations that are rendered out into a .tif sequence of 30 images per animation. A total of 1050 images. Each 3D animated sequence is of the same object with a difference of 10 degrees in camera angle. 35 Animations at 10 degrees each is 360 degrees (sequence 1 is also sequence 36).

What I've been asked to do is to bring the images into Director (I'm using D8) and create a movie where the user can use a "slide bar" graphic that I create and each time the slide bar is moved the 3D animation changes from sequence to sequence smoothly while the animation is playing. Basically a 3D animation that someone can interact with by making it move around in a VR type motion. Any help or suggestions on this would be great. Is the .tif sequence the best way to go or is there a better way?

Tim

Dear Tim,

This is essentially a multi-track animation sequence that is 30 frames (or "cels") long. Each of the 35 tracks shows you a different angle on the same moment in the sequence. That means that when you change angle (track), you need to be on the correctly corresponding cel in the new track.

I first thought about setting up 35 filmLoops and just swapping them with the slider. The problem with this approach is that when you change to a new filmLoop member, it always starts over from the first frame of the loop, which wouldn't allow you to achieve the correspondence of cels that you need.

I think the easiest thing is to set up a Lingo-based animation where the member of the sprite is specified for each frame. Since I don't have your animation assets, I'm going to use a deck of cards as the analogy. The sequence will loop through the cards of a suit in order. It will stay on that same suit. Each suit will represent the angle you described, so we'll have only 4 tracks instead of 35, and 13 cels instead of 30 as in your sequence. I'll write the Lingo so that you can specify the number of cels and tracks.

Director 8 download for Mac or Windows.

Start by importing each image of the sequence into your cast. You'll need to arrange them in the cast so that you have a complete sequence at one angle, followed by the complete sequence from the next angle, etc. These Cast members can go into the cast anywhere, but they must be sequential and uninterrupted (no empty Cast members in between). I used memberNum in the Lingo, so the names of the Cast members are irrelevant.

From your description of your animation and its VR style, I'm assuming that the center point of the object doesn't move. If your animation moves around on the screen, getting all of the images registered with each other will be critical.

Drop the starting Cast member on the Stage -- and note that this doesn't need to be the first cel of the first track. In my example, I started with the 4th Cast member of the 3rd track (the 4 of Spades). Now we'll create the behavior to drop on this sprite. I'll call it the multitrack animation behavior.

This behavior will need to allow you to specify the first Cast member -- this is not the starting Cast member on the Stage, but rather, the first cel of the first cycle. You'll also need to specify how many cels are in the cycle, and which cel and track you want to start with on the Stage.

The behavior has a beginSprite handler that takes the first member that you specified (aceClubs in my demo) and derives a base memberNum (pBaseMemNum) onto which you can increment the animation. We'll see how that value is used in just a moment.

pBaseMemNum = pFirstMem.memberNum - 1

On each exitFrame, you need to increment the pCurrentCel by 1. Since the animation loops, you'll need to check to see if pCurrentCel is greater than the number of cels in the animation sequence (pCels). If so, pCurrentCel is set to 1 and the animation sequence starts again from the beginning.

-- increment the cel
pCurrentCel = pCurrentCel + 1
if pCurrentCel > pCels then pCurrentCel = 1

The new memberNum must take into consideration which track you're on. In my demo for example, the starting track is 3 and the starting cel is 4. That means the memberNum for the first cel is calculated as...

((track - 1) * number of cels) + current cel
(2 * 13) + 4 = 30

So that memberNum would be the baseMemberNum + 30. The 4 of Spades is the 30th Cast member in my sequence. Note that you subtract 1 from the track because the tracks are counted from 1 instead of 0.

-- calculate the new memberNum
trackFactor = (pCurrentTrack - 1) * pCels
newMemOffset = trackFactor + pCurrentCel
newMemNum = pBaseMemNum + newMemOffset

After the newMemNum is calculated, set the member of the sprite to the new memberNum.

-- set the new member into the sprite
pSprite.member = member(newMemNum)

There are other articles describing the Lingo for setting up sliders. All you'll need to do is have the slider script send the message to the behavior on your onstage sprite, telling it to increment the track to whatever (from 1 to 36 in your case). I've set up the demo so that those messages get sent from the buttons. The message is:

sendSprite(pWhichSprite, #incrementTrack, pMyTrack)

pWhichSprite is the spriteNum for the sprite on Stage, pMyTrack is the number of the corresponding track, and #incrementTrack is the handler in the multitrack animation behavior that changes tracks. That handler looks like this:

on incrementTrack me, whichTrack
  pCurrentTrack = whichTrack
end incrementTrack

Nice and simple. Download the demo if you're not clear on any of this. Good luck with your project.

Patrick McClellan is Director Online's co-founder. Pat is Vice President, Managing Director for Jack Morton Worldwide, a global experiential marketing company. He is responsible for the San Francisco office, which helps major technology clients to develop marketing communications programs to reach enterprise and consumer audiences.

Copyright 1997-2024, Director Online. Article content copyright by respective authors.