Camera

class Camera(nativeHandle: NativePointer, val entity: Entity)

Camera represents the eye(s) through which the scene is viewed.

A Camera has a position and orientation and controls projection and exposure. For stereoscopic rendering, a Camera maintains two separate "eyes" (Eye 0 and Eye 1).

Coordinate system: Camera points towards its -Z axis; +Y is up, +X is right. Near/far planes are at -distance(near) and -distance(far) in view space.

Depth-buffer precision: Near plane distance greatly affects depth precision. Use the largest possible near distance; typical ratios: 1:100 to 1:100000 (near:far).

Exposure: Camera exposure (aperture, shutter speed, sensitivity) controls overall scene brightness, interacting with light intensities just like a real camera.

Stereoscopic rendering: The Camera's transform defines "head" space. Each eye's transform relative to head space is set via setEyeModelMatrix, and each eye can have its own projection matrix via setCustomEyeProjection.

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer, entity: Entity)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Field-of-view axis direction.

Link copied to clipboard

Projection type for the camera frustum.

Properties

Link copied to clipboard

Get the camera's aperture in f-stops.

Link copied to clipboard

Get the camera's far plane distance used for culling. Note: for rendering, the far plane is set to infinity internally for depth precision.

Link copied to clipboard

Get the entity representing this camera.

Link copied to clipboard

Get the camera's focal length in meters for a 35mm reference sensor. Computed from Eye 0's projection matrix.

Link copied to clipboard

Set the focus distance for depth-of-field post-processing.

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Link copied to clipboard

Get the camera's near plane distance. Affects depth-buffer precision significantly; use the largest value possible.

Link copied to clipboard

Get the camera's sensitivity in ISO.

Link copied to clipboard

Get the camera's shutter speed in seconds.

Functions

Link copied to clipboard

Get the projection matrix used for culling (far plane is finite).

Link copied to clipboard
fun getEyeFromViewMatrix(eyeId: Int = 0, out: DoubleArray? = null): DoubleArray

Get the eye-from-view matrix of an eye (the inverse of its setEyeModelMatrix).

Link copied to clipboard

Get the camera's field of view in degrees.

Link copied to clipboard

Get the camera's forward vector (direction opposite to -Z, i.e., camera looking direction).

Link copied to clipboard

Get the camera's normalized left vector (basis vector for +X in world space).

Link copied to clipboard

Get the camera's model matrix (position and orientation in world space).

Link copied to clipboard

Get the camera's position in world space.

Link copied to clipboard
fun getProjectionMatrix(eyeId: Int = 0, out: DoubleArray? = null): DoubleArray

Get the projection matrix used for rendering (far plane set to infinity).

Link copied to clipboard

Get the 2D scaling factors applied to the projection matrix.

Link copied to clipboard
fun getShift(out: DoubleArray? = null): DoubleArray

Get the 2D translation shift applied to the projection matrix.

Link copied to clipboard
fun getUpVector(out: FloatArray? = null): FloatArray

Get the camera's normalized up vector (basis vector for +Y in world space).

Link copied to clipboard

Get the camera's view matrix (inverse of the model matrix).

Link copied to clipboard
fun lookAt(eyeX: Double, eyeY: Double, eyeZ: Double, centerX: Double, centerY: Double, centerZ: Double, upX: Double = 0.0, upY: Double = 1.0, upZ: Double = 0.0)

Set the camera's model matrix (position and orientation) using lookAt semantics.

Link copied to clipboard
fun setCustomEyeProjection(projection: DoubleArray, count: Int, projectionForCulling: DoubleArray, near: Double, far: Double)

Set custom projection matrices for stereoscopic rendering (each eye can have different projection).

Link copied to clipboard
fun setCustomProjection(matrix: DoubleArray, near: Double, far: Double)

Set a custom projection matrix used for both rendering and culling.

fun setCustomProjection(matrix: DoubleArray, matrixForCulling: DoubleArray, near: Double, far: Double)

Set custom projection matrices for rendering and culling separately.

Link copied to clipboard
fun setExposure(exposure: Float)

Set the camera's exposure directly (unit-less approach).

fun setExposure(aperture: Float, shutterSpeed: Float, sensitivity: Float)

Set the camera's exposure using physical camera parameters.

Link copied to clipboard
fun setEyeModelMatrix(eyeId: Int, modelMatrix: DoubleArray)

Set the position of an individual eye relative to the camera (head) space.

Link copied to clipboard
fun setLensProjection(focalLength: Double, aspect: Double, near: Double, far: Double)

Set the projection matrix from focal length (lens-based approach).

Link copied to clipboard
fun setModelMatrix(modelMatrix: DoubleArray)
fun setModelMatrix(modelMatrix: FloatArray)

Set the camera's model matrix (position and orientation).

Link copied to clipboard
fun setProjection(fovInDegrees: Double, aspect: Double, near: Double, far: Double, direction: Camera.Fov = Fov.VERTICAL)

Set the projection matrix from field-of-view and aspect ratio.

fun setProjection(projection: Camera.Projection, left: Double, right: Double, bottom: Double, top: Double, near: Double, far: Double)

Set the projection matrix from six frustum planes.

Link copied to clipboard

Apply a 2D scaling to the projection matrix after projection.

Link copied to clipboard
fun setShift(x: Double, y: Double)

Apply a 2D translation shift to the projection matrix after projection.