s&box docs

public sealed class Sandbox.CameraComponent : Sandbox.Component

Every scene should have at least one Camera.

Broader workflow and conceptual references connected to this API.

Constructors

Showing 1 constructors

Methods

Showing 25 methods

public void AddCommandList(Sandbox.Rendering.CommandList buffer, Sandbox.Rendering.Stage stage, int order = 0)

Add a command list to the render

Parameters

  • order: Default: 0

public System.IDisposable AddHookAfterOpaque(string debugName, int order, System.Action`1<Sandbox.SceneCamera> renderEffect)Obsolete

Obsolete: Use CommandList

public System.IDisposable AddHookAfterTransparent(string debugName, int order, System.Action`1<Sandbox.SceneCamera> renderEffect)Obsolete

Obsolete: Use CommandList

public System.IDisposable AddHookAfterUI(string debugName, int order, System.Action`1<Sandbox.SceneCamera> renderEffect)Obsolete

Obsolete: Use CommandList

public System.IDisposable AddHookBeforeOverlay(string debugName, int order, System.Action`1<Sandbox.SceneCamera> renderEffect)Obsolete

Obsolete: Use CommandList

public Sandbox.Rect BBoxToScreenPixels(BBox bounds, bool isBehind)

Given a BBox in world space, will return the screen space rect that totally contains the box.

public Matrix CalculateObliqueMatrix(Sandbox.Plane clipPlane)

Calculates a projection matrix with an oblique clip-plane defined in world space.

public void RenderToBitmap(Sandbox.Bitmap targetBitmap)

Render this camera to the target bitmap.

public bool RenderToTexture(Sandbox.Texture target, Sandbox.Rendering.ViewSetup config = null)

Render scene to a texture from this camera's point of view

Parameters

  • config: Default: null

public virtual void Reset()

public Ray ScreenNormalToRay(Vector3 normalPosition)

public Ray ScreenPixelToRay(Vector2 pixelPosition)

public Vector3 ScreenToWorld(Vector2 screen)

Convert from screen coords to world coords on the near frustum plane.

public void UpdateSceneCamera(Sandbox.SceneCamera camera, bool includeTags = True)

Update a SceneCamera with the settings from this component

Parameters

  • includeTags: Default: True

Properties

Showing 26 properties

public Sandbox.CameraComponent.AutoExposureSetup Sandbox.CameraComponent.AutoExposure { get; set; }

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.

public Color Sandbox.CameraComponent.BackgroundColor { get; set; }

The background color of this camera's view if there's no 2D Sky in the scene.

public System.Nullable`1<Matrix> Sandbox.CameraComponent.CustomProjectionMatrix { get; set; }

Allows specifying a custom projection matrix for this camera

public System.Nullable`1<Vector2> Sandbox.CameraComponent.CustomSize { get; set; }

Allows specifying a custom aspect ratio for this camera. By default (or when null) the camera size is screen size or render target size.

public bool Sandbox.CameraComponent.EnablePostProcessing { get; set; }

Enable or disable post processing for this camera.

public float Sandbox.CameraComponent.FieldOfView { get; set; }

The field of view of this camera.

public Sandbox.Rendering.HudPainter Sandbox.CameraComponent.Hud { get; set; }

Allows drawing on the camera. This is drawn before the post processing.

public bool Sandbox.CameraComponent.IsMainCamera { get; set; }

Returns true if this is the main game camera.

public bool Sandbox.CameraComponent.Orthographic { get; set; }

Whether or not to use orthographic projection instead of perspective.

public float Sandbox.CameraComponent.OrthographicHeight { get; set; }

The orthographic size for this camera while `Sandbox.CameraComponent.Orthographic` is set to true.

public Sandbox.Rendering.HudPainter Sandbox.CameraComponent.Overlay { get; set; }

Used to draw to the screen. This is drawn on top of everything, so is good for debug overlays etc.

public Sandbox.GameObject Sandbox.CameraComponent.PostProcessAnchor { get; set; }

If set then we'll trigger post process volumes from this position, instead of the camera's position.

public int Sandbox.CameraComponent.Priority { get; set; }

The priority of this camera. Dictates which camera gets rendered on top of another. Higher means it'll be rendered on top.

public Sandbox.TagSet Sandbox.CameraComponent.RenderExcludeTags { get; set; }

A list of tags that will be checked to exclude specific game objects when rendering this camera.

public Sandbox.TagSet Sandbox.CameraComponent.RenderTags { get; set; }

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.

public Sandbox.Rect Sandbox.CameraComponent.ScreenRect { get; set; }

The size of the viewport, in screen coordinates

public Sandbox.StereoTargetEye Sandbox.CameraComponent.TargetEye { get; set; }

The HMD eye that this camera is targeting. Use `Sandbox.StereoTargetEye.None` for the user's monitor (i.e. the companion window).

public Vector4 Sandbox.CameraComponent.Viewport { get; set; }

The size of the camera represented on the screen. Normalized between 0 and 1.

