Game Development Reference
In-Depth Information
4.2C AMERAS
A camera in games is a useful device by which we can navigate the world and change the
parameters bywhich we draw it. It is useful to think ofcameras as entities that exist and can
be moved and aimed throughout the game world, and for that we strive to create interfaces
that are intuitive and straightforward to use.
Internally, a camera consists of not much more than two transformations, a projection trans-
formation,whichdefineshowgeometrywillbeprojectedfrom3Dspaceontothe2Dscreen,
and the view matrix, this is a matrix that transforms geometry from world space into view
space, we will see exactly what this means a bit further down.
A good camera implementation will provide users with enough features to allow them to
place a camera and aim it in a variety of ways, in some situations it is useful to aim a cam-
era by providing two locations, the camera's location and some target location to look at. In
other cases the user may need to explicitly provide a world transform for the camera, anoth-
er approach is to provide a location for the camera and a direction vector, more specialized
cameras may provide even more useful ways to place, aim and even animate cameras.
4.2.1 Projection
A perspective projection matrix converts the viewing frustum into a cuboid shape in which
thenearestplaneistheplanethatwouldappearclosesttothescreenandthefarthestplaneis
larger, this is what gives the appearance of perspective as objects expand as they get closer
to the near plane.
Search WWH ::




Custom Search