reckfellENGINE

Camera3D

Camera node, displays from a point of view.

On this page
class Camera3DReckfellSharpInherits Entity3D

Camera node, displays from a point of view.

Camera3D is a special node that displays what is visible from its current location. Cameras register themselves in the nearest Viewport node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a Viewport, and, without one, a scene registered in that Viewport (or higher viewports) can't be displayed.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

Camera3DConstructor
# Camera3D
C#
public Camera3D();

Properties15

AttributesProperty
# Attributes
C#
public CameraAttributes Attributes { get; set; }

The CameraAttributes to use for this camera.

CompositorProperty
# Compositor
C#
public Compositor Compositor { get; set; }

The Compositor to use for this camera.

CullMaskProperty
# CullMask
C#
public uint CullMask { get; set; }

The culling mask that describes which VisualInstance3D.Layers are rendered by this camera. By default, all 20 user-visible layers are rendered. Note: Since the Camera3D.CullMask allows for 32 layers to be stored in total, there are an additional 12 layers that are only used internally by the engine and aren't exposed in the editor. Setting Camera3D.CullMask using a script allows you to toggle those reserved layers, which can be useful for editor plugins. To adjust Camera3D.CullMask more easily using a script, use Camera3D.GetCullMaskValue and Camera3D.SetCullMaskValue. Note: VoxelGI, SDFGI and LightmapGI will always take all layers into account to determine what contributes to global illumination. If this is an issue, set GeometryInstance3D.GIMode to GeometryInstance3D.GIModeEnum.Disabled for meshes and Light3D.LightBakeMode to Light3D.BakeMode.Disabled for lights to exclude them from global illumination.

CurrentProperty
# Current
C#
public bool Current { get; set; }

If true, the ancestor Viewport is currently using this camera. If multiple cameras are in the scene, one will always be made current. For example, if two Camera3D nodes are present in the scene and only one is current, setting one camera's Camera3D.Current to false will cause the other camera to be made current.

DopplerTrackingProperty
# DopplerTracking
C#
public Camera3D.DopplerTrackingEnum DopplerTracking { get; set; }

If not Camera3D.DopplerTrackingEnum.Disabled, this camera will simulate the Doppler effect for objects changed in particular _process methods. Note: The Doppler effect will only be heard on AudioStreamPlayer3Ds if AudioStreamPlayer3D.DopplerTracking is not set to AudioStreamPlayer3D.DopplerTrackingEnum.Disabled.

EnvironmentProperty
# Environment
C#
public Environment Environment { get; set; }

Camera environment override taking priority over WorldEnvironment. null clears the override and restores world-environment selection. Check this property on the active camera if world changes appear ineffective.

FarProperty
# Far
C#
public float Far { get; set; }

Distance to the camera’s far clipping plane. Do not use raw_depth*Far as a general distance formula: perspective depth is nonlinear and current rendering uses reverse-Z. The example reconstructs distance with the inverse projection matrix and division by W.

FovProperty
# Fov
C#
public float Fov { get; set; }

The camera's field of view (also known as FOV), as an angle in degrees. Only applicable in perspective mode. Since Camera3D.KeepAspect locks one axis, this property sets the field of view on the other axis. For reference, the default angle for the vertical FOV (75.0) is equivalent to a horizontal FOV of:

  • ~91.31 degrees in a 4:3 viewport
  • ~101.67 degrees in a 16:10 viewport
  • ~107.51 degrees in a 16:9 viewport
  • ~121.63 degrees in a 21:9 viewport
FrustumOffsetProperty
# FrustumOffset
C#
public Vector2 FrustumOffset { get; set; }

The camera's frustum offset. This can be changed from the default to create "tilted frustum" effects such as Y-shearing. Note: Only effective if Camera3D.Projection is Camera3D.ProjectionType.Frustum.

HOffsetProperty
# HOffset
C#
public float HOffset { get; set; }

The horizontal (X) offset of the camera viewport.

KeepAspectProperty
# KeepAspect
C#
public Camera3D.KeepAspectEnum KeepAspect { get; set; }

The axis to lock during Camera3D.Fov/Camera3D.Size adjustments. Can be either Camera3D.KeepAspectEnum.Width or Camera3D.KeepAspectEnum.Height.

NearProperty
# Near
C#
public float Near { get; set; }

