Physical : Camera

Physical - superclass: Camera; super-superclass:Node - 53:0 - classID: #(1181315608, 686293133)

Exposes the Physical Camera to MAXScript. Available in 3ds Max 2016 and higher.

Constructors:

Physical ...
Physical_Camera ... 

DOF BOX EXAMPLE:

-- Reset Max File
resetmaxfile #noprompt

-- Set the viewport Matrix
viewport.setTM (matrix3 [1,0,0] [0,0,-1] [0,1,0] [6,-150,-800])

-- Create a box
bx = box width:500 height:300 length:2000 backfacecull:true mapcoords:on
addModifier bx (normalModifier flip:true)

-- Create a checker map with tiling in U and V at 10
mp1 = checker color1:[0,200,255] color2:[255,255,200]
mp1.coords.U_Tiling = 10
mp1.coords.V_Tiling = 10

-- Assign a physical material to the box
bx.material = PhysicalMaterial base_color_map:mp1

-- Create and assign to the scene a Physical_Camera_Exposure_Control
SceneExposureControl.exposureControl = Physical_Camera_Exposure_Control()

-- Create a photometric Freelight
om = Free_Light pos:[0,-300,250] global_ev:6

-- Create a Sphere
sph = sphere radius:50 pos:[0,0,50] segs:32
sph.material = PhysicalMaterial base_color:green

-- Create 2 Teapots
tp1 = teapot radius:50 pos:[80,-250,0]
tp1.material = PhysicalMaterial base_color:red

tp2 = teapot radius:50 pos:[-100,500,0]
tp2.material = PhysicalMaterial base_color:blue

-- Switch to High Quality Viewport
actionMan.executeAction -844228238 "12"  --  Viewport Lighting and Shadows: High Quality

-- Create a physical camera from the viewport
macros.run "Lights and Cameras" "PhysicalCamera_CreateFromView"

-- Retrieve the just created camera in the scene "cameras" array
physCam = cameras[1]

-- Place the physical camera target on the sphere
physCam.Target.pos = sph.pos

-- Set a small aperture
physCam.f_number = 0.058

-- Enable Depth of Field in the camera/viewport
physCam.use_dof = on

RESULT:

Properties:

Basic Rollout

<Physical>.targeted     BooleanClass    default: true   --  boolean

Gets/sets the state of the "Targeted" checkbox.

When set to True (default), the Camera will look at a dedicated Target object to control its orientation. Looking straight down can cause gimbal lock problems due to the up vector being in the XY plane.

When set to False, the Camera will be free and can be oriented freely without any gimbal lock problems using only its own Transformation controller.

<Physical>.target_distance     Float    default: 196.85   --  animatable; worldUnits

Gets the target distance defined by the distance from the Camera to its Target object when the .targeted value is set to True. Settings this value when in targeted mode will have no effect on the actual distance between the Camera and its Target object, but the value will be stored in the Camera. When the .targeted property is switched to False, the value will be updated to the latest distance between the Camera and its Target Object.

Gets/sets the target distance when the .targeted property is set to False.

<Physical>.show_camera_cone     Integer    default: 0   --  integer

Gets/sets the selection of the "Show Camera Cone" drop-down list.

Possible values are:

0 - When Selected (default)

1 - Always

2 - Never

<Physical>.horizon_on     BooleanClass    default: false   --  animatable; boolean; Show_Horizon_Line

Gets/sets the state of the "Show Horizon Line" checkbox.

When set to True, a line will be displayed at the horizon in the Viewport when looking through the Camera.

Physical Camera Rollout

Film/Sensor Group Of Controls

<Physical>.film_preset     String    default: "35mm"   --  string

Gets/sets the selection of the "Preset" drop-down list.

Setting this value will set the .film_width_mm and .fov properties to preset values.

Possible values are:

"35mm" - default - 35mm (Full Frame) - Width 36.0mm

"APS-C (Canon)" - APS-C (Canon) - Width 22.3mm

"APS-C (Nikon)" - APS-C (Nikon, Sony, and so on) - Width 23.7mm

"APS-H (Canon)" - APS-H (Canon) - Width 27.9mm

"Four Thirds" - Four Thirds - Width 17.3mm

"Custom" - Custom - Custom Width

<Physical>.film_width_mm     Float    default: 36.0   --  animatable; float

Gets/sets the value of the "Width" spinner, controlling the film width in millimeters.

Lens Group Of Control

<Physical>.focal_length_mm     Float    default: 40.0   --  animatable; worldUnits; Lens_Focal_Length_mm

Gets/sets the value of the "Focal Length" spinner, controlling the Camera's focal length in millimeters.

<Physical>.specify_fov     BooleanClass    default: false   --  boolean

Gets/sets the state of the "Specify FOV" checkbox.

