Thursday, November 27, 2008

Pageflow

Autodesk Smoke Tips & Tricks - Page flow

What we're going to do today is kind of like iTune's pages flow effect, hundred of pages flying from left to center, then right. The difficult part of this effect is, how to control all the pages's animation at once, without making hundred of keyframes at each layer. Here, i would use the expression to do the job.First, load a clip and animate it from left (frame0) to center (frame25), to right (frame50), total 50 frame animation. Turn on Z-buff.

You can do your own animation. Here, i use this : frame 1, position x-1800, y0, z-2000At frame 25, position x0, y0, z-800. At frame 50, position x1800, y0, z-2000 This 50frame left to right animation, we would call it as default animation.

After that, rename the axis to axisD (Dummy Layer), and hide the clip. Create a new axis, name it axisC.Load a new clip, axis1. At axis1, enter expression :
eval(axisD,(frame*axisC.position.z)-(1*axisC.position.y)+axisC.position.x)Next, load and create more clips and axis, depend on how many pages you like to have.Then, select axis2, enter expression :


eval(axisD,(frame*axisC.position.z)-(2*axisC.position.y)+axisC.position.x)


And, do the same for other axis, just change the 2 to 3 for axis3, and so on until the last axis. Remember that you can use the 'up arrow' to scroll through the previous typed expression, no need to re-type back everything, or just use 'duplicate' layer feature.


Now the expression part is done, we will focus on how to control the pages flow with axisC. If you play the animation now, nothing will happen.

At axisC, set the position to X0, Y0, Z1. Play the animation, only see one layer, because all layers all stack together.
Now, we need to set the offset of the pages. Move to frame50, and drag the Y to set the offset. Here i set Y10 for the offset. And play the clip to see the result.

Then try set the Z to 2 (200% speed), play the animation. Then try 0.5 (50% speed). For now, we will leave it at 1 (normal speed).Then, try drag the X, this will let you fetch through all the pages, you can control which page are shown on the screen with this positionX, you can animate it to have the animation go forward, backward, or freeze. When you animate this, set it to the proper curve that you want (linear, hermite, constant).You can also leave the Z to zero, and animate the whole pages flow by positionX alone.Still remember the default animation, the dummy layer ?
You can change the dummy layer animation anytime you want, add more keyframes, do some fancy move, and all the layers will change accordingly.

See, if you do this manually one by one, layer by layer, it will take hell lot of time, and if you ever need to change the animation, then 'may god bless you'. The expression technique present here, might look like a lot of work, but actually it only takes less than 15 minutes for me to do hundred layers. It's flexible, easy to animate and make changes.

Friday, November 21, 2008

Rubik

Autodesk Smoke Tips & Tricks - Rubik

Have you ever try to do a rubik ? At first glance, you might think that it is quite easy, just a few axis lock to each row and column will do the trick. However, is not so simple, with every rotation of the rubik, the relationship of the cubes is changing (27 cubes in total), there's no way you can lock them to a fix axis.

In this mail, i will only focus on the movement of the rubik, not how to build the rubik from zero up, perhaps next time. First, we will use 'Import' to load a 'Box' 3D model. If you don't know where's your 3D model is, normally it's in your '/usr/discreet/smoke_2008/models' folder. Set it to view '3D studio', then you will see the 'Box' model.
After loading the 'Box' into screen, remember to turn on the 'Shading' and 'Z-buff' on your DVE setup. The first thing we need to do with this 'Box' is to move it to the center of screen, and to move it's 'center point' to the center of screen, not just x & y, but also in z. This will enable us to rotate the rubik verticle and horizontal easily later without worry of the 'center point' of the rotation.
The numbers i use here is, positionY -129.55, and centreY 129.55, and size it down to 50%.
Make 8 more copies of the cube, then arrange the 8 copies around the 1st cube we build just now, like below.
This is our center row, you can temporary attach an axis to the 9 cubes, then use copy branch to make 2 more copies.
Then throw away the temporary axis. You should have 27 cubes now.
Leave the 1st 9 cubes (the center row), Z move the 2nd 9 cubes to form the front row, and the 3rd 9 cubes to form the back row. To see the 3D effect, just move and rotate the camera a bit. You can name your axis properly something like "center top left","top row left".., but that wouldn't help much because thier relation and position will change with every rotation.
Now, say i want to rotate the 1st row, i need to find the 9 cubes that involve, and add a axis above it.
After found the 9 cubes, use duplicate (Green line) to link the axis together, and rotate it.To make a 2nd rotation, just find the new 9 cubes that's involve, and add a new axis above it just like what we did before. For every rotation, you will need to find the 9 cubes and add a new axis above it. To easy locate the 9 cube, i will start with hiden all cubes, then turn them on one by one, if that's the cube i want, i add a new axis above it.
This is how my nodes look like after 4 rotation. One rotation, One axis ! And each rotation, will form a new storey. The lower axis is the old rotation, the highest axis is the latest rotation.
To animate the cube start form messing up, then turn into a perferct one, just start from the highers axis first, turn the rotation to zero, then go to the next level, and turn it to zero level by level.
You can add a axis to control the movement of the whole rubik, just connect it to the highest axis of each column (27 columns in total).