public bool Sandbox.CameraComponent.WireframeMode { get; set; }

Render this camera using a wireframe view.

public float Sandbox.CameraComponent.ZFar { get; set; }

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.

public float Sandbox.CameraComponent.ZNear { get; set; }

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.

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.CameraComponent

On this page

Constructorspublic CameraComponent()Methodspublic System.Void AddCommandList(Sandbox.Rendering.CommandList buffer, Sandbox.Rendering.Stage stage, System.Int32 order = 0)public System.IDisposable AddHookAfterOpaque(System.String debugName, System.Int32 order, System.Action`1<Sandbox.SceneCamera> renderEffect)public System.IDisposable AddHookAfterTransparent(System.String debugName, System.Int32 order, System.Action`1<Sandbox.SceneCamera> renderEffect)public System.IDisposable AddHookAfterUI(System.String debugName, System.Int32 order, System.Action`1<Sandbox.SceneCamera> renderEffect)public System.IDisposable AddHookBeforeOverlay(System.String debugName, System.Int32 order, System.Action`1<Sandbox.SceneCamera> renderEffect)public Sandbox.Rect BBoxToScreenPixels(BBox bounds, System.Boolean isBehind)public Matrix CalculateObliqueMatrix(Sandbox.Plane clipPlane)public System.Void ClearCommandLists()public System.Void ClearCommandLists(Sandbox.Rendering.Stage stage)public Sandbox.Frustum GetFrustum()public Sandbox.Frustum GetFrustum(Sandbox.Rect screenRect, Vector3 screenSize)public Sandbox.Frustum GetFrustum(Sandbox.Rect screenRect)public Vector2 PointToScreenNormal(Vector3 worldPosition, System.Boolean isBehind)public Vector2 PointToScreenNormal(Vector3 worldPosition)public Vector2 PointToScreenPixels(Vector3 worldPosition, System.Boolean isBehind)public Vector2 PointToScreenPixels(Vector3 worldPosition)public System.Void RemoveCommandList(Sandbox.Rendering.CommandList buffer, Sandbox.Rendering.Stage stage)public System.Void RemoveCommandList(Sandbox.Rendering.CommandList buffer)public System.Void RenderToBitmap(Sandbox.Bitmap targetBitmap)public System.Boolean RenderToTexture(Sandbox.Texture target, Sandbox.Rendering.ViewSetup config = null)public virtual System.Void Reset()public Ray ScreenNormalToRay(Vector3 normalPosition)public Ray ScreenPixelToRay(Vector2 pixelPosition)public Vector3 ScreenToWorld(Vector2 screen)public System.Void UpdateSceneCamera(Sandbox.SceneCamera camera, System.Boolean includeTags = True)Propertiespublic Sandbox.CameraComponent.AutoExposureSetup Sandbox.CameraComponent.AutoExposure { get; set; }public Color Sandbox.CameraComponent.BackgroundColor { get; set; }public Sandbox.ClearFlags Sandbox.CameraComponent.ClearFlags { get; set; }public System.Nullable`1<Matrix> Sandbox.CameraComponent.CustomProjectionMatrix { get; set; }public System.Nullable`1<Vector2> Sandbox.CameraComponent.CustomSize { get; set; }public Sandbox.SceneCameraDebugMode Sandbox.CameraComponent.DebugMode { get; set; }public System.Boolean Sandbox.CameraComponent.EnablePostProcessing { get; set; }public System.Single Sandbox.CameraComponent.FieldOfView { get; set; }public Sandbox.CameraComponent.Axis Sandbox.CameraComponent.FovAxis { get; set; }public Sandbox.Rendering.HudPainter Sandbox.CameraComponent.Hud { get; set; }public System.Boolean Sandbox.CameraComponent.IsMainCamera { get; set; }public System.Boolean Sandbox.CameraComponent.Orthographic { get; set; }public System.Single Sandbox.CameraComponent.OrthographicHeight { get; set; }public Sandbox.Rendering.HudPainter Sandbox.CameraComponent.Overlay { get; set; }public Sandbox.GameObject Sandbox.CameraComponent.PostProcessAnchor { get; set; }public System.Int32 Sandbox.CameraComponent.Priority { get; set; }public Matrix Sandbox.CameraComponent.ProjectionMatrix { get; set; }public Sandbox.TagSet Sandbox.CameraComponent.RenderExcludeTags { get; set; }public Sandbox.TagSet Sandbox.CameraComponent.RenderTags { get; set; }public Sandbox.Texture Sandbox.CameraComponent.RenderTarget { get; set; }public Sandbox.Rect Sandbox.CameraComponent.ScreenRect { get; set; }public Sandbox.StereoTargetEye Sandbox.CameraComponent.TargetEye { get; set; }public Vector4 Sandbox.CameraComponent.Viewport { get; set; }public System.Boolean Sandbox.CameraComponent.WireframeMode { get; set; }public System.Single Sandbox.CameraComponent.ZFar { get; set; }public System.Single Sandbox.CameraComponent.ZNear { get; set; }Metadata