When set to True, the .fov property will be used to enforce a field of view on the Camera.

When set to False (default). the field of view will be calculated automatically from the Film/Sensor Width, Focal Length, and Zoom values.

<Physical>.fov     Float    default: 48.112   --  animatable; float

Gets/sets the explicit Field Of View value to be used when the .specify_fov property is set to True.

<Physical>.zoom_factor     Float    default: 1.0   --  animatable; float

Gets/sets the value of the "Zoom" spinner.

Increasing this value above 1.0 has the effect of narrowing the Field Of View and zooming in.

Decreasing the value below 1.0 has the effect of widening the Field Of View and thus zooming out.

<Physical>.f_number     Float    default: 8.0   --  animatable; float

Gets/sets the value of the "Aperture" spinner.

It is expressed as f over the .f_number property.

Focus Group Of Controls

<Physical>.specify_focus     Integer    default: 0   --  animatable; integer; Specify_Focus_Distance

Gets/sets the state of the "Focus" radio buttons.

Possible values are:

0 - Use Target Distance - The distance between the Camera and its Target Object, resp. The explicit Target Distance value when in Free mode will be used to define where the subject is in focus.

1 - Custom - The explicit value provided by the .focus_distance property will be used to define the distance where the subject is in focus.

<Physical>.focus_distance     Float    default: 196.85   --  animatable; worldUnits

Gets/sets the value of the "Focus Distance" spinner.

This property is only used when the .specify_focus property is set to 1 (Custom).

<Physical>.lens_breathing_amount     Float    default: 1.0   --  animatable; float

Gets/sets the value of the "Lens Breathing" spinner.

<Physical>.use_dof     BooleanClass    default: false   --  boolean; Enable_DOF

Gets/sets the state of the "Enable Depth Of Field" checkbox.

Shutter Group Of Controls

<Physical>.shutter_unit_type     Integer    default: 3   --  integer

Gets/sets the selection of the "Type" drop-down list.

Possible values are:

0 - 1 / seconds

1 - seconds

2 - degrees

3 - frames (default)

Note that the 0 and 1 modes use a different set of properties to specify the Duration and Offset than the 2 and 3 modes, and their respective values will not synchronize when this property is changed. For example, if the mode is set to 1/Seconds and the Offset is changed to 0.005 (1/200.0 seconds) by setting the .shutter_offset_frames property, switching the UI to Degrees or Frames display will show the Offset to still be 0.0 unless changed explicitly using the .shutter_offset_seconds property.

<Physical>.shutter_length_frames     Float    default: 0.5   --  animatable; float

Gets/sets the value of the "Duration" spinner used when the .shutter_unit_type property is set to 2 (degrees) or 3 (frames).

Note that in the case of Degrees display, the UI will represent the duration in Degrees, while setting the property as frames internally.

For example, setting the property to 1.0 frames will result is a display of 360 degrees in the UI when the Type is set to degrees, and 1.0 when set to frames.

<Physical>.shutter_length_seconds     Float    default: 0.001   --  animatable; float

Gets/sets the value of the "Duration" spinner used when the .shutter_unit_type property is set to 0 (1/seconds) or 1 (seconds).

Note that the value will always be represented as 1/seconds internally, while the UI will change the spinner between 1/Seconds and Seconds according to the .shutter_unit_type property. For example, if the internal value is 0.001, the UI will display it as either 1000.0 or 0.001 depending on the drop-down list settings.

<Physical>.shutter_offset_enabled     BooleanClass    default: false   --  boolean

Gets/sets the state of the "Offset" checkbox.

When set to False (default), the Shutter Offset will be assumed as 0.0.

When set to True, the Shutter Offset value corresponding to the current Shutter Type (Seconds or Frames) will be used - see the next two properties for details.

<Physical>.shutter_offset_frames     Float    default: 0.0   --  animatable; float

Gets/sets the value of the "Offset" spinner used when the .shutter_unit_type property is set to 2 (degrees) or 3 (frames).

Note that in the case of Degrees display, the UI will represent the duration in Degrees, while setting the property as Frames internally.

For example, setting the property to 0.5 Frames will result in a display of 180 Degrees in the UI when the Type is set to Degrees, and 0.5 when set to Frames.

<Physical>.shutter_offset_seconds     Float    default: 0.0   --  animatable; float

Gets/sets the value of the "Offset" spinner used when the .shutter_unit_type property is set to 0 (1/seconds) or 1 (seconds).

<Physical>.motion_blur_enabled     BooleanClass    default: false   --  boolean

Gets/sets the state of the "Enable Motion Blur" checkbox.

Exposure Rollout

Exposure Gain Group Of Controls

<Physical>.exposure_gain_type     Integer    default: 1   --  integer

Gets/sets the state of the "Exposure Gain" radio buttons.

Possible values are:

0 - Manual -uses the .iso property.