That's it, you can start mess up your rubik now, knowing that you can always fix it back to normal.

Saturday, November 15, 2008

1st Game

Autodesk Smoke Tips & Tricks - 1st Game

Although this game is qualified to be awarded the worst game of the century, but it is the first ever published smoke game !! A game that play on a million dolar machine.
The game is simple, there's a hiden treasure, you move the X around the screen to find it. If you're closed to the treasure, the word 'Close' will appear, if you're far, then 'Far' appear. If you are at the exactly position of the treasure, the word 'Correct!!' will appear.

First, add a axis (axis1), add a 'X' still (axis4), and 3 Texts, as picture above.
Text 1 type 'Far'
Text 2 type 'Close'
Text 3 type 'Correct!!' On text1 transperancy, enter expression :
if(abs(axis4.position.x - axis1.position.x) >150, 0, 100)

On text2 transperancy :
if(abs(axis4.position.x - axis1.position.x) <150
&& abs(axis4.position.x - axis1.position.x)!=0,0,100)
On text3 transperancy :
if(abs(axis4.position.x - axis1.position.x)==0,0,100)
On axis1, select both x & y, enter expression :
floor(truerand(-250,250))
Note that sometime 'truerand' will halt the machine. May be you can try this instead :
floor(noise(frame)*250)
Next, duplicate the 3Texts branche, and change the expression, just change the 'x' to 'y'.
On text6 : if(abs(axis4.position.y - axis1.position.y) >150, 0, 100)
On text5, just follow text2, and change 'x' to 'y'
On text 4 : if(abs(axis4.position.y - axis1.position.y)==0,0,100)
Move tex4,5,6 below text1,2,3. Text1,2,3 is for X, Text4,5,6 is for Y.

Make you animation 25 frame long. And that's it. You can start play by move the 'X' on screen.
After you success to locate the treasure, you can start a new game by just scroll to another time in timeline.

Friday, November 14, 2008

Swing

Autodesk Smoke tips & Tricks - Swing

Swing, swing baby, swing, swing to the left, swing to the right, swing, swing ....
... Ok, enough, back to business !!

Here's what we're going to do, as you pull the 'X fade' up, 'A' will swing faster and higher (I should have have use 'B' instead) .

Add 'A' and 'X' to the screen.


Add 2 new axis, axisE and axisC, connect axisE to A, and connect axisC to X.



In axisE, pull the centreY to the top of character 'A', this is the center of the swing.

In axisE rotation Z, enter expression :

sin(frame/10)*(axisC.position.y/5)

Now, you can control the swing of 'A' with axisC positionY, the higher the value, the faster and higher the swing.

Ok, are you ready to swing now....

... swing baby, swing, swing to the left, swing to the right, swing ...

Friday, November 7, 2008

Beat Bar Animation

Autodesk Smoke Tips & Tricks - Beat Bar Animation

Since we are talking about beat bar previously, i would continue with another expression technique with beat bar.

Ready a beat bar still frame like below, here i got 10 levels beat per-bar.
Make the clip 11 frames long. And using the top crop, 1st frame crop evrything out, 2nd frame reveal only the 1st lower beat, 3rd frame reveal 2 lower beats, 4th reveal 4 beats...., go on until all beat reveal at frame 11.
Set the crop animation to 'Constant', and set the right button to 'Rev + Cycle'. Extend the animation to a longer duration, here i set 250 frames.
Play the beat bar and see what's happening, it should be run continuously now. Using the still frame beat bar, load it many times as media, the more the better. Arrange each bar side by side.
At media2, enter expression : eval(media.media1.crop.top, frame-2)
At media3, enter expression : eval(media.media1.crop.top, frame-4)
At media4, enter expression : eval(media.media1.crop.top, frame-6)
continue this pattern until the last media.
Note that when you entering expression, you don't have to type everything everytime, just use the up or down arrow key to scroll through the previous entry, and change just the number that need to be changed.

Remember to ON all the crop for all medias.
Now play the bars, it will create kind of wave pattern where the 1st bar transfer the value to the 2nd bar, then 2nd bar will transfer the value to 3rd bar. By using this techniques with crop top and crop bottom, you can create pixel drawing on screen, like for example a smiling face.

By the way, you can do this manually, just animate the first bar like above mentioned, copy it to other bars, then offset each bar animation by using TranslationX or with TRACK view. However, by using expression, i would only need to do it once, if i change my animation, i only need to change the 1st bar.