First Person, Third Person, Top Down: these all refer to the position and angle of a video game camera. The camera is the eye into the digital world of your game. Sometimes it is meant to mimic real life with lens flares, depth of field and more. It's important to design a camera that not only shows off your game properly, but also feels immersive. There are numerous things we can add and use with our camera that can greatly enhance the overall experience from fancy shaders, to camera movements, to optimal camera settings. Let's take your camera skills to the next level!
Optimal Field of View (FOV)
The field of view of your camera is going to be largely dependent on the type of game you're creating. You may even have multiple cameras with different types of FoV values. First person shooter games often use two cameras with different FoV values for displaying the first person view, but another for displaying the environment. This often results in the player arms and weapons looking larger, while the environment stays the same. Below are some examples of different FoV's in a first person perspective.
Default 60 Field of View in Unity
Two Cameras, one is set to render only the character with an FoV of 77 and another camera with an FoV of 72 to render the environment
A larger FoV may be preferred for fast paced games such as first person shooters. Plenty of players also want the ability to adjust their FoV. A larger FoV means more is being displayed on screen. A low FoV may be great for horror games or any games where you want to induce claustrophobia. Typically consoles have lower FoV usually for performance reasons but on PC it's expected that FoV can be increased. Below you'll find exaggerated examples of high and low FoV.
High FOV for environment means less player movement to see a larger area. Below the character FOV stays the same but the camera to display the environment is set to 100 which means we can now see the entire platform in front of us. This also creates the "fish eye" effect.
Low FOV feels uncomfortable and unnatural which makes it great for horror type games or anything where you want to simulate a tight space such as hiding in a locker or crawling through vents
Finding the right FoV for your game will take plenty of tweaking. Not all games will look great with specific FoV values and it's dependent on what you're trying to show to the player. An open world gave may have a high FoV to keep players focused on something in the distance while a fighting game might have a close FoV to focus on the action.
Quick Camera Movements
Often times in games an explosion will happen, or some big creature will appear, something heavy will fall to the ground and the players camera will inevitably shake. This happens in movies as well and can add depth to your game, but it can also be over done. Too much shaking and players can get annoyed or nauseated. Sometimes a little goes a long way. Subtle camera movements can provide that feeling of "this feels natural".
Sustained Erratic Movements
This effect can be used for consistent, or erratic movements that will shake the camera around in a few different directions randomly. This effect can also be used for a large vehicle crossing your area. Think of a tank driving by your player, a large rocket taking off, or even a heavy storm. Those would be sustained movements that could last a few seconds or longer.
Quick Movements
On the flip side we have erratic but quick movements such as explosions. Think of a grenade landing by your player and quickly exploding. Depending on your range from that grenade it may provide a violent shake, or a subtle shake but either way it'll be quite quick, usually no more than a second in length. Below you'll see examples of this at work.
Using the same effect as above, we can keep the shake very quick and abrupt to mimic the effect of an explosion. Here are two examples, which looks more impactful?
The same scene and effects in place, but this time with a quick jolt of the camera every time the explosion goes off. The first explosion is in real time, the second is slowed down by about 50% to notice the effect much more closely.
Take a look at this script posted belowto start adding some movement to your cameras for explosions and sustained shakes. In the script you'll find a coroutine that will shake the camera based on the length you specify. Longer time means a sustained shake such as the sandstorm shown above. Very low time is useful for quick impacts such as the explosion which is using a time of 0.25 seconds.
Interested in trying out the script used for these examples? Take a look at the Camera Shake script and play around with the settings. It contains a soloStart bool so you can test it out using the Start method automatically, or you could also call the public method StartExplosionShake from another script or event.
Camera Tracking
With a first person game, camera tracking is relatively straight forward. It acts as the eyes of your player. It moves when your player moves and rotates where your player is looking. The mechanics we'd use for a first person game will be quite different than what we'd use in a third person game.
These types of cameras often times follow our player at a distance. In some games this distance is quite large such as in a Real Time Strategy (RTS) games where players need to see a rather large playing area.
A third person camera might require a lot more foresight in the design process than a first person camera. You need to account for things like smooth movement of the camera, clipping issues, should you use a dynamically controlled camera or keep it relatively fixed. The best camera is the one you don't really even notice. People will only notice a camera when it feels off or they get frustrated about how the camera works.
We all know a game like this. The camera gets stuck behind an object so now you can't see properly. A camera moves too much or feels jittery so it causes people to feel nauseous, it's a common reason why some people cannot stand watching "found footage" type movies. Too much camera movement causes us to try to keep track of it all.
There are three main areas we'll focus on for creating a smooth feeling camera in a third person game: Distance, Angle and Smoothing.
Distance
The distance of your camera should be kept close enough to your player that you can see everything you need to. That sounds a bit vague I know, but with a large distance between your player and the camera you increase the issues of breaking the line of sight. This is even more apparent if you are playing in an area with a lot of tight corners and confined spaces. Depending on your game environment you may want to switch between close distance and large distance.
Angle
There are a few ways to angle your camera within a third person game. Within a third person horror game you may have a close shot of the player with an over the shoulder view. For more open world type games you might have a further distance from the player showing off the entire body, with a clear view of what is in front of this player.
The angle should enhance the overall game mechanics the player will encounter. A close distance and angle should mean close combat, enclosed spaces, seeing smaller details up close.
Here is an example from the 3D Game Kit that has a good angle and good distance from the player:
Note how I can see the entire player in view to see more of the surrounding environment easily. It's also at a good angle so that I can see if an enemy or something important is in front of me. This type of camera is common in more open world games.
Another side note of this is the use obstacle detection with the camera. Here are a few examples showing how when I try to orbit the camera into an obstacle on purpose, it'll automatically move the camera in closer to the character. This is good practice and prevents the camera from getting stuck in obstacles and obstructing the view.
Smoothing
Smoothing camera movements can be the difference between a camera seemingly blending into the game and one that makes people ill. Take a look at the two camera setups below. One has the camera attached to a player, so any subtle movements are also felt in the camera.
Quick and abrupt animations are also felt through this camera. The other camera is smoothed out. Only larger movements are tracked and it's not directly attached to the player. By ignoring small and abrupt changes it feels smoother and easy to watch.
Here we have a camera that is a child of the character. So when the character moves, the camera moves. This can be a bit jarring especially when moving around a lot and can make people queasy. It also makes it harder to keep track of the player.
Here is an example from the 2D GameKit using a camera with "lazy tracking", essentially it follows the player smoothly. The same general mechanics are found here, but this time they're smoothed out a bit to feel more natural.
The two gifs above show the camera moving up and down when jumping, but there may be instances where you don't want the camera to track vertically. Sometimes it helps to have the camera stay in place for specific movements. Again from this same 2D GameKit we see examples of this:
There's no need to track jumping in a scene like this because we can see everything above the player. We are not expected to jump up onto any platforms above us so tracking horizontally is all that is needed.
Here we have an example of no smoothing, again with the camera as a child and you'll see how every jump is tracked which can be jarring to the player.
If you're using the latest version of Unity you'll be glad to know that Cinemachine is now part of Unity. Cinemachine is an absolute amazing tool for creating all sorts of cameras ranging from creating cinematic cut scenes to more dynamic cameras you could use in real time.
Using cameras from Cinemachine already has a ton of settings and features to make your cameras feel absolutely amazing. Keeping a player within a specific shot, smoothing, movement, even a "rails" type camera setup. I'd highly recommend using Cinemachine to beef up your camera skills.
If you'd like to see how Cinemachine can be used in Unity take a look at our Live Event Unity Cinematics: Cinemachine + Timeline
Cut!
Cameras are an absolute vital aspect of video game development. Games being largely a visual medium means a camera can make or break the game. Don't make your camera the weak link. Your camera should feel like a natural extension of the player. If you have any other tips and tricks on how to improve your cameras let me know in the comments!
Awesome!
jgonzalez Sorry, I missed your answer: thank you :)
insanemonster It depends, a lot of times they'll have the camera zoom out a bit for general movement, but when aiming or shooting sometimes the camera will zoom in closely. In general it tends to be in closer to the character while still keeping the character in view.
Resident Evil 4 is one that comes to mind that takes some of these principles in how they setup their camera: https://www.youtube.com/watch?v=urpHwgOujcw In this instance the character's feet is essentially out of view and the camera is off to the side, shooting means the camera zooms in over the shoulder. Also it's a horror game so the field of view is in closer especially when indoors.
Metal Gear Solid 5 has a varied amount of camera angles and distances depending on what you're doing: https://youtu.be/GBIZfnaVc5M?t=1h16m45s It's largely an open world so wide view and angle for the most part, but when sneaking around it zooms in quite a bit. Also for shooting it goes into a first person view which is another unique way of changing cameras for a third person shooter.
Cool article! What would you suggest for a 3rd person shooter? Because you need to actually point to the target but still you need to be able to see your character...
Cool!