Distance to the camera’s near clipping plane in world units. This is not the raw depth_texture value. In the accepted spatial example INV_PROJECTION_MATRIX reconstructs surface distances after Near and Far change, while raw depth changes.

ProjectionProperty
# Projection
C#
public Camera3D.ProjectionType Projection { get; set; }

Camera projection type. Perspective uses a perspective projection with Fov; Orthogonal uses an orthographic projection with Size; Frustum defines an offset frustum. The accepted example reconstructs depth in Perspective and Orthogonal using current INV_PROJECTION_MATRIX. Frustum is outside that acceptance.

SizeProperty
# Size
C#
public float Size { get; set; }

Orthogonal/Frustum projection region size in world units; the corresponding width or height depends on KeepAspect. This is not surface distance. The orthographic control planes retain their reconstructed depth when Size changes and their framing is adjusted accordingly.

VOffsetProperty
# VOffset
C#
public float VOffset { get; set; }

The vertical (Y) offset of the camera viewport.

Methods49

ClearCurrentvoid
# ClearCurrent
C#
public void ClearCurrent(bool enableNext = true);

If this is the current camera, remove it from being current. If enable_next is true, request to make the next camera current, if any.

Parameters
NameTypeDefault
enableNextbooltrue
GetAttributesCameraAttributes
# GetAttributes
C#
public CameraAttributes GetAttributes();
Returns CameraAttributes
GetCameraProjectionProjection
# GetCameraProjection
C#
public Projection GetCameraProjection();

Returns the projection matrix that this camera uses to render to its associated viewport. The camera must be part of the scene tree to function.

Returns Projection
GetCameraRidRid
# GetCameraRid
C#
public Rid GetCameraRid();

Returns the camera's RID from the RenderingServer.

Returns Rid
GetCameraTransformTransform3D
# GetCameraTransform
C#
public Transform3D GetCameraTransform();

Returns the transform of the camera plus the vertical (Camera3D.VOffset) and horizontal (Camera3D.HOffset) offsets; and any other adjustments made to the position and orientation of the camera by subclassed cameras such as XRCamera3D.

Returns Transform3D
GetCompositorCompositor
# GetCompositor
C#
public Compositor GetCompositor();
Returns Compositor
GetCullMaskuint
# GetCullMask
C#
public uint GetCullMask();
Returns uint
GetCullMaskValuebool
# GetCullMaskValue
C#
public bool GetCullMaskValue(int layerNumber);

Returns whether or not the specified layer of the Camera3D.CullMask is enabled, given a layer_number between 1 and 20.

Parameters
NameTypeDefault
layerNumberint—
Returns bool
GetDopplerTrackingCamera3D.DopplerTrackingEnum
# GetDopplerTracking
C#
public Camera3D.DopplerTrackingEnum GetDopplerTracking();
Returns Camera3D.DopplerTrackingEnum
GetEnvironmentEnvironment
# GetEnvironment
C#
public Environment GetEnvironment();
Returns Environment
GetFarfloat
# GetFar
C#
public float GetFar();
Returns float
GetFovfloat
# GetFov
C#
public float GetFov();
Returns float
GetFrustumReckfell.Collections.Array<Plane>
# GetFrustum
C#
public Reckfell.Collections.Array<Plane> GetFrustum();

Returns the camera's frustum planes in world space units as an array of Planes in the following order: near, far, left, top, right, bottom. Not to be confused with Camera3D.FrustumOffset.

Returns Reckfell.Collections.Array<Plane>
GetFrustumOffsetVector2
# GetFrustumOffset
C#
public Vector2 GetFrustumOffset();
Returns Vector2
GetHOffsetfloat
# GetHOffset
C#
public float GetHOffset();
Returns float
GetKeepAspectModeCamera3D.KeepAspectEnum
# GetKeepAspectMode
C#
public Camera3D.KeepAspectEnum GetKeepAspectMode();
Returns Camera3D.KeepAspectEnum
GetNearfloat
# GetNear
C#
public float GetNear();
Returns float
GetProjectionCamera3D.ProjectionType
# GetProjection
C#
public Camera3D.ProjectionType GetProjection();
Returns Camera3D.ProjectionType
GetPyramidShapeRidRid
# GetPyramidShapeRid
C#
public Rid GetPyramidShapeRid();

Returns the RID of a pyramid shape encompassing the camera's view frustum, ignoring the camera's near plane. The tip of the pyramid represents the position of the camera.

