Mantra Depth of Field

   10308   4   2
User Avatar
Member
5 posts
Joined: July 2005
Offline
I want to animate a camera that is looking at an object, but I want to keep it in focus without having to animate the camera focus parameter manualy….
Is there any way to link the distance between the camera and that object to the FOCUS value of the camera?

Thanx a lot

Andre Souza
User Avatar
Member
4140 posts
Joined: July 2005
Offline
Have you tried the “distance” expression? Page 6 in the expressions pdf - I haven't tested this below, but something like:

distance(cam/tx,cam/ty,cam/tz,foo/tx,foo/ty,foo/tz)

put into the “Focus” field of the cam. “foo” is the object in question.
Note this is pseudo-code - I avoided the complete thing since it would be so long.
for instance, the “cam/tx” portion would actually be:

ch(“/obj/cam/tx”)

Cheers,

J.C.
John Coldrick
User Avatar
Member
5 posts
Joined: July 2005
Offline
it worked perfectly….

thanx a lot for tip!

Andre C. Souza
User Avatar
Member
1631 posts
Joined: July 2005
Offline
Hi Andre,

You can use the Object CHOP to calculate the distance between the Camera & the target Object.

After calculating the distance, you can Export the data to the Focus parameter of the Camera. To do that, Right Click & Hold on the Object CHOP & select “Exporter - Set Scope…” which will bring up a dialog window.

Please make sure the Camera's Parameters is visible, especially the Focus parameter. Next, click-and-drag the “dist” parameter in the “CHOP Exporter” dialog window to the Focus parameter. You will get a “Turn Right” mouse cursor as you're dragging & a “+” sign will appear when the cursor is within the Focus parameter.

Release the mouse button & select “Export CHOP” from the pop-up. You'll notice the Focus parameter is now Orange which means it's getting the data from the Object CHOP.

Look Mom, no keyframing!

I hope the above helps!

Cheers!
steven
User Avatar
Member
5 posts
Joined: July 2005
Offline
Right on Steve!

it worked also…

thanx a lot for the help!

Andre C. Souza
  • Quick Links