AE ENHANCERS

Expressions/Scripts/Presets
It is currently Sat Feb 11, 2012 2:48 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Place and orient layer on a plane formed by three points
PostPosted: Mon Oct 11, 2004 5:22 pm 
Offline

Joined: Sat Jun 12, 2004 5:31 am
Posts: 1
Location: Brussels
Hi,

When I import data from a 3D soft or from a 3D tracker into AE, I need to place and orient a layer to some nulls coming from the 3D data. Instead of adjusting this manually you can use the following expression. Remember that this expression uses three nulls/lights/layers that should be placed on top of the layer to be placed.

Position expression:

Code:
a = thisComp.layer(thisLayer, -1).position;
b = thisComp.layer(thisLayer, -2).position;
c = thisComp.layer(thisLayer, -3).position;

(a+b+c)/3


This places the layer in the middle of the three points.

You then have to add an expression for the orientation :

Code:
a = thisComp.layer(thisLayer, -1).position;
b = thisComp.layer(thisLayer, -2).position;
c = thisComp.layer(thisLayer, -3).position;

n = cross ((a-b),(a-c));
orientation+lookAt(a, n)


This will orient the layer to be parallel with the plane formed by the three points. You'll need to manually adjust the Z orientation though.

Any feedback or suggestions to make it better are really apreciated.

Donat

_________________
----
Donat Van Bellinghen


Top
 Profile  
 
 Post subject: If only I'd looked at this a couple of weeks ago
PostPosted: Wed Dec 21, 2005 6:05 pm 
Offline

Joined: Thu Jun 17, 2004 1:58 pm
Posts: 7
I wish I had looked at this a couple of weeks ago as we were doing a lot of camera tracking and had to do exactly what this script is designed for, eyeing it in manually is no fun at all!!
As soon as I get a chance I'll try it out and let you know how it goes.
Glenn Stewart
1k Studios


Top
 Profile  
 
 Post subject: Re: Place and orient layer on a plane formed by three points
PostPosted: Wed Apr 29, 2009 3:53 pm 
Offline

Joined: Fri Aug 03, 2007 11:15 am
Posts: 1
Hi Donat

I've been trying to use this expression. It seems straight forward.
But when I apply it to a layer with 3 null points in space, the plane does not intersect the 3 null points.
Furthermore, if I change the order of the nulls the Normal changes. I don't get this... the normal would be the same whatever the order, at worst it would reverse direction, but not the orientation.
I cant figure out where its going wrong. The Maths are sound, so why doesn't this work for me. Grrrr!
I could have really used this today.
Any chance of a teeny weeny project example to put my hurting brain at its ease.


Top
 Profile  
 
 Post subject: Re: Place and orient layer on a plane formed by three points
PostPosted: Thu May 07, 2009 8:14 am 
Offline

Joined: Fri Dec 07, 2007 10:11 am
Posts: 128
dkvfx,

I've check this expression and it worked for me !
I've used the same scenario you've described: 3 Null layers in 3D space in order to position and orient a solid according to them, and it worked great.

Note however for a few things:
1. You have to put the 3D layer JUST below the 3 Nulls.
2. Perhaps your layer is too small and that is why it doesn't intersect the 3 Null points ?
3. Try using square pixels.

Koby.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group