Returns Rid
GetSizefloat
# GetSize
C#
public float GetSize();
Returns float
GetVOffsetfloat
# GetVOffset
C#
public float GetVOffset();
Returns float
IsCurrentbool
# IsCurrent
C#
public bool IsCurrent();
Returns bool
IsPositionBehindbool
# IsPositionBehind
C#
public bool IsPositionBehind(Vector3 worldPoint);

Tests whether the world-space point has forward-axis depth less than Near. This includes points between the camera origin and its near plane, not only points on the backward side of the origin. It is a depth test; it does not test the complete frustum or occlusion.

Parameters
NameTypeDefault
worldPointVector3—
Returns bool
IsPositionInFrustumbool
# IsPositionInFrustum
C#
public bool IsPositionInFrustum(Vector3 worldPoint);

Tests a world-space point against the camera frustum planes. Use a camera attached to the scene tree with its viewport configured. A point inside the frustum is not necessarily visible: this method does not query occlusion, geometry coverage or object culling layers.

Parameters
NameTypeDefault
worldPointVector3—
Returns bool
MakeCurrentvoid
# MakeCurrent
C#
public void MakeCurrent();

Makes this camera the current camera for the Viewport (see class description). If the camera node is outside the scene tree, it will attempt to become current once it's added.

ProjectLocalRayNormalVector3
# ProjectLocalRayNormal
C#
public Vector3 ProjectLocalRayNormal(Vector2 screenPoint);

Returns a normal vector from the screen point location directed along the camera. Orthogonal cameras are normalized. Perspective cameras account for perspective, screen width/height, etc.

Parameters
NameTypeDefault
screenPointVector2—
Returns Vector3
ProjectPositionVector3
# ProjectPosition
C#
public Vector3 ProjectPosition(Vector2 screenPoint, float zDepth);

Returns the 3D point in world space that maps to the given 2D coordinate in the Viewport rectangle on a plane that is the given z_depth distance into the scene away from the camera.

Parameters
NameTypeDefault
screenPointVector2—
zDepthfloat—
Returns Vector3
ProjectRayNormalVector3
# ProjectRayNormal
C#
public Vector3 ProjectRayNormal(Vector2 screenPoint);

Returns a normal vector in world space, that is the result of projecting a point on the Viewport rectangle by the inverse camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.

Parameters
NameTypeDefault
screenPointVector2—
Returns Vector3
ProjectRayOriginVector3
# ProjectRayOrigin
C#
public Vector3 ProjectRayOrigin(Vector2 screenPoint);

Returns a 3D position in world space, that is the result of projecting a point on the Viewport rectangle by the inverse camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.

Parameters
NameTypeDefault
screenPointVector2—
Returns Vector3
SetAttributesvoid
# SetAttributes
C#
public void SetAttributes(CameraAttributes env);
Parameters
NameTypeDefault
envCameraAttributes—
SetCompositorvoid
# SetCompositor
C#
public void SetCompositor(Compositor compositor);
Parameters
NameTypeDefault
compositorCompositor—
SetCullMaskvoid
# SetCullMask
C#
public void SetCullMask(uint mask);
Parameters
NameTypeDefault
maskuint—
SetCullMaskValuevoid
# SetCullMaskValue
C#
public void SetCullMaskValue(int layerNumber, bool value);

Based on value, enables or disables the specified layer in the Camera3D.CullMask, given a layer_number between 1 and 20.

