- Qt 6.10
- Qt Quick 3D
- QML Types
- CustomCamera
- Qt Quick 3D | Commercial or GPLv3

# CustomCamera QML Type

Defines a Camera with a custom projection matrix. More...

Import Statement: | `import QtQuick3D`
Inherits: | Camera

- List of all members, including inherited members

## Properties

- projection : matrix4x4

## Detailed Description

A Camera defines how the content of the 3D scene is projected onto a 2D surface, such as a View3D. A scene needs at least one Camera in order to visualize its contents.

It is possible to position and rotate the Camera like any other spatial Node in the scene. The Node's location and orientation determines where the Camera is in the scene, and what direction it is facing. The default orientation of the Camera has its forward vector pointing along the negative Z axis and its up vector along the positive Y axis.

The CustomCamera type provides a Camera where the projection matrix can be customized freely.

The following example creates a CustomCamera at position [0, 200, 300] in the scene, with a 30 degree downward pitch, and a custom projection matrix based on custom near and far plane distances, and a custom field of view.

     CustomCamera {
         position: Qt.vector3d(0, 200, 300)
         eulerRotation.x: -30

         property real near: 10.0
         property real far: 10000.0
         property real fov: 60.0 * Math.PI / 180.0
         projection: Qt.matrix4x4(Math.cos(fov / 2) / Math.sin(fov / 2) * (window.height / window.width), 0, 0, 0,
                                  0, Math.cos(fov / 2) / Math.sin(fov / 2), 0, 0,
                                  0, 0, -(near + far) / (far - near), -(2.0 * near * far) / (far - near),
                                  0, 0, -1, 0);
     }

Note: When using CustomCamera, some anti-aliasing modes(Temporal AA and Progressive AA) cannot be applied correctly.

See also PerspectiveCamera, OrthographicCamera, and FrustumCamera.

## Property Documentation

projection : matrix4x4

This property defines the CustomCamera's projection matrix.