glTF Orthographic Camera Configuration Fields

In glTF 2.0, an orthographic camera defines a parallel projection where objects maintain the same visual size regardless of their distance from the viewer. Defining this projection involves setting the camera's base type to "orthographic" and specifying four primary numerical parameters within the camera's orthographic definition object: xmag, ymag, znear, and zfar.

Core Fields in camera.orthographic

To establish the orthographic viewing volume (a rectangular cuboid), the orthographic property object requires the following specific fields:

  • xmag (number, required): The floating-point horizontal magnification of the view. It defines half of the width of the orthographic view box (the distance from the center of the camera to the left or right edge). This value must not be zero.
  • ymag (number, required): The floating-point vertical magnification of the view. It defines half of the height of the orthographic view box (the distance from the center to the top or bottom edge). This value must not be zero.
  • znear (number, required): The floating-point distance to the near clipping plane along the negative z-axis in camera space. This value must be greater than or equal to 0.0.
  • zfar (number, required): The floating-point distance to the far clipping plane along the negative z-axis in camera space. This value must be strictly greater than znear.

Optional glTF Schema Fields

Like most entities in glTF, the orthographic object also supports optional standard metadata fields:

  • extensions (object, optional): A dictionary containing extension-specific objects.
  • extras (any, optional): Application-specific user data.

Example glTF Definition

{
  "cameras": [
    {
      "type": "orthographic",
      "orthographic": {
        "xmag": 1.0,
        "ymag": 1.0,
        "znear": 0.1,
        "zfar": 100.0
      }
    }
  ]
}

Together, xmag and ymag establish the aspect ratio and visible area of the parallel projection, while znear and zfar clamp the visible range in depth, fully determining the orthographic projection matrix.