MAXScript Language Reference > 3ds Max Objects > Node : MAXWrapper > Node Subclasses > Camera : Node >

# Camera Common Properties, Operators, and Methods

Value > MAXWrapper > Node > Camera

| Lights and Cameras - Quick Navigation

Properties

The following properties apply to all camera types:

    <camera>.fov Float default: 45.0 -- animatable, angle

Determines how wide an area the camera views. This is the horizontal Field Of View.

    <camera>.curFOV Float default: 45.0 -- float

Returns the current Field Of View, respecting the fovType value described below.

Available in 3ds Max 8 and higher.

    <camera>.fovType Integer default: 1 -- integer

Sets the current Field Of View type.

Changes the flyout next to the FOV spinner in the Camera's UI.

Available in 3ds Max 8 and higher.

Possible values are:

1 -Horizontal

2 -Vertical

3 -Diagonal

    <camera>.orthoProjection Boolean default: false

When on, the camera view looks just like a User view.

When off, the camera view is the standard perspective-like view.

    <camera>.type Name default: #free

The type of camera:

#free- Free Camera (Target view can be set in any direction)

#target- Target Camera (Camera will always align view with target object)

    <camera>.showCone Boolean default: false

Displays the cone (actually a pyramid) defined by a camera's field of view.

The cone appears in the other viewports but does not appear in a camera viewport.

    <camera>.showHorizon Boolean default: false

Displays the horizon line.

A dark gray line appears at the level of the horizon in the camera's viewport.

    <camera>.nearrange Float default: 0.0 -- animatable; alias: Near_Env_Range

The near range for atmospheric effects.

    <camera>.farrange Float default: 1000.0 -- animatable; alias: Far_Env_Range

The far range for atmospheric effects.

    <camera>.clipManually Boolean default: false

Turn on to define clipping planes.

When Clip Manually is off, geometry closer to the camera than 3 units is not displayed.

    <camera>.nearclip Float default: 1.0 -- animatable, alias: near_clip

Objects closer than the near clipping plane are invisible to the camera.

    <camera>.farclip Float default: 1000.0 -- animatable, alias: far_clip

Objects farther than the far clipping plane are invisible to the camera.

    <camera>.showRanges Boolean default: false

When on, displays yellow rectangles within the camera's cone to show the Near and Far range settings.

    <camera>.targetDistance Float default: 160.0 -- animatable, alias: Target_Distance

Sets a point to use as an invisible target.

    <camera>.mpassEnabled Boolean default: false -- boolean; MultiPass_Effect_Enabled

Enable/Disable the MultiPass Camera Effect.

    <camera>.mpassRenderPerPass Boolean default: false -- boolean; MPEffect___Render_Effects_Per_Pass

Enable/Disable the Render Per Pass option.

    <camera>.multipass_effect SubAnim default: SubAnim:MultiPass_Effect -- SubAnim
    <camera>.mpassEffect Depth_of_FieldMPassCamEffect default: Depth_of_FieldMPassCamEffect:Depth_of_FieldMPassCamEffect -- SubAnim

Get/Set the MultiPass Camera Effect. See MPassCamEffect objects for details.

To preview a MultiPass Camera Effect in the viewport, see the maxOps.displayActiveCameraViewWithMultiPassEffectMethod

FOR EXAMPLE:
    $Camera01.mpassEffect = Motion_BlurMPassCamEffect()
    $Camera01.mpassEffect.disableAntialiasing = true

Note

The .fov property value is the horizontal FOV in degrees.

The Vertical and Diagonal FOV and Lens values are based on the horizontal FOV and the current renderer Aperture Width.

See the new properties and functions added to 3ds Max 8 providing access to the FOV type and current value.

You can also use the following MAXScript function to calculate the Vertical FOV from the Horizontal FOV:

FUNCTION:

    fn GetCamVFOV theCamera =
    (
    	local r_aspect=(renderWidth as float)/renderHeight
    	2.0*atan(tan(theCamera.fov/2.0)/r_aspect)
    )

