This series of posts are inspired by the excellent “Moving Frostbite to Physically Based Rendering” 1 presentation from SIGGRAPH 2014. In the presentation, they describe the decision to move to a physically based camera to support and validate the use of real-world lighting values.
Implementing a physically based camera provides familiarity to the player and content creators. Cameras function as a system of interdependent variables acting in unison to create the resulting image. If your camera system and post effects do not act coherently, it will strike the player as abnormal in a way that will just seem “off.”
This decision would also allow for working with photometric values and leveraging the years of photographic knowledge and experience widely available.
To implement a camera in code it is essential that you have a good understanding of the settings of a camera that affect the exposure of the final image. The exposure of an image describes the amount of light that is captured. There are three things that can influence the exposure of a image: Shutter Speed, Aperture, and ISO. Each of these can be adjusted to allow more or less light in the final image. The combination of these settings is often referred to as the Exposure Value, or EV.2 EV has a relationship with the amount of light in the exposed image so an increase of 1 in the EV would represent a doubling of the amount of light being captured ( 1 EV is commonly referred to as 1 stop of light). All of the camera settings that will be covered in this post can be adjusted up or down by a number of stops of light. If the photographer wishes to allow the same amount of light in but change one of the settings they must compensate by the inverse on another setting to make sure the final EV matches.
The shutter speed indicates how long the sensor or film of a camera is actively collecting light. Typically when pressing the shutter button on a film camera three things will happen:
- The mirror that redirects the image to the view finder will flip up and out of the way.
- The shutter will open exposing the film.
- The shutter will close completing the capture.
Here it is in action on an old Konica film camera.
Things change slightly when talking about digital cameras. For instance, the first only exists for standard dslr cameras and not mirrorless cameras. The second step may also be represented by an electronic shutter instead of a physical one. This is basically the camera performing a clear on the sensor. The last step for most cameras is the same: the amount of time it takes to read the results back from the sensor requires that no additional light is being collected during that time. Shutter speed,, is typically expressed in fractions of a second (1/60th, 1/200th) but can some times be referred to by just the denominator 60 or 200.
The amount of light in the resulting image is linearly proportional to the time the shutter is open, i.e. if you double the shutter speed from 1/30th to 1/15th of a second you will collect double the amount of light. The effect of increasing the shutter time will also influence how much motion is visible in an image. In games we use motion blur to represent this sub frame motion. If you don’t have motion blur, then you are essentially capturing the scene with an infinitely fast shutter speed. This type of look might not appear too unrealistic in a bright outdoor scene but may appear abnormal in lower light shots where it is hard to have the shutter speed that high.
The aperture, commonly referred to as f-number(), represents the ratio of the focal length() of the lens to the diameter of the lens opening(), . The larger the opening, the more light enters the camera and is captured by the film or sensor. Since the aperture is assumed round, the amount of light doubles when the diameter of the opening increases by a factor of .3
The choice of aperture gives the photographer the ability to vary the depth of field of the image. Just to clarify, the depth of field is referring to the portion of the scene that is in focus, while the shapes and blur of the area out of focus is called bokeh.4 Also in focus is completely subjective and is based on viewing a photograph from a normal distance.5 To control the amount of light and depth of field, lenses have manual or electronic diaphragms whose size can be adjusted via an aperture ring. On older and manual lenses, the f-number is labeled on the aperture ring and common values are f/1.4, f/2.0, f/2.8, f/4.0, f/5.6, f/8, f/11, and f/16 (these numbers represent increases of one stop of light).
In games, the aperture has a direct impact on the settings supplied to the depth of field post effect (which we will get into in a later entry). The presence of an aperture diaphragm also influences the aesthetic look of the post process (although many companies are now designing apertures that remain circular at every f-number so one could argue that a circular bokeh effect would actually simulate a much higher quality lens).
The final piece of the image exposure is the ISO or sensitivity of the sensor to incoming light. For digital cameras ISO is actually referring to the standard ISO 12232:2006 published by the *International Organization for Standardization”.6 This standard outlines different techniques for classifying the sensitivity of the sensor at various ratings. Once again the ISO value has a linear relationship with the amount of light in the final image. Typically ISO numbers will begin at 100 and will increase from there by a factor of 2 (100, 200, 400, 800, and so on). On a digital camera you can think of increasing the ISO as increasing the gain of the digital circuit that captures the light. And as with other analog to digital converters, this increase will introduce more noise into the image. In games we are lucky enough that we don’t have this problem and can have an arbitrarily high ISO (although once again you have to be careful not to produce something that the viewer is not accustomed to).
In the next post we will take a look at implementing manual exposure control.
- http://seblagarde.wordpress.com/2014/11/03/siggraph-2014-moving-frostbite-to-physically-based-rendering/ ↩
- http://en.wikipedia.org/wiki/Exposure_value ↩
- http://en.wikipedia.org/wiki/Aperture ↩
- http://en.wikipedia.org/wiki/Bokeh ↩
- http://en.wikipedia.org/wiki/Depth_of_field ↩
- http://en.wikipedia.org/wiki/Film_speed#ISO_12232 ↩