: Camera Styles
Some games have gone well beyond established
with regard to their camera handling. They have borrowed ideas from the film industry and have thus attempted to implement
types of cinematic cameras where the action is followed not by one camera, but by a team of cameramen who watch the action and always try to show it from the best angle. I'm referring to
The Two Towers
; games in which dedicated algorithms are used to select which of the available cameras is best suited to follow the gameplay at any given time.
To implement these algorithms, we need a little inside information on how real-world cameras work. Cameras are usually described by how they are placed on the set. The most popular types include
Fixed cameras are the simplest type of camera. They are fixed to the ground using a tripod or stable base, giving filmmakers a fixed viewpoint to the set. But these cameras are not limited to static takes. Sometimes, they can use tilting, panning, or zooming to move around and focus on different items.
Dolly cameras, or dollies, are moving cameras placed on top of wheeled structures so they can be displaced using straight or
tracks, much like railway lines. They are used when we need to follow the action and want the camera to move as events unfold. The track placement and trajectories must be
planned so the track is never visible, and the movement is smooth.
Crane cameras are perched on top of large arms so they can perform wide arcs on the set. Arm sizes between 9 and 30 feet are normal. Crane cameras are usually controlled by one or more operators remotely, so they can
the arm, but also change the tilt, pan, zoom, and so on of the camera from the ground. For added flexibility, some cranes can be mounted on top of dollies, so the best of both
can be combined.
A steadycam is a portable camera that is usually attached to the chest of an operator. To move the camera, the operator must move around the set. Steadycams provide an added degree of flexibility because there are no tracks or crane arms to watch out for. Steadycams also
sophisticated stabilization mechanisms to ensure smooth, continuous placement regardless of any tremor from the operator. Sometimes steadycams can be used to film in an "over the shoulder" style, made so popular in
Saving Private Ryan
, by just
any stabilization mechanism.
As far as
goes, another factor to keep in mind is the type of shot you are recording, which usually has to do with the distance and scope of the shot—what is seen, what is not seen, and where the camera focuses. Depending on these factors, the following list of popular shots can be compiled.
Dramatic shots focus on the character and his attitude:
An extreme close-up
: Cuts over the mouth, focusing on the eyes
A medium close-up
: Cuts at the chin
A full close-up
: Cuts at the neck
A wide close-up
: Cuts at the shoulder
A close shot
: Cuts at the chest
A medium close shot
: Cuts at the waist
Informational shots include
A medium shot
: Cuts at the hips
A medium full shot
: Cuts under the knees
A full shot
: Shows the entire person
A long shot
: Provides a distance perspective
As we create more complex games, it is important that the games industry get used to this terminology (depicted in Figure 16.4). Most games today use long shots, so we can see both the main character and the
scenario. But games such as
are beginning to show us what can really be done with a cinematic approach to game development.
Figure 16.4. Description of different camera shots.
One interesting and luckily easy to code algorithm begins by placing the cameras using your content creation tool of choice, much like a movie director would do. It is essential to the success of this approach to offer different types of cameras, which are then implemented as a pure abstract class from which specific cameras are derived via inheritance. Content
must have fixed cameras: fixed cameras with pan/tilt dollies so cameras can follow trajectories while focusing on the action, and so on. Notice how computer-simulated dollies are easier to create than their real-world counterparts because there is no fear of the tracks showing in the end result. We can also have vertical,
-shaped, or any kind of
you can think of.
Then, all you need to do is implement a real-time algorithm that selects the best camera according to a heuristic. The classic choice is to select the camera that is
to the player, but that's not the only option. We can cut to a very
, bird's-eye view camera or any other setup. If you choose the "closest to player" criteria, the code is really straightforward. We have a list of cameras, each of one type, but all of them share one property in common: a placement, whether it's a point for fixed cameras or a line or spline for dollies. Thus, the algorithm is just a matter of testing which of the camera placement primitives is closest to the player. Will it be one point, so the player's perspective will use a fixed camera, or will it be a helix, so we can follow him as he climbs a spiral
? In the end, it's just point-point or point-line distances and not much else. Here is the structure for such a system:
// each camera will define how it uses the control points
virtual float computedistance(point);
virtual void render();
class fixedcamera: public camera
float fixecamera::computedistance(point playerpos)
float dollycamera::computedistance(point playerpos)
float tmp= distancepointsegment(playerpos,path[i],path[i+1]);
// here i store the segment where shortest distance was found in a class attribute
float camera::computedistance(point playerpos)
float tmp= cameras[i].distance (playerpos);
This kind of approach has been widely used in many
in the game console arena, where we get the feeling of a virtual cinematographer following the action to always ensure the best viewpoint. Take a look at Figure 16.5 to see how cameras can be included in a level design.
Figure 16.5. A top-down view of the game world, with cameras placed for cinematographic effects.