Object3DCamera

PerspectiveCamera

Camera with perspective projection.

Example

geometry / birds
geometry / cube
animation / skinning / blending
animation / skinning / blending
effects / stereo
interactive / cubes
loader / collada / skinning
var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 ); scene.add( camera );

Constructor

PerspectiveCamera( fov, aspect, near, far )

fov — Camera frustum vertical field of view.
aspect — Camera frustum aspect ratio.
near — Camera frustum near plane.
far — Camera frustum far plane.

Properties

.fov

Camera frustum vertical field of view, from bottom to top of view, in degrees.

.zoom

Gets or sets the zoom factor of the camera.

.near

Camera frustum near plane.

.far

Camera frustum far plane.

.focus

Object distance used for stereoscopy and depth-of-field effects. This parameter does not influence the projection matrix unless a StereoCamera is being used.

.aspect

Camera frustum aspect ratio, window width divided by window height.

.view

Frustum window specification or null.

.filmGauge

Film size used for the larger axis. Default is 35 (millimeters). This parameter does not influence the projection matrix unless .filmOffset is set to a nonzero value.

.filmOffset

Horizontal off-center offset in the same unit as .filmGauge.

Methods

.getEffectiveFOV ()

Returns the current vertical field of view angle in degrees considering .zoom.

.getFocalLength ()

Returns the focal length of the current .fov in respect to .filmGauge.

.getFilmWidth ()

Returns the width of the image on the film. If .aspect is greater than or equal to one (landscape format), the result equals .filmGauge.

.getFilmHeight ()

Returns the height of the image on the film. If .aspect is less than or equal to one (portrait format), the result equals .filmGauge.

.setFocalLength ( focalLength )

Sets the FOV by focal length in respect to the current .filmGauge.
By default, the focal length is specified for a 35mm (full frame) camera.

.setLens ( focalLength, filmGauge )

focalLength — focal length
frameGauge — film gauge
Sets .fov by focal length. Optionally also sets .filmGauge. This method is deprecated, please use .setFocalLength instead.

.setViewOffset ( fullWidth, fullHeight, x, y, width, height )

fullWidth — full width of multiview setup
fullHeight — full height of multiview setup
x — horizontal offset of subcamera
y — vertical offset of subcamera
width — width of subcamera
height — height of subcamera
Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.
For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this:
+---+---+---+
| A | B | C |
+---+---+---+
| D | E | F |
+---+---+---+
then for each monitor you would call it like this:
var w = 1920; var h = 1080; var fullWidth = w * 3; var fullHeight = h * 2; // A camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); // B camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); // C camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); // D camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); // E camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); // F camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); Note there is no reason monitors have to be the same size or in a grid.

.clearViewOffset ()

Removes any offset set by the .setViewOffset method.

.updateProjectionMatrix ()

Updates the camera projection matrix. Must be called after change of parameters.

.clone ()


It returns a clone of PerspectiveCamera.

.toJSON ()

Return camera data in JSON format.

Source

src/cameras/PerspectiveCamera.js
Edit