Carmera Design and Architecture

I am often amazed when talking to peers who are not familiar with the game developing process at just how critical they are of camera controls. most people don't seem to understand why all games don't have the camera control of assassins creed, and neglect to appreciate the type of camera systems that work just as well. Unfortunately some well designed camera systems such as the  god of war  poorly received because you can't control them,  such as the camera in God of War.God of War had a very well made camera system in my opinion and worked to enhance the game design experience, although this opinion is not shared among the lesser educated on the subject.  I suppose understanding the mechanics of camera controls has allowed me to see past this false sense of what a camera should be in a game, so I would like to take some time to explain some of the technical and design aspects of game cameras and hopefully it will clear up any misunderstandings about the subject.Positionit may seem simple but this is actually a very important concept as it greatly impacts the design of your game. will you parent the camera directly on to the player (First person shooter) or is the camera positioned just behind their back (action/adventure) as you can see. something as simple as the camera location can be genre defining and each solution has numerous unique possibilities.most games will define a camera position in world space so it knows where to render.Camera space calculations will place the origin at the cameras coordinates.Screen space represent the view by transforming the camera space coordinates by the projection matrix. Calculations use screen coordinates of the actual pixels on your screen.OrientationCamera orientation is traditionally represented by Yaw, Pitch and RollYaw is the rotation around the UP normal vector (a pan)Pitch is the rotation around the right axis (a tilt)Roll rotates around the front vector of the camera  (bank)Matrix representation.a common way to calculate the cameras orientation is to use transformation matrices. the camera is generally stored in a 3x3 transformation matrix and is translated, rotated, multiplied etc by other matrices. to produce the final orientation.Quaternions are powerful functions that help when interpolating between orientations around an arbitrary axis, as they eliminate gimbal lock and reduce singularity issues.It is common to provide a look at function which adjust the cameras orientation to view a certain coordinate. A great use of this would be "Cinematic Cameras" which adjust the Camera to focus on certain aspects of a scene.MotionThis is another example of where the type of game greatly affects what you are trying to do. often times camera motion is defined by the characters position in space as a function of time.In most RPG games and some action/adventures you may want to use a cinematic cameras which only moves when a character hits a certain trigger like an entrance to a new map or approaches something the game wants you to see better.a good example of where to use this is in games whose visual style rely on 2D graphics. therefor making them only viewable from one dimension.Most Action/adventures as well as virtually all first person shooters allow the player to control the cameraIn FPS it will always maintain its position while adjusting orientationwhereas in action/adventure the cameras "lookAt" always stays facing the player but the position can be moved freely around the playerin fighting games, The camera zooms to a position where both players are visible. during the execution of special attacks when the players lose control for the animation to play out, the camera could make interesting movements to enhance the visual appeal.RenderingRendering involves the use of trigonometry and basic algebra to calculate between camera space, world space and screen space as well asfrustum construction, the type of projection and the field of view conversions.On top of this more interesting shader effects can be added with the help of sofware rending using screen space (Pixel) and World space (Vertex) calculationsfor examplefragment/Vertex lighting , Bump mapping, Fog, Shadows, reflection, Depth of field, Caustics, and non photo realistic rendering.Some of these matrix Calculations can be so involoved that they are usually left up to 3rd party Graphics libraries such as Direct X or Open-GLm you can also use some higher level APIs with scene graph functionality such as OGRE.the less you have to think about the math going into Camera design the better because you will really want to focus on designing it for your game rather than engineering the systemCommon Operations performed on a camera can involve-Linear Interpolation or Sperical Linear interpolation. Which smoothly translates the position of the camera for a cut scene or Cinematic,-Transcendentals use time and trigonometric functions to determine the position of your cameraangle = (pi * time)-(pi/2);time = (sinf(angle)+1)/2;This will smoothly adjust the time for your interpolation function between the values of -1 and 1, in a continuous sinusoidal fashion.-SpringsSmooth camera movement is much more presentable when there is gentle acceleration, however there is a chance that the player move in such a way that doesn't allow the camera enough time to move into position fast enough.a better way to calculate our camera position might be to base the velocity off Hookes LawF= -k *Xyou could find the magnitude of the movement direction and multiply it by the -K constant to get a force value and use that to find your position.Twist Reduction finally there is the issue of Gimbal lock. In mostly older games there is the possibility of running into a corner and your camera is stuck in a position directly above your head, causing it to spin around rapidly.as I mentioned earlier the best way to Stop this is by using Quaternions. Quaternions represent a Vector around which a rotation is happening, and a scalar indicating the direction of the rotation.

Previous
Previous

Human Computer Interface

Next
Next

Grind Quest Objectives