Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expression for automatic scaling of layers in Z space?!

  • Expression for automatic scaling of layers in Z space?!

    Posted by Akiranakayama on July 18, 2006 at 5:50 pm

    Ok, so the title of this post, I admit, is a bit confusing. What I’m trying to do is to find a way to automate a process that many of us have been thru in trying to set up an AE comp to do 3D fly throughs of a layered photoshop doc. You know what I’m talking about, where you cut apart a photo or make a scene in photoshop out of all these elements. You take that into AE, turn those all into 3D layers, then spread them out in Z space, THEN you go and rescale all of them to make them look like the same scale from the active camera.

    I know there must be an expression that you can write that will automatically scale the layers so that they look “correct” from the active camera in the comp. Any takers?

    Dan Ebberts
    replied 19 years, 9 months ago
    3 Members · 2 Replies
  • 2 Replies
  • Mylenium

    July 18, 2006 at 6:59 pm

    It could be done, but it wouldn’t be very comfortable to use, depending on what you actually do with the camera. The main problem is to find the dimensions of the layer when the are placed on the projection circle/ distant plane. Since AE does not give you acces to the layer’s corner points directly, you have to add extra math to determine the offset from the ideal circle (the supposed projection) vs. the real projected position in relation to the layer anchor point.

    Mylenium

    [Pour Myl

  • Dan Ebberts

    July 18, 2006 at 7:11 pm

    Try these expressions for scale and position. You have to hard-code in the initial position of the camera.

    // scale

    base = thisComp.layer(“Base Layer”); // base layer
    cPos = [320,240,-1343.5]; // camera initial position

    s = value[0]*length(position,cPos)/length(base.position,cPos);
    [s,s,s]

    // position

    base = thisComp.layer(“Base Layer”); // base layer
    cPos = [320,240,-1343.5]; // camera initial position

    ratio = length(position,cPos)/length(base.position,cPos);
    center = [thisComp.width,thisComp.height]/2;
    newXY = ([value[0],value[1]] – center)*ratio + center;
    [newXY[0],newXY[1],value[2]]

    These may not be exactly right, but something similar should work.

    Dan

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