Class

SCNCamera

A set of camera attributes that can be attached to a node to provide a point of view for displaying the scene.

Declaration

@interface SCNCamera : NSObject

Overview

To display a scene, you must designate a node whose camera property contains a camera object as the point of view.

The SCNNode object containing a camera defines a point of view—that is, the position and orientation of the camera. A camera’s direction of view is always along the negative z-axis of the node’s local coordinate system. To point the camera at different parts of your scene, use the position, rotation, or transform property of the node containing it. (Alternatively, to ensure that a camera always points at a particular element of your scene even when that element moves, attach a SCNLookAtConstraint object to the node containing the camera.)

An SCNCamera object itself defines the shape and, in part, the appearance of the rendered scene as seen from its point of view. By default, a camera defines a perspective projection, whose field of view (FOV) and near and far visibility limits you control using the properties listed in Adjusting Camera Perspective and illustrated below.

Figure 1

Camera coordinate system and projection parameters

Topics

Creating a Camera

+ camera

Creates a new camera object.

+ cameraWithMDLCamera:

Creates a camera from the specified Model I/O camera object.

Managing Camera Attributes

name

A name associated with the camera object.

Adjusting Camera Perspective

zNear

The camera's near depth limit. Animatable.

zFar

The camera’s far depth limit. Animatable.

automaticallyAdjustsZRange

A Boolean value that determines whether the camera automatically adjusts its zNear and zFar depth limits.

Managing Field of View

fieldOfView

The vertical or horizontal viewing angle of the camera.

focalLength

The camera's focal length, in millimeters.

sensorHeight

The vertical size of the camera's imaging plane, in millimeters.

projectionDirection

The axis used to determine field of view or orthographic scale.

SCNCameraProjectionDirection

Options for the axis used to determine field of view or orthographic projection.

Managing the Projection Transform

projectionTransform

The camera’s projection transformation.

usesOrthographicProjection

A Boolean value that determines whether the camera uses an orthographic projection.

orthographicScale

Specifies the camera’s magnification factor when using an orthographic projection.

Choosing Nodes to Be Visible to the Camera

categoryBitMask

A mask that defines which categories this camera belongs to.

Adding Depth-of-Field Effects

wantsDepthOfField

A Boolean value that determines whether SceneKit renders depth-of-field blur effects for the camera.

focusDistance

The distance from the camera at which objects appear in sharp focus. Animatable.

fStop

The physical camera aperture simulated by SceneKit for depth-of-field effects. Animatable.

apertureBladeCount

The number of physical camera aperture blades simulated by SceneKit for depth-of-field effects.

focalBlurSampleCount

The number of pixel samples SceneKit uses to create depth-of-field blur effects.

Adding Motion Blur Effects

motionBlurIntensity

A factor that determines the intensity of motion blur effects. Animatable.

Adding High Dynamic Range Effects

wantsHDR

A Boolean value that determines whether SceneKit applies High Dynamic Range (HDR) postprocessing effects to a scene.

exposureOffset

A logarithmic bias that adjusts the results of SceneKit’s tone mapping operation, brightening or darkening the visible scene.

averageGray

The luminance level to use as the midpoint of a tone mapping curve.

whitePoint

The luminance level to use as the upper end of a tone mapping curve.

minimumExposure

The minimum exposure value to use in tone mapping.

maximumExposure

The minimum exposure value to use in tone mapping.

Adding Automatic HDR Exposure Adaptation

wantsExposureAdaptation

A Boolean value that determines whether SceneKit automatically adjusts the exposure level.

exposureAdaptationBrighteningSpeedFactor

The relative duration of automatically animated exposure transitions from dark to bright areas.

exposureAdaptationDarkeningSpeedFactor

The relative duration of automatically animated exposure transitions from bright to dark areas.

Adjusting Rendered Colors

contrast

An adjustment factor to apply to the overall visual contrast of the rendered scene.

saturation

An adjustment factor to apply to the overall color saturation of the rendered scene.

colorGrading

A texture for applying color grading effects to the entire rendered scene.

Adding Stylistic Visual Effects

bloomIntensity

The magnitude of bloom effect to apply to highlights in the rendered scene. Animatable.

bloomThreshold

The brightness threshold at which to apply a bloom effect to highlights in the rendered scene. Animatable.

bloomBlurRadius

The radius, in pixels, for the blurring portion of the bloom effect applied to highlights in the rendered scene. Animatable.

colorFringeIntensity

The blend factor for fading the color fringing effect applied to the rendered scene.

colorFringeStrength

The magnitude of color fringing effect to apply to the rendered scene.

vignettingIntensity

The magnitude of vignette (darkening around edges) effect to apply to the rendered scene.

vignettingPower

The amount of the rendered scene to darken with a vignette effect.

Adding Screen-Space Ambient Occlusion

screenSpaceAmbientOcclusionIntensity

The intensity of the screen-space ambient occlusion effect applied in camera rendering.

screenSpaceAmbientOcclusionRadius

The distance, in units of scene space, at which ambient occlusion takes effect.

screenSpaceAmbientOcclusionBias

An offset for modulating ambient occlusion effects.

screenSpaceAmbientOcclusionDepthThreshold

The maximum depth difference, in units of scene space, at which to apply ambient occlusion effects.

screenSpaceAmbientOcclusionNormalThreshold

The magnitude of the blur effect applied to create ambient occlusion shadows.

Deprecated

yFov

The camera’s field of view, in degrees, on the vertical axis. Animatable.

Deprecated
xFov

The camera's field of view, in degrees, on the horizontal axis. Animatable.

Deprecated
focalDistance

The distance from the camera at which objects appear in sharp focus. Animatable.

Deprecated
focalSize

The width of the distance range at which objects appear in sharp focus. Animatable.

Deprecated
focalBlurRadius

The maximum amount of blurring, in pixels, applied to areas outside the camera’s depth of field. Animatable.

Deprecated
aperture

A factor that determines the transition between in-focus and out-of-focus areas. Animatable.

Deprecated

Instance Methods

- projectionTransform

The camera’s projection transformation.

- setProjectionTransform:

The camera’s projection transformation.

See Also

Lighting, Cameras, and Shading

SCNLight

A light source that can be attached to a node to illuminate the scene.

SCNMaterial

A set of shading attributes that define the appearance of a geometry's surface when rendered.

SCNMaterialProperty

A container for the color or texture of one of a material’s visual properties.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software