Creating Cameras

Cameras represent points of view within a scene. You can create render targets based on your cameras in order to tell Beast to render the camera's point of view to a single image. Depending on the type of camera you create, you can use the resulting images for different purposes.

Types of cameras

Beast supports two distinct types of cameras, described in the following sections.

By default, both types of cameras are oriented to point in the negative direction of the Z axis; you can control this by setting a rotation in the matrix transform you apply to the camera. See also The Beast Coordinate System. You set the matrix transform at the time you create the camera. You can also change it at any time through a call to ILBSetCameraTransform().

Perspective camera

Perspective cameras produce still images that represent the scene from a given position in 3D space, with a specified angular field of view.

To create a perspective camera, use the ILBCreatePerspectiveCamera() function.

You can set the horizontal field of view of the camera by calling the ILBSetFov() function.

  • When you carry out a standard rendering job, the vertical field of view is calculated automatically based on the horizontal FoV value and the resolution requested for the render target. See also Creating Render Targets.
  • When you run an eRnsT session, the vertical field of view is calculated automatically based on the horizontal FoV value.
  • When you run a live eRnsT session, you can also specify the vertical field of view explicitly through a call to ILBSetVerticalFov().

Cameras and eRnsT

eRnsT will use the first perspective camera defined within a scene to determine the viewer's field of vision within the game world.

  • If you use the standalone eRnsT viewer, this defines the starting position and orientation of the camera when the viewer is launched. The user can move the camera around in the viewer.
  • If you incorporate live eRnsT feedback in your level editor, the field of vision of the camera that you feed to eRnsT each time you carry out a rendering determines the lightmaps that get rendered in that pass.

Environment camera

Environment cameras produce environment maps: still images that record the entire world surrounding the camera. You can use these environment maps for real-time reflections, as textures for sky lights in another scene, as skybox images within the game, etc.

To create an environment camera, use the ILBCreateEnvironmentCamera() function.

In your call to ILBCreateEnvironmentCamera(), you set the type of projection that the camera will use to flatten the environment to a still image. You can use any value from the ILBEnvironmentCameraType enumeration. See the API Reference for details.

Setting up a camera

You can only set up a camera in the context of setting up a scene. See also Creating a Scene.

To set up a camera:

  1. Create a new ILBCameraHandle.
  2. Initialize the handle by calling the ILBCreate...() function that corresponds to the type of camera you want to create. See Creating Cameras above. In your call, you have to specify the handle of the scene that will contain your camera.

You do not have to close or finalize your camera before it can be used in a rendering.

For example, the following code sets up a simple perspective camera:

ILBCameraHandle camera;
ILBCreatePerspectiveCamera(scene, _T("Camera"), matrix, &camera);

// Set a 45 degrees fov
ILBSetFov(camera, static_cast<float>(M_PI) / 4.0f, 1.0f);

Thread safety

You should only modify a camera from a single thread at a time.

Related API functions

API functions related to the creation and setup of cameras are declared in the beastcamera.h file.