Welcome!

Welcome to our community forums, full of great people, ideas and excitement. Please register if you would like to take part.

This is extra text with a test link..

Register Now

Announcement

Collapse
No announcement yet.

animating camera depth of field?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • animating camera depth of field?

    Does anyone know how to animate depth of field on a camera?
    www.richardterryclark.com

  • #2
    Depth of Field Tutorial

    But the MEL script listed below works even better.
    Last edited by Professor Watkins; November 23, 2003, 02:54.

    Comment


    • #3
      Even better; here's a MEL script that makes things even easier:

      /* This file downloaded from Highend3d.com
      ''
      '' Highend3d.com File Information:
      ''
      '' Script Name: depthOfFieldCamera v1.0
      '' Author: Sung joo, Kang
      '' Last Updated: March 1, 2001
      '' Update/Change this file at:
      '' http://www.highend3d.com/maya/mel/?s...=rendering#888
      ''
      '' Please do not alter any information above this line
      '' it is generated dynamically by Highend3d.com and will
      '' be changed automatically on any updates.
      */

      //
      // depthOfFieldCamera.mel ver 1.0
      //
      // by Gangs(gangs2@hanmail.net / gangs2@nownuri.net)
      //
      // last update 3 . 1 . 2001
      //
      // usage : 1. select camera (ex. persp)
      //
      // 2. excute this mel.
      //
      // 3. move locator
      //

      global proc depthOfFieldCamera()
      {
      string $object[] = `ls -sl -l`;

      if (size($object) > 0 ) {

      string $camera[] = `listRelatives -s $object[0]`;

      if (`nodeType $camera[0]` != "camera") error "select camera ..!!";

      float $cameraTran[] = `xform -q -ws -t $object[0]`;

      string $locatorShape1 = `createNode locator`;
      string $locatorShape2 = `createNode locator`;
      string $distance = `createNode distanceDimShape`;

      string $locator1[] = `listRelatives -p $locatorShape1`;

      xform -ws -t $cameraTran[0] $cameraTran[1] $cameraTran[2] $locator1[0];

      parent $locator1[0] $object[0];

      connectAttr -f ($locatorShape1+".worldPosition[0]") ($distance+".startPoint");
      connectAttr -f ($locatorShape2+".worldPosition[0]") ($distance+".endPoint");
      setAttr ($camera[0]+".depthOfField") true;
      connectAttr -f ($distance+".distance") ($camera[0]+".focusDistance");
      }


      }
      depthOfFieldCamera;

      Comment


      • #4
        O.K. I pasted the mel script in the script editor and when I execute, It creates a start and end point but the start point is at 0,0,0. I thought it would be at the camera? I've selected the camera before I go to execute. I even try to render a frame out and the focal length doesn't behave right. Does this work on yours?
        Last edited by aRTCy; November 27, 2003, 10:57.
        www.richardterryclark.com

        Comment


        • #5
          I haven't looked at it really closely; but I'd imagine that the start point is where the focal point is. Move that start point to where you want the render to be 'in focus'

          Just like in C4D, it's the Target that defines where the camera is in focus, not the camera itself.

          Comment

          Working...
          X