Capítulo 18 de 859

Chapter 18: OrthographicCamera

Core Idea

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.

Key Concepts

  • bottom : number: The bottom plane of the camera's frustum.
  • far : number: The camera's far plane. Must be greater than the current value of OrthographicCamera#near.
  • isOrthographicCamera : boolean (readonly): This flag can be used for type testing.
  • left : number: The left plane of the camera's frustum.
  • near : number: The camera's near plane. The valid range is greater than 0 and less than the current value of [OrthographicCamera#far](OrthographicCamera…
  • right : number: The right plane of the camera's frustum.
  • top : number: The top plane of the camera's frustum.
  • view : Object: Represents the frustum window specification. This property should not be edited directly but via [PerspectiveCamera#setViewOffset](Perspect…
  • zoom : number: The zoom factor of the camera.

Code Examples

const camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
scene.add( camera );
  • What it demonstrates: Typical usage of OrthographicCamera.

Reference Tables

Constructor

Signature
new OrthographicCamera( left : number, right : number, top : number, bottom : number, near : number, far : number )

Properties

PropertyDescription
.bottom : numberThe bottom plane of the camera's frustum.
.far : numberThe camera's far plane. Must be greater than the current value of OrthographicCamera#near.
.isOrthographicCamera : boolean (readonly)This flag can be used for type testing.
.left : numberThe left plane of the camera's frustum.
.near : numberThe camera's near plane. The valid range is greater than 0 and less than the current value of OrthographicCamera#far.
.right : numberThe right plane of the camera's frustum.
.top : numberThe top plane of the camera's frustum.
.view : ObjectRepresents the frustum window specification. This property should not be edited directly but via PerspectiveCamera#setViewOffset and [PerspectiveCamera#clearVi…
.zoom : numberThe zoom factor of the camera.

Methods

MethodDescription
.clearViewOffset()Removes the view offset from the projection matrix.
.setViewOffset( fullWidth : number, fullHeight : number, x : number, y : number, width : number, height : number )Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.
.updateProjectionMatrix()Updates the camera's projection matrix. Must be called after any change of camera properties.

Key Takeaways

  1. OrthographicCamera extends: EventDispatcher → Object3D → Camera
  2. Most relevant properties: bottom, far, isOrthographicCamera, left.
  3. Key methods: clearViewOffset, setViewOffset, updateProjectionMatrix.

Connects To