Api Sandbox SceneCamera
class

SceneCamera

public sealed class SceneCamera

Represents a camera and holds render hooks. This camera can be used to draw tool windows and scene panels.

Constructors

SceneCamera(String name)

Properties

Name Type Description
Bloom BloomAccessor Access tonemapping properties of camera
Attributes RenderAttributes
Name String The name of this camera.. for debugging purposes.
ExcludeTags ITagSet Scene objects with any of these tags won't be rendered by this camera.
RenderTags ITagSet Only scene objects with one of these tags will be rendered by this camera.
OnRenderPostProcess Action Called when rendering the post process pass
OnRenderOpaque Action Called when rendering the transparent pass
OnRenderTransparent Action Called when rendering the transparent pass
OnRenderOverlay Action
OnRenderUI Action
Size Vector2 The size of the screen. Allows us to work out aspect ratio. For now will get updated automatically on render.
VolumetricFog VolumetricFogParameters Control volumetric fog parameters, expect this to take 1-2ms of your GPU frame time.
CubemapFog CubemapFogController Control fog based on an image.
World SceneWorld The world we're going to render.
Worlds HashSet<SceneWorld> Your camera can render multiple worlds.
Position Vector3 The position of the scene's camera.
Rotation Rotation The rotation of the scene's camera.
Angles Angles The rotation of the scene's camera.
FieldOfView Single The horizontal field of view of the Camera in degrees.
ZFar Single The camera's zFar 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 Single The camera's zNear 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.
Ortho Boolean Whether to use orthographic projection.
OrthoHeight Single Height of the ortho when Ortho is enabled.
DebugMode SceneCameraDebugMode Render this camera using a different render mode
WireframeMode Boolean Render this camera using a wireframe view.
ClearFlags ClearFlags What kind of clearing should we do before we begin?
Rect Rect The rect of the screen to render to. This is normalized, between 0 and 1.
BackgroundColor Color Color the scene camera clears the render target to.
AmbientLightColor Color The color of the ambient light. Set it to black for no ambient light, alpha is used for lerping between IBL and constant color.
AntiAliasing Boolean Enable or disable anti-aliasing for this render.
EnablePostProcessing Boolean Toggle all post processing effects for this camera. The default is on.
TargetEye StereoTargetEye The HMD eye that this camera is targeting. Use None for the user's monitor (i.e. the companion window).
WantsStereoSubmit Boolean Set this to false if you don't want the stereo renderer to submit this camera's texture to the compositor. This option isn't considered if TargetEye is None.
EnableDirectLighting Boolean Enable or disable direct lighting
EnableIndirectLighting Boolean Enable or disable indirect lighting
CustomProjectionMatrix Matrix? Allows specifying a custom projection matrix for this camera

Methods

virtual Void Dispose()
Frustum GetFrustum(Rect pixelRect)

Given a pixel rect return a frustum on the current camera.

Frustum GetFrustum(Rect pixelRect, Vector3 screenSize)

Given a pixel rect return a frustum on the current camera. Pass in 1 to ScreenSize to use normalized screen coords.

Ray GetRay(Vector3 cursorPosition)

Given a cursor position get a scene aiming ray.

Ray GetRay(Vector2 cursorPosition, Vector3 screenSize)

Given a cursor position get a scene aiming ray.

Vector2 ToScreen(Vector3 world)

Convert from world coords to screen coords. The results for x and y will be from 0 to Size.

Boolean ToScreen(Vector3 world, Vector2 screen)

Convert from world coords to screen coords. The results for x and y will be from 0 to Size.

Vector2 ToScreenNormal(Vector3 world)

Convert from world coords to normal screen corrds. The results will be between 0 and 1

Vector3 ToWorld(Vector2 screen)

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

Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.SceneCamera