Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions SureTarget 2 messing up expression

  • SureTarget 2 messing up expression

    Posted by Aaron Pozzer on April 21, 2011 at 5:22 pm

    hey all. i just decided to try out ST2 today after hearing about it, hoping it might help my camera animation for my current map project.

    the animation is relatively straight forward. camera zooms in from afar and then moves around, mostly in x and y from that point on. i had a bunch of text layers (3d) and had found an applied this expression to them, to keep their scale relative to the size of the comp (so they didnt get bigger as the camera got closer)…

    cam = this_comp.active_camera;
    distance = length(sub(position , cam.position));
    s = distance / cam.zoom;
    result = mul(scale, s);

    result * thisComp.layer("Adjustments").effect("Scaler")("Slider")

    (i added in the result part at the end to control the scale of the text if i found it to be or too small)

    so this all worked fine until i added ST2. im not exactly sure why its not working though. as i scrub the dolly control, i can see that its driving the Z position of the camera, just as i had manually animated before, but for some reason now, the text does not work/scale as expected in relation to the cameras dolly/Z position. the expression is doing SOMETHING, as the #s for the scale are still changing as i scrub the dolly, but they are not changing enough, or at the right rate to maintain the relative size of the text on screen.

    both my original camera and the ST camera are using the 24mm preset, so its not just a matter of a different lens.

    strangely, also, since the expression refrences the active camera, not a camera by name, even if i am viewing thru my original camera (it is active) the scale doesnt work. if i change the expression to name my old camere specifically, the expression works again.

    so im not sure if anyone knows enough about how ST2 works, and why it is causing the scale expression to NOT work properly, but maybe someone will have some ideas. i posted on the video copilot site as well, so maybe between both it will get solved.

    so, hopefully someone can shed some light on this! thanks!

    Aaron Pozzer replied 15 years, 1 month ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 21, 2011 at 5:43 pm

    The camera is probably parented. Try changing the second line to this:

    distance = length(sub(position , cam.toWorld([0,0,0])));

    Dan

  • Aaron Pozzer

    April 21, 2011 at 7:51 pm

    once again Dan, you got it. right off the bat i should have noticed that the layer was parented, but i overlooked it. the tweak to the expression fixed it.

    so in this instance we use toWorld instead of position because toWorld sets the position based on where it is on screen?…where as if it was picking up position of the parented camera, it would think its somewhere that its not, as its inheriting the transforms of the parent? i havent gotten to that section of the book yet so im not quite sure what toWorld, toComp, fromWorld, etc, all do, haha.

  • Dan Ebberts

    April 21, 2011 at 7:57 pm

    toComp() gives you the position relative to the screen. toWorld() gives you the position in the comp’s 3D space. Parented layers take on the layer space of the parent, so the layer’s position becomes relative to the parent’s upper left corner, generally.

    Dan

  • Aaron Pozzer

    April 21, 2011 at 7:59 pm

    you would think with 15 yrs of 3d experience this would make more sense to me!

    regardless, thanks again for the help.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy