PDA

View Full Version : Q: DOF and Autofocus...


BlueVoodoo
02-10-2003, 09:29 AM
Hi!

Ok, I dont know if this is possible but I'll ask you guys anyway.

Normally I keyframe the Focus Region Scale in the DOF-settings manually in order to get the focus region where I want it. In other words:

First I turn on the Object Details in the Heads Up Display-menu. Then I select the object I want focused (the eyes for instance). Then I more or less copy the value from Distance to Camera to the Focus Region Scale of the camera manually. This can be a time demanding procedure if the character and the camera is moving a lot.

So... Basically my question is, would it be possible with a little help from a MEL-script or some type of Driven Key create an Autofocus function. (To automatically copy the distacevalue between a camera and a object for all of the frames in a timeline)...

/BlueVoodoo

P.S I dont have any experience at all in MEL-scripting! :)

playmesumch00ns
02-10-2003, 10:45 AM
Don't know the exact attribute names, but it would go something like this:

create an expression, call it camFocus or something. Assuming you've got a locator called eyeLoc smack bang between the eyes where you want the focal point, and assuming the parameter you want the distance value to go into is called focusRegionScale as you have indicated, the expression would go like this:

float $camToEyes[3];

$camToEyes = eyeLoc.translate - camera1.translate;

float $distance = sqrt( camToEyes[0] * camToEyes[0] + camToEyes[1] * camToEyes[1] + camToEyes[2] * camToEyes[2]);

setAttr camera1Shape.focusRegionScale $distance;


this just makes a vector from the camera to the eye locator, calculates it length and copies that value into the Focus Region Scale attribute of the camera. The reason you want an expression is so it will be evaluated every frame.

colt
02-10-2003, 11:32 AM
There are some melscripts on highend3d.com, which give you a locator for your focal point, bind that to your object.

on www.pixho.com in the toolbox is another script for dof management.

BlueVoodoo
02-10-2003, 12:21 PM
Thanks for the replys. Im pleased to hear that its possible. :applause:

GrafOrlok
02-10-2003, 12:56 PM
This thread might help too...
http://www.cgtalk.com/showthread.php?s=&threadid=42265

CGTalk Moderation
01-14-2006, 09:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.