1 - Target (default)- uses the .exposure_value property.

<Physical>.iso     Float    default: 6000.0   --  animatable; float

Gets/sets the value of the "Manual ... ISO" spinner used when the .exposure_gain_type property is set to 0 (Manual).

<Physical>.exposure_value     Float    default: 6.0   --  animatable; float

Gets/sets the value of the "Target ... EV" spinner used when the .exposure_gain_type property is set to 1 (Target).

White Balance Group Of Controls

<Physical>.white_balance_type     Integer    default: 0   --  integer

Gets/sets the state of the "White Balance" radio buttons.

Possible values are:

0 - Illuminant (default) - uses the .white_balance_illuminant property.

1 - Temperature - uses the .white_balance_kelvin property.

2 - Custom - uses the .white_balance_custom property.

<Physical>.white_balance_illuminant     Integer    default: 0   --  integer

Gets/sets the selection of the "Illuminant" drop-down list used when the .white_balance_type property is set to 0.

Possible values are:

0 - Daylight (6500K)

1 - Sunlight (5200K)

2 - Shade (7000K)

3 - Overcast (6000K)

4 - Incandescent (3200K)

5 - Fluorescent (4000K)

6 - CIE A - Incandescent / Tungsten

7 - CIE D50 - Horizon Light

8 - CIE D55 - Morning/Afternoon Daylight

9 - CIE D65 - Noon Daylight

10 - CIE D75 - Northern Daylight

11 - CIE F1 - Fluorescent Daylight

12 - CIE F2 - Fluorescent Cool White

13 - CIE F3 - Fluorescent White

14 - CIE F4 - Fluorescent Warm White

15 - CIE F5 - Fluorescent Daylight

16 - CIE F6 - Fluorescent Light White

17 - CIE F7 - Fluorescent D65 Simulator

18 - CIE F8 - Fluorescent D60 Simulator

19 - CIE F9 - Fluorescent Cool White Deluxe

20 - CIE F10 - Fluorescent TL-85

21 - CIE F11 - Fluorescent TL-84

22 - CIE F12 - Fluorescent TL-83

23 - Halogen Warn (2800K)

24 - Halogen (3200K)

25 - Halogen Cool (4000K)

26 - HID Ceramic Metal Halide Warm (3000K)

27 - HID Ceramic Metal Halide Cool (4200K)

28 - HID Quartz Metal Halide Warm (3200K)

29 - HID Quartz Metal Halide (4000K)

30 - HID Quartz Metal Halide Cool (6000K)

31 - HID Mercury (3900K)

32 - HID Phosphor Mercury (4000K)

33 - HID Xenon (6000K)

34 - High Pressure Sodium (2100K)

35 - Low Pressure Sodium (1800K)

<Physical>.white_balance_kelvin     Float    default: 6500.0   --  animatable; float; White_Balance_Temperature

Gets/sets the value of the "Temperature" spinner used when the .white_balance_type property is set to 1.

<Physical>.white_balance_custom     Color    default: (color 255 255 255 0)   --  animatable;
fRGBA color;
Controller Scaling: ([1,1,1,1] : (color 255 255 255));

Gets/sets the value of the "Custom" color picker used when the .white_balance_type property is set to 2.

<Physical>.vignetting_enabled     BooleanClass    default: false   --  boolean

Gets/sets the state of the "Enable Vignetting" checkbox.

When set to True, vignetting will be applied to the rendered image.

When set to False, no vignetting will be applied.

<Physical>.vignetting_amount     Float    default: 1.0   --  animatable; float

Gets/sets the value of the "Amount" spinner controlling the Vignetting Amount when .vignetting_enabled is set to True.

Bokeh (Depth Of Field) Rollout

Aperture Shape Group Of Controls

<Physical>.bokeh_shape     Integer    default: 0   --  animatable; integer

Gets/sets the state of the "Aperture Shape" radio buttons.

Possible values are:

0 - Circular (default)

1 - Bladed

2 - Custom Texture

<Physical>.bokeh_blades_number     Integer    default: 7   --  animatable; integer

Gets/sets the value of the "Blades" spinner used when .bokeh_shape is set to 1.

It controls the number of Bokeh effect blades.

<Physical>.pb_bokeh_blades_rotation_degrees     Float    default: 0.0   --  animatable; float; Bokeh_Blades_Rotation_Degrees

Gets/sets the value of the "Rotation" spinner used when .bokeh_shape is set to 1.

It defines the rotation in degrees of the Bokeh effect blades.

<Physical>.bokeh_texture     UndefinedClass    default: undefined   --  texturemap; Bokeh_Bitmap

Gets/sets the custom Bokeh textureMap used when .bokeh_shape is set to 2.

<Physical>.bokeh_texture_affect_exposure     BooleanClass    default: true   --  boolean; Bokeh_Bitmap_Affect_Exposure