Parameters
NameTypeDefault
layerNumberint—
valuebool—
SetCurrentvoid
# SetCurrent
C#
public void SetCurrent(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetDopplerTrackingvoid
# SetDopplerTracking
C#
public void SetDopplerTracking(Camera3D.DopplerTrackingEnum mode);
Parameters
NameTypeDefault
modeCamera3D.DopplerTrackingEnum—
SetEnvironmentvoid
# SetEnvironment
C#
public void SetEnvironment(Environment env);
Parameters
NameTypeDefault
envEnvironment—
SetFarvoid
# SetFar
C#
public void SetFar(float far);
Parameters
NameTypeDefault
farfloat—
SetFovvoid
# SetFov
C#
public void SetFov(float fov);
Parameters
NameTypeDefault
fovfloat—
SetFrustumvoid
# SetFrustum
C#
public void SetFrustum(float size, Vector2 offset, float zNear, float zFar);

Sets the camera projection to frustum mode (see Camera3D.ProjectionType.Frustum), by specifying a Camera3D.Size, an offset, and the z_near and z_far clip planes in world space units. The Camera3D.Size parameter represents the size of the near plane, either its width or height depending on the value of Camera3D.KeepAspect. See also Camera3D.FrustumOffset.

Parameters
NameTypeDefault
sizefloat—
offsetVector2—
zNearfloat—
zFarfloat—
SetFrustumOffsetvoid
# SetFrustumOffset
C#
public void SetFrustumOffset(Vector2 offset);
Parameters
NameTypeDefault
offsetVector2—
SetHOffsetvoid
# SetHOffset
C#
public void SetHOffset(float offset);
Parameters
NameTypeDefault
offsetfloat—
SetKeepAspectModevoid
# SetKeepAspectMode
C#
public void SetKeepAspectMode(Camera3D.KeepAspectEnum mode);
Parameters
NameTypeDefault
modeCamera3D.KeepAspectEnum—
SetNearvoid
# SetNear
C#
public void SetNear(float near);
Parameters
NameTypeDefault
nearfloat—
SetOrthogonalvoid
# SetOrthogonal
C#
public void SetOrthogonal(float size, float zNear, float zFar);

Sets the camera projection to orthogonal mode (see Camera3D.ProjectionType.Orthogonal), by specifying a Camera3D.Size, and the z_near and z_far clip planes in world space units. As a hint, 3D games that look 2D often use this projection, with Camera3D.Size specified in pixels.

Parameters
NameTypeDefault
sizefloat—
zNearfloat—
zFarfloat—
SetPerspectivevoid
# SetPerspective
C#
public void SetPerspective(float fov, float zNear, float zFar);

Sets the camera projection to perspective mode (see Camera3D.ProjectionType.Perspective), by specifying a Camera3D.Fov (field of view) angle in degrees, and the z_near and z_far clip planes in world space units.

Parameters
NameTypeDefault
fovfloat—
zNearfloat—
zFarfloat—
SetProjectionvoid
# SetProjection
C#
public void SetProjection(Camera3D.ProjectionType mode);
Parameters
NameTypeDefault
modeCamera3D.ProjectionType—
SetSizevoid
# SetSize
C#
public void SetSize(float size);
Parameters
NameTypeDefault
sizefloat—
SetVOffsetvoid
# SetVOffset
C#
public void SetVOffset(float offset);
Parameters
NameTypeDefault
offsetfloat—
UnprojectPositionVector2
# UnprojectPosition
C#
public Vector2 UnprojectPosition(Vector3 worldPoint);

Returns the 2D coordinate in the Viewport rectangle that maps to the given 3D point in world space. Note: When using this to position GUI elements over a 3D viewport, use Camera3D.IsPositionBehind to prevent them from appearing if the 3D point is behind the camera:

Parameters
NameTypeDefault
worldPointVector3—
Returns Vector2

Camera3D.DopplerTrackingEnum

ValueDescription
Disabled = 0

Disables Doppler effect simulation (default).

IdleStep = 1

Simulate Doppler effect by tracking positions of objects that are changed in _process. Changes in the relative velocity of this camera compared to those objects affect how audio is perceived (changing the audio's AudioStreamPlayer3D.PitchScale).

PhysicsStep = 2

Simulate Doppler effect by tracking positions of objects that are changed in _physics_process. Changes in the relative velocity of this camera compared to those objects affect how audio is perceived (changing the audio's AudioStreamPlayer3D.PitchScale).

Camera3D.KeepAspectEnum

ValueDescription
Height = 1

Preserves the vertical aspect ratio; also known as Hor+ scaling. This is usually the best option for projects running in landscape mode, as wider aspect ratios will automatically benefit from a wider horizontal FOV.

Width = 0

Preserves the horizontal aspect ratio; also known as Vert- scaling. This is usually the best option for projects running in portrait mode, as taller aspect ratios will benefit from a wider vertical FOV.

Camera3D.ProjectionType

ValueDescription
Frustum = 2

Frustum projection. This mode allows adjusting Camera3D.FrustumOffset to create "tilted frustum" effects.

Orthogonal = 1

Orthogonal projection, also known as orthographic projection. Objects remain the same size on the screen no matter how far away they are.

Perspective = 0

Perspective projection. Objects on the screen becomes smaller when they are far away.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.