MtoA Arnold for Maya DOF Focus Assist Tool
Hey! I’m an old school CG artist from the days of CPU rendering and depth pass and zDefocus, and only recently got over the psychological barrier of doing in-camera DOF. My conclusion – it’s liberating. Of course, GPU render engines like RedShift is the real deal for this kind of workflow.
But for now, for those who want to give it shot at using Arnold for in-camera DOF, here’s a little script to quickly set up a focus assist locator which you can position as you wish. Just select the camera and run the script to get a focus assist locator. Hope it helps and let me know if you’ve some ideas to improve tool.
A simple tool to have viewport locator feedback for Arnold’s 3D depth of field. You can exactly direct the camera’s focal point in 3D space. It’s easier for me to see and animate this locator than to try animating “distance from camera” value. Hope you find this useful too. Cheers!
//Author: Ronald Fong //Date: 09 June 2018 //Usage: Just select your render camera and run the script. Enjoy! global proc rf_aiDof() { string $cam[] = `ls -sl`; if (!objExists($cam[0])) { print "Ooops! Please select a camera! \n"; } else { string $camShape[] = `listRelatives -s $cam[0]`; float $camPos[] = `getAttr ($cam[0] + ".translate")`; string $locs = `distanceDimension -sp 1 1 1 -ep $camPos[0] $camPos[1] $camPos[2]`; connectAttr -f ($locs + ".distance") ($camShape[0] + ".aiFocusDistance"); setAttr ($camShape[0] + ".aiEnableDOF") 1; setAttr ($camShape[0] + ".aiApertureSize") 1; setAttr ($camShape[0] + ".aiApertureBlades") 5; string $creation[] = `ls -sl`; string $camLoc[] = `listRelatives -parent $creation[0]`; parent `listRelatives -parent $creation[0]` $cam[0]; parent $creation[1] $cam[0]; select -cl; print "Success! Position the focus locator as you please! \n"; } } rf_aiDof();