ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Auto orient to camera plane (not camera!)

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jim Darski
Auto orient to camera plane (not camera!)
on Sep 8, 2012 at 2:08:44 am

I have been searching for an answer to that for hours but in vain so far... But I know it can be done...
Here is the problem: I have a bunch of screens in 3d space that are slowly rotated by a null (in y axis so they are orbiting around).
While they circulate around I want them to always stay facing the camera plane, but not the camera itself. Auto-orient to Camara or Auto-orient on Y axis script doesn't work for me. The reason is you can start to see them twist in perspective the more they go off center. In other words they do not face the same direction but each one has it's own orientation towards the camera. I want all of them to keep facing the same direction which is the camera plane (not camera's anchor point). I'm sure there must be a script that does it...
Is you know it, let me know, please!

Appreciate your help.


Return to posts index

Dan Ebberts
Re: Auto orient to camera plane (not camera!)
on Sep 8, 2012 at 2:54:19 am

Try this orientation expression:


L = thisComp.layer("Camera 1");
u = fromWorldVec(L.toWorldVec([1,0,0]));
v = fromWorldVec(L.toWorldVec([0,1,0]));
w = normalize(fromWorldVec(L.toWorldVec([0,0,1])));

sinb = clamp(w[0],-1,1);
b = Math.asin(sinb);
cosb = Math.cos(b);
if (Math.abs(cosb) > .0005){
c = -Math.atan2(v[0],u[0]);
a = -Math.atan2(w[1],w[2]);
}else{
a = (sinb < 0 ? -1 : 1)*Math.atan2(u[1],v[1]);
c = 0;
}
[radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]


Dan



Return to posts index

Tim Drage
Re: Auto orient to camera plane (not camera!)
on Sep 11, 2012 at 9:21:41 am

Useful, thanks!


Return to posts index


Jim Darski
Re: Auto orient to camera plane (not camera!)
on Oct 1, 2012 at 7:13:30 pm

Thanks so much Dan!
This expression work really well. Got sidetracked by several other projects, thus the delay in reply. Anyway, this is a really nice expression. AE should incorporate in the auto orient settings!
J.


Return to posts index

johannes eichberger
Re: Auto orient to camera plane (not camera!)
on Dec 20, 2012 at 11:55:55 am

Thanks, Dan - really a great expression.


Return to posts index

nate mulliken
Re: Auto orient to camera plane (not camera!)
on Jan 23, 2013 at 8:09:44 pm

Awesome! Dan you are the best.
For those that may have made it this far and need that extra helping hand, it may be good to mention to make sure you zero out all orientation and rotation parameters first. Then lay this expression into the orientation parameter making sure that the name of your comp camera matches the camera name in pasted expression.

Obvious stuff for some but my first question was "where do I put it?"
once I got it in it works great.

Hopefully this is all correct information.


Return to posts index


Nick Ll
Re: Auto orient to camera plane (not camera!)
on Feb 6, 2018 at 5:49:38 am

Thanks for the additional tips Nate! Im new to expressions so that a helped me out. An additional question I have is there any way to use the "Active Camera" rather than the specific camera. Im switching between multiple cameras in my animation but get the sides of objects when i switch, and my futile attempt to put "Active Camera" as the camera name gives me an error. Is there any simple solution if not I could work around it.


Return to posts index

nate mulliken
Re: Auto orient to camera plane (not camera!)
on Feb 6, 2018 at 4:51:11 pm

Nick,
It has been a long time since I have looked into this. I like the idea of using the active camera.
Not sure how Dan's expression would respond to that.

Is there perhaps a way to use your muli-cam set up as a reference then manually mimic the cuts with new cameras and/or subcomps once you have a lock on your shots?

Then you'd be able to enter the expression on each one?

I realize this is obvious and very clunky not to mention a nightmare to edit if your cuts were to change.


Return to posts index

nate mulliken
Re: Auto orient to camera plane (not camera!)
on Feb 6, 2018 at 4:55:42 pm

Also not sure how you tried to enter active camera in the expression. for example typed out like "activeCamera"

Perhaps look up how to create global variables in After Effects using a controller layer. You may be able to use the expression in some form of controller layer that looks for activeCamera.

-Nate


Return to posts index


Nick Ll
Re: Auto orient to camera plane (not camera!)
on Feb 9, 2018 at 12:38:18 pm

Ha, its only been five years, lol. Thanks for the extra help. Unfortunately for the moment its a bit over my head. But I have managed to rework everything so they are obscured from the other camera views. Will definitely do a deeper dive on this in the future. Thx again


Return to posts index

Jim Darski
Re: Auto orient to camera plane (not camera!)
on Aug 12, 2013 at 9:00:34 pm

I have no idea why but I getting an error on your expression:



Please help!


Return to posts index

Dan Ebberts
Re: Auto orient to camera plane (not camera!)
on Aug 12, 2013 at 10:10:39 pm

Hard to say without seeing a project file with the broken expression.

Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]