Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions What does toCompVec actually do?

  • What does toCompVec actually do?

    Posted by John Watson on November 10, 2013 at 9:43 am

    Hello,
    I found this expression on Dan Ebberts’s site: if (toCompVec([0, 0, 1])[2] > 0 ) value else 0

    What exactly does it mean to transform a vector from layer space to composition space?
    We take the vector and put it on the Camera 0,0,0 and check the direction? I am trying to understand it so I made a text layer with source text toCompVec([0, 0, 1]), but the result is very confusing to me. ( link )

    I would be grateful if someone could describe a little how it works, or visualize it to me.

    Thank you!

    John Watson replied 12 years, 10 months ago 3 Members · 3 Replies
  • 3 Replies
  • Todd Kopriva

    November 10, 2013 at 4:35 pm

    If a vector is in the coordinate space of a layer, but the layer is moved (say, rotated), then the vector is pointing in a different direction in the coordinate space of the composition. This method converts between those two coordinate spaces.

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    After Effects quality engineering
    After Effects team blog
    ———————————————————————————————————

  • Dan Ebberts

    November 10, 2013 at 5:31 pm

    That expression takes a vector aligned with the layer’s Z axis, and converts that to an equivalent vector in comp space coordinates. Since comp space is defined by the current camera view, the expression can then easily determine if the vector is pointing towards, or away from the camera.

    Dan

  • John Watson

    November 11, 2013 at 6:56 am

    Hi,

    Is it right to say that toCompVec basically is subtracting toComp of the anchor point from the toComp of the vector end point(0,0,1 in our case)?

    What I am not understanding is how for example the vector 0,0,1 becomes 0,0,2666.66 in the composition space, why the vector size is changing? I know that from that the direction from the camera perspective is right, but the vector supposed to have the same length.

    Thank you for your very quick answer :)!

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