Wednesday, January 7, 2009

Size & positionZ

Autodesk Tips & Tricks - Size & positionZ


First, i must thanks Tim Farrell for giving me this genius expression formula in autodesk smoke forum.

What i like to do here is, from the normal camera view, the picture looks nothing special.

However, once you rotate the picture or camera, it would reveal that the picture is actually formed by brunch of pictures with different z-depth.

Here, for simple illustrate, i take the same media and enter it few times, and crop each differently. For better effect, you can use gmask to mask out portion of the object out each.
In axis1 scaling, enter expression :

100*(axis1.position.z/(288/tan(radians(-0.5*camera.fov))))+100


In axis2 scaling, enter expression :
100*(axis2.position.z/(288/tan(radians(-0.5*camera.fov))))+100


and so on for other axis, just change the axis name accordingly. Mine is PAL pixel, for NTSC pixel, change 288 to 243 instead.


Then, just move each clip's positionZ close or further away, the scaling will take care of itself.

GPS - Global Position System

Autodesk Smoke Tips & Tricks - GPS

I'm back !! See, i told you "i'll be back!!" even though i forgot to wear my sun glasses. This technique is simple yet very powerful, it will detect the positionXY of an object. It's a bit advance than the GPS because mine also detect rotation.
Refer to the diagram below, the leftmost node is "A" still image attach to axis1. Text1 and Text2 node are label text "Position X" and "Rotation Z". You can add Text3 "Position Y" yourself here.Ready a 10 frames clip (from 0 to 9), enter as media 6 times. The 1st 3 is for position, last 3 is for rotation. Add 3 more if you have positionY.
For the 1st left number clip (the 10 frames) , in media slip & matte slip, enter expression :
((floor(abs(axis1.position.x/100))%10)+1)- frame

For the 2nd left number clip, enter expression :
((floor(abs(axis1.position.x/10))%10)+1)- frame

And for 3rd, enter expression :
((floor(abs(axis1.position.x/1))%10)+1)- frame

Now for the next 3 number clips.

For the 4th left number clip, enter expression :
((floor(abs(axis1.rotation.z/100))%10)+1)- frame

For the 5th number clip, enter expression :

((floor(abs(axis1.rotation.z/10))%10)+1)- frame

And for 6th, enter expression :
((floor(abs(axis1.rotation.z/1))%10)+1)- frame
Now, move and rotate your axis1 A image. The GPS will start to work.

For the negative and positive sign, you can add a 2 frames clip (+ and -), then in the media slip add expression :

frametoslip(if(axis1.position.x>=0, 1, 2))

As i mentioned earlier, this is very powerful technique, it can detect any parameter for an object (position, rotation, scaling, transparency, rgb color, crop .....). Plus, you can use it as number counter as well, just throw the A image away and use the axis positionX to control the counter.