# Sandbox.CameraComponent

Every scene should have at least one Camera.

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.Engine`
- Inherits: [Sandbox.Component](/api/Sandbox.Component)
- Modifiers: sealed

## Constructors

- [`CameraComponent`](/api/Sandbox.CameraComponent/.ctor)

## Fields

- [`RenderTexture`](/api/Sandbox.CameraComponent/RenderTexture): If specified, this camera will render to this RenderTexture instead of the screen. This can then be used in other stuff like materials.

## Properties

- [`AutoExposure`](/api/Sandbox.CameraComponent/AutoExposure): Enables and configures auto exposure on the camera. This is usually controlled by the Tonemapping component. But if you're not using that, it can be controlled manually here.
- [`BackgroundColor`](/api/Sandbox.CameraComponent/BackgroundColor): The background color of this camera's view if there's no 2D Sky in the scene.
- [`ClearFlags`](/api/Sandbox.CameraComponent/ClearFlags): The clear flags for this camera.
- [`CustomProjectionMatrix`](/api/Sandbox.CameraComponent/CustomProjectionMatrix): Allows specifying a custom projection matrix for this camera
- [`CustomSize`](/api/Sandbox.CameraComponent/CustomSize): Allows specifying a custom aspect ratio for this camera. By default (or when null) the camera size is screen size or render target size.
- [`DebugMode`](/api/Sandbox.CameraComponent/DebugMode): Render this camera using a different render mode
- [`EnablePostProcessing`](/api/Sandbox.CameraComponent/EnablePostProcessing): Enable or disable post processing for this camera.
- [`FieldOfView`](/api/Sandbox.CameraComponent/FieldOfView): The field of view of this camera.
- [`FovAxis`](/api/Sandbox.CameraComponent/FovAxis): The axis to use for the field of view.
- [`Hud`](/api/Sandbox.CameraComponent/Hud): Allows drawing on the camera. This is drawn before the post processing.
- [`IsMainCamera`](/api/Sandbox.CameraComponent/IsMainCamera): Returns true if this is the main game camera.
- [`Orthographic`](/api/Sandbox.CameraComponent/Orthographic): Whether or not to use orthographic projection instead of perspective.
- [`OrthographicHeight`](/api/Sandbox.CameraComponent/OrthographicHeight): The orthographic size for this camera while [Sandbox.CameraComponent.Orthographic](/api/Sandbox.CameraComponent/Orthographic) is set to true.
- [`Overlay`](/api/Sandbox.CameraComponent/Overlay): Used to draw to the screen. This is drawn on top of everything, so is good for debug overlays etc.
- [`PostProcessAnchor`](/api/Sandbox.CameraComponent/PostProcessAnchor): If set then we'll trigger post process volumes from this position, instead of the camera's position.
- [`Priority`](/api/Sandbox.CameraComponent/Priority): The priority of this camera. Dictates which camera gets rendered on top of another. Higher means it'll be rendered on top.
- [`ProjectionMatrix`](/api/Sandbox.CameraComponent/ProjectionMatrix): Get frustum projection matrix.
- [`RenderExcludeTags`](/api/Sandbox.CameraComponent/RenderExcludeTags): A list of tags that will be checked to exclude specific game objects when rendering this camera.
- [`RenderTags`](/api/Sandbox.CameraComponent/RenderTags): A list of tags that will be checked to include specific game objects when rendering this camera. If none are set, it will include everything.
- [`RenderTarget`](/api/Sandbox.CameraComponent/RenderTarget): The texture to draw this camera to. Requires [Sandbox.Texture.CreateRenderTarget](/api/Sandbox.Texture/CreateRenderTarget)
- [`ScreenRect`](/api/Sandbox.CameraComponent/ScreenRect): The size of the viewport, in screen coordinates
- [`TargetEye`](/api/Sandbox.CameraComponent/TargetEye): The HMD eye that this camera is targeting. Use [Sandbox.StereoTargetEye.None](/api/Sandbox.StereoTargetEye/None) for the user's monitor (i.e. the companion window).
- [`View`](/api/Sandbox.CameraComponent/View): The view this camera composed this frame - the base transform reshaped by every [Sandbox.ICameraModifier](/api/Sandbox.ICameraModifier), before transient render effects. Query [Sandbox.CameraView.FieldOfView](/api/Sandbox.CameraView/FieldOfView) from here for zoom-aware logic like scaling look sensitivity while scoped. Final from the camera stage of the tick (after Update, before PreRender) - reading it during Update gives the previous frame's composition.
- [`Viewport`](/api/Sandbox.CameraComponent/Viewport): The size of the camera represented on the screen. Normalized between 0 and 1.
- [`WireframeMode`](/api/Sandbox.CameraComponent/WireframeMode): Render this camera using a wireframe view.
- [`ZFar`](/api/Sandbox.CameraComponent/ZFar): The camera's far clip plane distance. This is the furthest distance this camera will be able to render. This value totally depends on the game you're making. Shorter the better, sensible ranges would be between about 1000 and 30000, but if you want it to be further out you can balance that out by making ZNear larger.
- [`ZNear`](/api/Sandbox.CameraComponent/ZNear): The camera's near clip plane distance. This is the closest distance this camera will be able to render. A good value for this is about 5. Below 5 and particularly below 1 you're going to start to see a lot of artifacts like z-fighting.

## Methods

- [`AddCommandList`](/api/Sandbox.CameraComponent/AddCommandList): Add a command list to the render
- [`AddEffect`](/api/Sandbox.CameraComponent/AddEffect): Add a custom camera effect (a [Sandbox.CameraEffectSystem.BaseEffect](/api/Sandbox.CameraEffectSystem.BaseEffect) subclass), targeted at this camera.
- [`AddHookAfterOpaque`](/api/Sandbox.CameraComponent/AddHookAfterOpaque)
- [`AddHookAfterTransparent`](/api/Sandbox.CameraComponent/AddHookAfterTransparent)
- [`AddHookAfterUI`](/api/Sandbox.CameraComponent/AddHookAfterUI)
- [`AddHookBeforeOverlay`](/api/Sandbox.CameraComponent/AddHookBeforeOverlay)
- [`AddPunch`](/api/Sandbox.CameraComponent/AddPunch): Punch this camera along a camera-local direction, oscillating and dying out - [Vector3.Up](/api/Vector3/Up) bounces the view upward, `frequency` is how many oscillations before it lapses.
- [`AddShake`](/api/Sandbox.CameraComponent/AddShake): Shake this camera - the classic screen shake (Half-Life's env_shake). Every 1/`frequency` seconds a new random offset within `amplitude` world units, settling to nothing over `duration`. A duration of zero shakes until [Sandbox.CameraEffectSystem.BaseEffect.Stop](/api/Sandbox.CameraEffectSystem.BaseEffect/Stop).
- [`AddTilt`](/api/Sandbox.CameraComponent/AddTilt): Tilt this camera by `angle`, eased in over `easeTime` and back out before `duration` ends.
- [`BBoxToScreenPixels`](/api/Sandbox.CameraComponent/BBoxToScreenPixels): Given a BBox in world space, will return the screen space rect that totally contains the box.
- [`CalculateObliqueMatrix`](/api/Sandbox.CameraComponent/CalculateObliqueMatrix): Calculates a projection matrix with an oblique clip-plane defined in world space.
- [`ClearCommandLists`](/api/Sandbox.CameraComponent/ClearCommandLists): Remove all entries in this stage
- [`ComposeView`](/api/Sandbox.CameraComponent/ComposeView): Compose this camera's view - the base transform reshaped by every [Sandbox.ICameraModifier](/api/Sandbox.ICameraModifier) (published on [Sandbox.CameraComponent.View](/api/Sandbox.CameraComponent/View)), then transient effects baked on top for the render. The scene composes every camera once per tick, after Update and bone merging and before PreRender, so anything in PreRender positions against a settled camera. Call it yourself only when you're rendering without ticking the scene and want the composition - otherwise a camera moved after composing just renders from its raw transform.
- [`GetFrustum`](/api/Sandbox.CameraComponent/GetFrustum): Returns the view frustum of the current screen rect.
- [`PointToScreenNormal`](/api/Sandbox.CameraComponent/PointToScreenNormal)
- [`PointToScreenPixels`](/api/Sandbox.CameraComponent/PointToScreenPixels)
- [`RemoveCommandList`](/api/Sandbox.CameraComponent/RemoveCommandList): Remove an entry
- [`RenderToBitmap`](/api/Sandbox.CameraComponent/RenderToBitmap): Render this camera to the target bitmap.
- [`RenderToPixmap`](/api/Sandbox.SandboxToolExtensions/RenderToPixmap): Render this camera to the target widget. Once you do this the target widget becomes "externally painted", so you won't be able to paint on it anymore with Qt's Paint stuff.
- [`RenderToTexture`](/api/Sandbox.CameraComponent/RenderToTexture): Render scene to a texture from this camera's point of view
- [`Reset`](/api/Sandbox.CameraComponent/Reset)
- [`ScreenNormalToRay`](/api/Sandbox.CameraComponent/ScreenNormalToRay)
- [`ScreenPixelToRay`](/api/Sandbox.CameraComponent/ScreenPixelToRay)
- [`ScreenToWorld`](/api/Sandbox.CameraComponent/ScreenToWorld): Convert from screen coords to world coords on the near frustum plane.
- [`UpdateSceneCamera`](/api/Sandbox.CameraComponent/UpdateSceneCamera): Update a SceneCamera with the settings from this component