Gets/sets the state of the "Affect Exposure" checkbox used when .bokeh_shape is set to 2.

When set to True (default), the Bokeh texture will also affect the Exposure.

<Physical>.bokeh_center_bias     Float    default: 0.0   --  animatable; float

Gets/sets the value of the "Center Bias (Ring Effect)" slider.

<Physical>.bokeh_optical_vignetting     Float    default: 0.0   --  animatable; float

Gets/sets the value of the "Optical Vignetting (Cat Eye)" slider.

<Physical>.bokeh_anisotropy     Float    default: 0.0   --  animatable; float

Gets/sets the value of the "Anisotropy (Anamorphic Lens)" slider.

Valid range is from -1.0 (vertical) to 1.0 (horizontal).

Perspective Control Rollout

Lens Shift Group Of Controls

<Physical>.horizontal_shift     Float    default: 0.0   --  animatable; float; Controller Scaling: (1 : 100.0); 

Gets/sets the value of the "Horizontal" spinner.

Negative values shift the image to the left.

Positive values shift the image to the right.

<Physical>.horizontal_shift     Float    default: 0.0   --  animatable; float; Vertical_Shift; Controller Scaling: (1 : 100.0

Gets/sets the value of the "Vertical" spinner.

Negative values shift the image down.

Positive values shift the image up.

Tilt Correction Group Of Controls

<Physical>.horizontal_tilt_correction     Float    default: 0.0   --  animatable; float

Gets/sets the value of the "Horizontal" spinner.

<Physical>.vertical_tilt_correction     Float    default: 0.0   --  animatable; float

Gets/sets the value of the "Vertical" spinner.

<Physical>.auto_vertical_tilt_correction     BooleanClass    default: false   --  animatable; boolean

Gets/sets the state of the "Auto Vertical Tilt Correction" checkbox.

Lens Distortion Rollout

<Physical>.distortion_type     Integer    default: 0   --  integer

Gets/sets the state of the "Distortion Type" radio buttons.

Possible values are:

0 - None (default)

1 - Cubic

2 - Texture

<Physical>.distortion_cubic_amount     Float    default: 0.0   --  animatable; float

Gets/sets the value of the "Amount" spinner used when the .distortion_type property is set to 1.

<Physical>.distortion_texture     UndefinedClass    default: undefined   --  texturemap

Gets/sets the texture map used when the .distortion_type property is set to 2.

Miscellaneous Rollout

Clipping Planes Group Of Controls

<Physical>.clip_on     BooleanClass    default: false   --  boolean; Clipping_Enabled

Gets/sets the state of the "Enable" checkbox.

When set to False (default), automatic clipping will be performed.

When set to True, the Near and Far clipping values will be used.

<Physical>.clip_near     Float    default: 0.0   --  animatable; worldUnits; Clipping_Near
<Physical>.near_clip     Float    default: 0.0   --  animatable; alias for clip_near
<Physical>.nearclip     Float    default: 0.0   --  animatable; alias for clip_near

Gets/sets the value of the "Near" spinner used when the .clip_on property is set to True.

It defines the distance from the Camera position to the Near Clipping Plane in world units. Any points closer to the Camera than this distance will not be rendered.

<Physical>.clip_far    Float    default: 39370.1   --  animatable; worldUnits; Clipping_Far
<Physical>.far_clip   Float    default: 39370.1   --  animatable; alias for clip_far
<Physical>.farclip     Float    default: 39370.1   --  animatable; alias for clip_far

Gets/sets the value of the "Far" spinner used when the .clip_on property is set to True.

It defines the distance from the Camera position to the Far Clipping Plane in world units.

Any points farther from the Camera than this distance will not be rendered.

Environment Range Group Of Controls

<Physical>.environment_far     Float    default: 39370.1   --  animatable; worldUnits; Environment_Range_Far
<Physical>.farrange     Float    default: 39370.1   --  animatable; alias for environment_far

Gets/sets the value of the "Near Range" spinner.

Used by Camera-based Atmospheric Effects like Fog to define the near range of the effect.

<Physical>.environment_near    Float    default: 0.0   --  animatable; worldUnits; Environment_Range_Near
<Physical>.nearrange    Float    default: 0.0   --  animatable; alias for environment_near

Gets/sets the value of the "Far Range" spinner.

Used by Camera-based Atmospheric Effects like Fog to define the far range of the effect.

Not Exposed In The User Interface

<Physical>.show_focus_plane_in_cam_view     BooleanClass    default: false   --  animatable; boolean; Show_Focus_Plane_in_Camera_View

When set to False, the semi-transparent Focus Plane will not be drawn when the viewport is set to the Physical Camera.

When set to True, the semi-transparent Focus Plane will be visible in the Physical Camera viewport.