OrthographicCamera - Verge3D User Manual - Soft8Soft
Description: Learn how to use OrthographicCamera in your interactive 3D apps made with Verge3D

Object3D → Camera →

# OrthographicCamera

Camera that uses orthographic projection.

In this projection mode, an object's size in the rendered image stays constant regardless of its distance from the camera.

This can be useful for rendering 2D scenes and UI elements, amongst other things.

## Code Example

`const aspect = app.getWidth() / app.getHeight(); const height = 3; const width = height * aspect; const camera = new v3d.OrthographicCamera(-width / 2, width / 2, height / 2, -height / 2, 1, 1000); camera.position.z = 10; app.scene.add(camera); app.setCamera(camera);`

## Constructor

### OrthographicCamera(left : Float, right : Float, top : Float, bottom : Float, near : Float, far : Float)

- left — camera frustum left plane.
- right — camera frustum right plane.
- top — camera frustum top plane.
- bottom — camera frustum bottom plane.
- near — camera frustum near plane.
- far — camera frustum far plane.

Together these define the camera's viewing frustum.

## Properties

See the base Camera class for common properties. Note that after making changes to most of these properties you will have to call .updateProjectionMatrix for the changes to take effect.

### # .bottom : Float

Camera frustum bottom plane.

### # .far : Float

Camera frustum far plane. Default is `2000`.

Must be greater than the current value of near plane.

### # .isOrthographicCamera : Boolean

Read-only flag to check if a given object is of type OrthographicCamera.

### # .left : Float

Camera frustum left plane.

### # .near : Float

Camera frustum near plane. Default is `0.1`.

The valid range is between `0` and the current value of the far plane. Note that, unlike for the PerspectiveCamera, `0` is a valid value for an OrthographicCamera's near plane.

### # .right : Float

Camera frustum right plane.

### # .top : Float

Camera frustum top plane.

### # .view : Object

Set by setViewOffset. Default is `null`.

### # .zoom : Float

Gets or sets the zoom factor of the camera. Default is `1`.

## Methods

See the base Camera class for common methods.

### # .setViewOffset(fullWidth : Float, fullHeight : Float, x : Float, y : Float, width : Float, height : Float)

- 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 viewing frustum. This is useful for multi-window or multi-monitor/multi-machine setups. For an example on how to use it see PerspectiveCamera.

### # .clearViewOffset()

Removes any offset set by the .setViewOffset method.

### # .updateProjectionMatrix()

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

## Puzzles

There are numerous camera puzzles to manage your camera with no coding.

## Source

For more info on how to obtain the source code of this module see this page.