Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression for 3D rotation to value

  • Expression for 3D rotation to value

    Posted by Matthew Reithmayr on March 28, 2013 at 8:46 pm

    I’m trying to adjust the intensity of a flare based on how far away from straight at the camera a light is pointing.

    Anyone know an expression to get a value from an x/y/z orientation into a single number?

    i.e. A light pointing straight at the camera is at (0,0,0) which give a value of 100 (or whatever), where the same light pointed at (90,90,0) would give a value of 0. Then I can use this to adjust the brightness of a flare based on the lights angle.

    Thanks,

    Matthew Reithmayr
    doulosmedia.com

    Dan Ebberts
    replied 13 years, 1 month ago
    2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    March 28, 2013 at 9:02 pm

    Try this:

    C = thisComp.layer(“Camera 1”);
    L = thisComp.layer(“Light 1”);
    v1 = C.toWorldVec([0,0,1]);
    v2 = L.toWorldVec([0,0,-1]);
    Math.max(dot(v1,v2)*100,0)

    Dan

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