## The CameraFOV Structure:

The CameraFOV structureavailablein 3ds Max 8 and higher provides a set of functions related to Camera Field Of View conversion:

    <float>cameraFOV.FOVtoMM <float fov>

Converts the supplied horizontal FOV to lens MM.

    <float>cameraFOV.MMtoFOV <float mm>

Converts the supplied lens MM to horizontal FOV

    <float>cameraFOV.CurFOVtoFOV <camera> <float cfov>

Converts the FOV in the camera's current FOV direction to horizontal FOV.

See also the new camera properties .fovType and .curFOV providing access to the FOV type flyout and the current value defined by the state of the flyout.

    <float>cameraFOV.FOVtoCurFOV <camera> <float fov>

Converts the horizontal FOV to the FOV in the camera's current FOV direction.

See also the new camera properties .fovType and .curFOV providing access to the FOV type flyout and the current value defined by the state of the flyout.

EXAMPLE
    c = freecamera()
    --> $Free_Camera:Camera01 @ [0.000000,0.000000,0.000000]
    cameraFOV
    --> #Struct:cameraFOV(
    FOVtoMM:<fn>,
    CurFOVtoFOV:<fn>,
    FOVtoCurFOV:<fn>,
    MMtoFOV:<fn>)
    cameraFOV.FOVtoMM 45 --convert horizontal FOV of 45 degrees into mm
    --> 43.4558
    cameraFOV.MMtoFOV 43.4558--convert 43.4558 mm back to degrees
    --> 45
    c.fovType = 3--set the FOV type to diagonal
    --> 3
    cameraFOV.CurFOVtoFOV c 54.7473--convert diagonal to horizontal FOV
    --> 45
    cameraFOV.FOVtoCurFOV c 45--convert 45 deg. horizontal to diagonal FOV
    --> 54.7473
    c.curFOV--current FOV type, in this case 3=diagonal
    --> 54.7473
    c.fov--this is ALWAYS the horizontal FOV!
    --> 45
    c.fovType = 1--set current FOV to 1=horizontal
    --> 1
    c.curFOV--the current FOV is now horizontal
    --> 45
    c.fov--this must return the same as current, as both are horizontal
    --> 45

## Simulating Zoom Extents All

The following script changes the fov of specified camera to simulate a "zoom extents all" for the camera.

EXAMPLE
    fn ZE_Cam cam objs =
    (
    local max2, fov, asp, v-- declare local variables
    -- define a function that returns the maximum value
    -- of a set of values in an array
    fn maxof vals = (local v=vals[1];for v1 in vals do (if v1 > v do v=v1);v)
    fov=0-- initialize the fov value
    asp=(renderWidth as float)/renderHeight-- calculate the renderer's image aspect ratio
    in coordsys cam-- work in coordinate system ofthe camera
    (
    for obj in objs where obj != cam do-- loop across all objects except the camera
    (
    if obj.min.z >=0 do continue-- if object is behind camera, skip it
    -- get max value of the object's bounding box, correcting for the image aspect ratio
    -- in the y values
    v = maxof #((abs obj.max.x),(abs obj.min.x),(abs (obj.max.y*asp)),(abs (obj.min.y*asp)))
    fov = maxof #(fov,(2*atan(-v/obj.min.z)))-- increase fov if needed
    )
    )
    cam.fov=fov-- set the camera's fov to the new fov value
    )
    -- test bed --
    cam=$camera01-- specify the camera to "zoom extent all" on
    ZE_Cam cam $*-- call the function, passing the camera and an object set containing all objects

#### See Also

- Depth_of_FieldMPassCamEffect : MPassCamEffect

- Motion_BlurMPassCamEffect : MPassCamEffect

- Node Common Properties, Operators, and Methods

- MAXWrapper Common Properties, Operators, and Methods

- Value Common Properties, Operators, and Methods