page = bartosz ciechanowski
url = https://ciechanow.ski/
Internal Combustion Engine

The invention of the internal combustion engine in the 19th century has revolutionized transportation over land, water, and air. Despite their omnipresence in modern day, the operation of an engine may be cryptic. Over the course of this article I’d like to explain the functionality of all the basic engine parts shown in the demonstration below. You can drag it around to see it from other angles:
It’s hard to talk about a mechanical device without visualizing its motion, so many demonstrations in this blog post are animated. By default all animations are enabled, but if you find them distracting, or if you want to save power, you can globally pause them. disabled, but if you’d prefer to have things moving as you read you can globally unpause them.
An engine like this may seem complicated, but we will build it up from first principles. In fact, we’ll start with a significantly simpler way of generating a rotational motion.
Crank
Let’s look at a simple crank. It consists of a handle , a crank arm , and a shaft . When a force is applied to the handle the shaft rotates which we can observe by looking at the attached disk:
The force applied at a distance from the shaft generates torque . The harder we push on the handle , the bigger the torque on the shaft . This cranking mechanism is precisely what converts linear force into torque in a manual coffee grinder or a bicycle.
It’s one thing to power something using our own muscles, but the entire point of building an engine is to avoid manual labor and have the device exert the effort instead. To do that we need to find a reliable source of a strong force that is easy to direct. Thankfully, such device was invented hundreds of years ago – a cannon does exactly what we need. In the demonstration below you can observe how a cannon ball is fired from a cannon . The diagonal lines indicate a cross section view – it lets us see what’s going on inside an otherwise obscured region:
As the gun powder is set on fire it quickly produces a huge amount of gases which push the cannon ball down the barrel. Since the ball snugly fits inside it can only go in one direction. While reliable and easy to direct, a cannon ball won’t be very effective at pushing the crank:
We’ve only been able to do a partial turn of the shaft and the cannon ball is long gone. However, with a few modifications we can harness the pushing power of the explosion in a significantly better way.
Firstly, we’ll replace a cannonball with a piston that has a cylindrical shape and a hole drilled in it. We’ll then use a pin to attach to it a rod that can swing freely on a crankshaft :
As the name implies, the crankshaft consists of both the rotating shaft and the crank on which a force is applied. By putting this assembly inside a simplified cannon shell, a cylinder , we’ve managed to solve the problem of the escaping cannon ball, as the piston is limited in its downward movement and will return up as the crankshaft keeps turning:
Notice that the piston has now a minimum and a maximum position it can reach within the cylinder . A single movement over that length in either up or down direction is called a stroke . If we now trigger the explosion, the combustion gases will push the piston down, which turns the crankshaft :
It’s still not a very exciting machine as it only does useful turning work once. To make it more practical we need to keep repeating the cycle of explosions – we have to add in new fuel, trigger a combustion process, and remove the exhaust gases, over and over again.
Solid fuels like black powder are not very practical for an automated machine. It’s much easier to deal with fuels in fluid forms – their intake can be controlled by various valves. We’ll modify the cylinder we’ve built so far by adding new openings at the top of the combustion chamber:
It may be hard to see how the various openings are laid out, so let’s take a look at the cross section view:
Through the first large curved opening we’ll provide a mixture of gasoline and air and through the second one we’ll remove the exhaust gases. Those two openings will be guarded by the intake valve and the exhaust valve . Finally, to light the mixture, we’ll use an electric spark generated by an exposed ends of a wire . Let’s see how all the pieces fit together:
We’re now ready to use this machine to do useful work. At first we’ll open the intake valve while the piston is moving down letting the air with fuel come in which I’ve symbolized using the yellow color. This is the intake stroke:
Once the piston reaches its lowest position the intake valve closes, and the piston starts to move back which compresses the mixture of air and fuel which increases the thermal efficiency of the combustion. This is the compression stroke:
Voltage runs through the open ends of the wire, generating a spark which ignites the air-fuel mixture. The expanding gases created by the combustion push the piston down, creating torque on the crankshaft . This is the power stroke:
Note that the flame propagation inside a cylinder is quite complex , and what you see here is a simplified visualization. The cylinder is now filled with the exhaust gases which we can vent out through another hole by opening the exhaust valve . This is the exhaust stroke:
We’re now back to where we started and the cycle is complete. Let’s look at those four steps together:
Since the piston moves down twice and up twice, it does a total of four strokes and the engine we’ve build is known as a four-stroke engine . Notice that it takes two revolutions of the crankshaft for the piston to do one full cycle of the work as it goes through the four phases: intake, compression, power, and exhaust.
While functional, the engine we’ve built is more of a toy example that doesn’t show a lot of the engineering ingenuity behind many components of real internal combustion engines. Let’s build on the principles we’ve devised so far by constructing a more realistic machine – an engine that one could find in a car.
Engine Block
Let’s start with the biggest and heaviest part of an engine – the engine block . It forms the main body and mounting structure for other parts:
Notice that this block contains four large cylindrical openings that define the four cylinders. Recall that a piston exerts a pushing force on the crankshaft only during the power stroke, so only for about a quarter of time. This uneven action creates a lot of vibration. While it’s often acceptable for smaller engines e.g. in a lawn mower, a typical car engine has more than one cylinder to ensure a more even delivery of power. I’ll discuss these concepts in more depth near the end of the article.
Since the four cylinders are inline, the engine we’ll build is known as an inline four cylinder engine. Other engines may use different arrangements of cylinders, usually in a flat or V-shape configuration.
The sides of the block are reinforced by various ribs to improve the rigidity of the structure – the body has to withhold the power of the explosions inside the cylinders. You may also notice the the top part of the block is perfectly flat – we’ll soon attach another component there. If you look at the cross section of the block you’ll notice that the areas around cylinders are empty:
Those passages are there for the coolant to flow around the cylinders and take the heat of the combustion away. While I’m not going to dive into details of engine cooling, it’s worth noting that engines should run at a specific operating temperature and the coolant pump, thermostats, and radiators make sure that the engine isn’t running too cold or too hot.
Crankshaft
Let’s look at the first big part we’ll mount onto the engine – the crankshaft:
Notice that the crankshaft has five main cylindrical parts that define its axis of rotation, they’re called the main journals . There are also four rod journals that are positioned off-axis. All the journals are connected via webs . Note that while the sections have different colors here, the entire crankshaft is made from a single piece of metal.
You may wonder why the two inner rod journals are offset differently than the two outer ones, so let’s pop the piston assemblies on and see how they’ll move on the crankshaft:
Since the rod journals are at different locations each of the four pistons can run at a different phase of the four stroke cycle. Notice that the distance between the center of the main journals and the rod journals defines how far up and down the piston goes in the cylinder.
A real piston and its connecting rod have some mass so they end up creating a weight imbalance on a rotating crankshaft. To counteract that mass, the webs have elongated shape to form a counterweight that helps to even out the inertial forces on the shaft.
One could assume the installation of the crankshaft in the engine block is as simple as putting it directly in a designated spot at the bottom:
Unfortunately, that wouldn’t really work. During engine operation the pistons exert a lot of force on the crankshaft and the main journals would just rub against the housing creating a lot of friction that would wear the parts down. To fix that we need to firstly put in some bearings that will help to make the rotation of the crankshaft smooth:
These strips of metal don’t look like much, but bearings are usually made from a softer material which causes them to wear first which prevents degradation of the crankshaft itself in case any contact occurs. Most of the time, however, the crankshaft doesn’t actually touch the bearings at all. Notice the small hole in the bearing that matches the corresponding hole inside the engine block :
Through that hole the engine pumps oil under pressure. The crankshaft’s diameter is slightly smaller than the bearings’ inner diameter so oil fills the tiny gap between the two surfaces. Presence of oil is critical here as it creates conditions for hydrodynamic lubrication . Oil sticks to the bearings and the crankshaft , but since the crankshaft rotates it creates a variation in velocity of oil between the two surfaces. In the demonstration below the small arrows symbolize the local velocity of the liquid:
The difference of diameters causes a wedge-like shape to develop which then creates an area of increased pressure that lifts the crankshaft journal away from the bearings . Note that the size of the gap in the demonstration is not to scale, but in real running engines the rotating crankshaft should float completely on a very thin surface of oil.
You may have noticed that one half of the bearings also contains a small gutter which creates a small pool of oil under pressure. Moreover, the crankshaft has small holes in it:
Those passages are actually connected inside and the oil from the pool in the bearing travels through the little passages in the crankshaft itself. This brilliant solution distributes the oil from the main journals to the rod journals , which are constantly changing their position inside the engine. The demonstration below shows one of the many typical arrangements of these passages and the presence of oil in an on the crankshaft:
Let’s finally put the crankshaft in. We’ll clamp it down using five end caps that have their corresponding bearings put in and we’ll screw everything together:
Those screws have to be tightened to a precise torque – it has to be high enough so that end caps are able to keep the crankshaft in place despite the force of explosions pushing down on it through the piston rods, but the torque on the screws can’t be too high to avoid any deformation of the circular shape of the final opening in which the crankshaft lies.
Pistons
The crankshaft itself is there to receive the force from the pistons, so let’s look at at one up close:
Firstly, notice all the empty spaces inside the piston . They’re there to reduce the weight – a piston should be as light as possible to minimize the inertial forces created by its reciprocating motion. In this piston the top part known as the piston crown has a dish-like cavity in it. Other pistons may be flat or have more complicated shapes .
Pistons have actually slightly smaller diameter than the cylinders, otherwise they could seize during movement resulting in a catastrophic engine failure. However, the piston still needs to seal the combustion chamber and prevent gases from leaking around the piston. This problem is solved by piston rings that are placed in the grooves on top of the piston :
On their own piston rings have a fairly big gap, but when placed in the cylinder they’re squeezed into a fitting shape. Note that the fitted ring still has a tiny gap:
While the gap shrinks when a ring gets warmer and expands, the gap should never completely close as the ring may break under pressure. The clearances in the sizing of the rings are very precise. Since the ring is squeezed into a smaller shape, it wants to expand and that tension helps it form a tight seal with the walls of the cylinder. That tension is also reinforced by the pressurized gases getting into the piston grooves and pushing the rings further against the cylinder walls.
The pistons in our engine have three rings with the top two primarily helping to keep the pressure inside the combustion chamber. The third one serves a different role – it’s an oil control ring . The walls of a cylinder under a piston are constantly sprayed with a supply of oil to ensure a smooth movement during strokes. On a downstroke the oil ring scrapes the excessive amount of oil which escapes through the openings in the ring and the groove of the piston:
Top of a piston faces the enormous heat of combustion. The rings are in contact with the piston and the cylinder walls so they heavily participate in heat dissipation. Moreover, since the top part of the piston is in closer contact with the hot gases, it reaches a higher temperature than the lower parts and therefore it expands more. To account for that the pistons are tapered on top so that when the different areas of a piston reach their operating temperatures the shape is more even.
The area of the piston below the rings is called a skirt . Parts of the skirt are, through a thin layer of oil, in contact with cylinder walls during stroke which stabilizes the piston. While they look perfectly round, piston skirts are actually slightly oval .
A piston is attached to its rod via a gudgeon pin . Perhaps you’ve noticed that a piston has tiny grooves near the end of the pin opening. We’ll put snap rings inside them – they’ll prevent the pin from leaving the hole:
Piston rods themselves are very strong as they have to withstand the force of the explosions pressing on the piston during combustion, while also resisting a stretching and pushing forces due to the inertia of the piston changing its direction of movement.
The pistons with the connecting rods and bearings can be slid down the cylinders and attached to the crankshaft :
Recall that the rod bearings are lubricated by the oil coming in through crankshaft passages. Let’s see how the entire thing rotates:
The movement of a piston as the function of the crankshaft angle deserves a closer look. In the demonstration below I marked the maximum, minimum, and a midpoint traveled distance of a piston during its stroke. You can control the rotation of the crankshaft with a slider:
Notice that when the crank arm has done a 90° turn , i.e. halfway through between top to bottom angle, the piston has moved up by less than half of its total stroke distance. It’s a simple geometrical consequence of the length of arms of the triangle formed by the crank arm, the connecting rod, and the vertical baseline.
The maximum piston’s position is known as its top dead center , and its lowest position is known as bottom dead center . As the cylinders move up and down between those two extremes they sweep cylindrical volumes :
The area of a cylinder’s circular cross section A times the stroke length of a piston S define the displacement volume of that cylinder, and the displacement V of the entire engine is the sum of displacements of all of its n cylinders:
V = n · A · S
If a single cylinder’s displacement is half a liter, then a four cylinder engine would be known as a 2.0-L engine. In the most basic setup, the bigger the engine displacement, the more air the engine can suck in, and the higher its peak power.
Closing the Lid
With the parts we’ve assembled so far we’re getting close to completing the combustion chamber. We’ve created the walls with the engine block and the movable bottom with the pistons. We just need to seal it from the top – this is where the cylinder head comes in:
There are a lot of openings there. Firstly, notice four large sections at the bottom – these dome-like cavities will form the top of the combustion chamber. Each of those four sections is the same, so let’s look at the individual segment up close:
In this engine each cylinder has four major openings – through two of them the intake air is sucked in and through the other two the exhaust gases are let out. If you look at the head from a side you’ll notice that each pair of the openings is joined into one elliptical hole that exits on the side of the head. Those passages are known as intake and exhaust ports. Additionally, there is a smaller hole drilled centrally through the axis of each opening – they’re there for the intake and exhaust valves:
Modern engines typically use more than one intake and exhaust valves per cylinder as it increases the flow of gases in and out of the combustion chamber. Moreover, the intake valves are usually a little bigger:
When the piston moves down on an intake stroke, the pressure difference it creates is no larger than that of the incoming air, which, for traditional engines, is roughly equal to the atmospheric pressure. However, at the end of the combustion stroke the pressure inside the cylinder is many times higher than the atmospheric pressure, so it’s significantly easier to expel the combustion gases than to suck the intake air in. For this reason the intake openings and valves are larger.
Let’s look at the operation of those valves up close. Firstly, the seal they form has to be very tight so that the only pathway for the expanding gases created in the combustion is to push the piston down. The edges of a valve and its seat have a conical section so that the seal becomes tighter as the valve is pressed up:
In our toy engine the valves magically opened and closed on their own, so let’s see how it can be actually done in practice. To keep a valve shut we’re going to use a spring to keep tension on a closed valve . We can then lock the spring against the valve using simple locking mechanism that consists of two valve keepers , a spring retainer , and an inverted bucket :
Notice that the top part of a valve has a little groove in it so that the keepers can lock in place. The keepers themselves form a section of a cone that the retainer wedges against:
Since the keepers are locked in the grooves, the retainer can’t move which holds the spring under tension. The bucket provides a big and smooth surface for a force to transfer onto a valve – now whenever we push on the bucket the spring will push it back in place:
We’ve got the return mechanism all figured out, but this still leaves the problem of actually pressing the valves – they need to be opened at a certain cadence which depends on the movement of the piston inside the cylinder. That periodic nature of the operation implies that we should use some sort of rotary motion to push the valves.
We can shape a piece of metal so that it pushes on the valve at different offsets as it rotates on a shaft – it’s known as a cam . The spring ensures that the bucket is tightly pressed against the cam and follows its shape:
The shape of the cam defines when, for how long, and how much the valve is opened. In the demonstration below you can control the height and angular span of the section of the cam profile that deviates from a circle and see how it affects the position of the bucket and thus valve lift at different angles . The plot in the upper part shows the offset of the bucket relative to its normal position as the function of cam rotation angle :
The shape of the cam is critical for defining the way the engine operates. All cams for a set of intake or exhaust valves are usually placed on a single camshaft :
Most modern engines use two sets of camshafts , one for intake valves and another for exhaust valves . Let’s see how the camshafts open and close valves during a typical engine operation:
All cylinders go through four stages in a predefined order. The timing of the valves is actually not as straightforward as it was in our toy engine so let’s look at it up close:
Firstly, notice that the intake valves close after the piston reaches the bottom end of the intake stroke – the air coming through the valve has some inertia, which, especially at high engine speeds, makes it pile up in the cylinder despite the opposite movement of the piston .
Similarly, the exhaust valves open before the piston reaches the bottom of the power stroke , as the majority of the useful work has already been done by the gases and the pressure surplus in the cylinder should be minimized so that the exhaust stroke doesn’t have to actively compress the exhaust gases.
The intake valves open slightly before the piston reaches the top end of the exhaust stroke . When combustion gases escape through the exhaust valves they help to create a “scavenging” effect that helps to pull the intake air in. For that reason the exhaust valves close after the piston reaches the top of the exhaust stroke .
An engine running at low speed may have a different ideal parameters than an engine running at full speed, so many modern engines use a few methods to vary both the timing and lift of the valves during operation.
We can now assemble the pieces together. While the top surface of the engine block and the bottom surface of the cylinder head are very flat and smooth, they need to form a perfect seal as the have to prevent the combustion gases from leaking through. A gasket , often made from a softer, compressible metal, is placed in-between the two and the head is bolted to the block:
The bolts are tightened to the predetermined torque in multiple steps and in a specific order to ensure that the head doesn’t deform during assembly. The sturdiness of the head bolts is critical as they literally have to contain the force of the explosions inside the cylinder.
The camshafts are then installed – they’re held in place by their caps and bolts :
The only remaining piece of the puzzle is to how to turn the camshafts while ensuring they’re synchronized to the movement of the pistons. To achieve this, most engines use a rubber timing belt that is driven by a gear mounted to the crankshaft itself. The timing belt is teethed so that it locks in the notches on the timing gears , the rollers keep the belt in tension:
Recall that in a four stroke engine a single cycle of operation requires two full revolutions of the crankshaft as the piston goes through intake , compression , power , and exhaust phases. However, the intake and exhaust valves open just once during that cycle so the camshafts should do just a single revolution during that time.
To fulfill this requirement the crankshaft gear is twice as small as the camshaft gears – this ensures that the camshafts rotate just once when the crankshaft rotates twice which you can verify by observing a small black dots at the perimeter of the gears:
Combustion
In the examples so far we’ve assumed that the intake valve let in a mixture of air and fuel, and that indeed was the case in older engines that used a carburetor to create the mix.
Modern engines, however, use a fuel injection system where the amount and timing of fuel injection is controlled by an electronic Engine Control Unit , often abbreviated as ECU. At appropriate time the solenoid inside the injector is energized which electromagnetically pulls the needle up, which in turns lets the pressurized fuel escape through the tiny outlet holes. When the power to the solenoid is cut , the spring pushes the needle back to seal the nozzle:
In some engines the injection happens in the intake port, very close to the intake valve itself, but in our engine we’ll use a direct injection system in which the fuel is put directly into the cylinder itself.
The fuel and air mixture in the combustion chamber is lit by a spark plug . In a simplified form a spark plug consists of two pieces of metal separated by a ceramic insulator . The outer shell is connected to the engine body which acts as a ground, and the central electrode is connected to a source of voltage high enough to bridge the gap to the tip of the outer shell which creates a spark:
That high voltage is generated by an ignition coil. In older engines there was a single coil that sequentially provided high voltage to individual spark plugs, but in modern engines each spark plug will usually have its own coil with the discharge controlled by the ECU.
With a set of injectors and spark plugs in hand we can finally fill the remaining holes in the engine head. I’ll hide the rest of the engine so that we get a better view as to where they fit:
Let’s see how an injector and a spark plug work together during the strokes. Note that normally the injector is attached to a fuel rail feeding it highly pressurized gasoline and a spark plug is connected to its coil, but for the sake of clarity they’re not being shown here. The air is depicted as a blue gas that turns yellow when mixed with fuel:
You may notice that the spark plug fires before the piston reaches the end of the compression phase – it’s done on purpose since it takes a moment for the burning of the air-fuel mixture to begin. Let’s take a look at all four cylinders firing in sequence:
All the demonstrations in this article run at very slow speeds, but it’s worth mentioning how fast things happen in an actual car. For an engine running at a modest speed of 1500 revolutions per minute there are 25 revolutions of the crankshaft every second . Each cylinder fires once per two revolutions of the crankshaft, but since we have four cylinders, there are actually around 50 explosions per second happening in an engine running at that speed.
The ratio of air to fuel in the combustion chamber is important as simply adding more fuel doesn’t necessarily make the cylinder pressure bigger as we’ll just end up with incompletely burnt gasoline. To actually increase the speed of the engine we need to increase the supply of fuel and air.
Let’s look at the pressure inside the cylinder a bit closer. During the intake stroke the piston creates a negative pressure difference which sucks the air in. During the compression stroke the pressure increases due to shrinking volume, only to increase even more due to combustion. It’s finally reduced by the expanding volume of the chamber as the piston goes down during the power stroke:
The pushing force generated on the piston is proportional to the pressure in the cylinder, however, the torque generated by that force is also affected by other factors. Firstly, observe that during the compression stroke, the pressure inside the chamber pushes on the piston and through the rod against the rotation of the crankshaft :
Secondly, the magnitude of torque depends on the effective length of the arm of force, but that length changes during crankshaft rotation. For instance, when the piston is at the top dead center the gases merely push the crankshaft down, but they don’t turn it because the force arm has the length of zero. In the demonstration below the red dashed line shows the direction of the rod force and the black line show the arm of force on the crank:
If we account for these effects we can calculate that the torque generated by the pressure inside one cylinder is roughly as follows:
However, these are not all the forces that affect the crankshaft. Both piston and its connecting rod have some mass and during crankshaft’s rotation they keep changing their direction of motion. Let’s look at the plot of the velocity of a piston as it moves up and down the cylinder when the crankshaft rotates with a constant angular velocity:
You may be surprised that the plot isn’t symmetrical, but it’s just a consequence of the already discussed behavior of the crank mechanism taking more time to move through the lower half of the stroke compared to the upper half of the stroke.
Let’s consider a piston in a top dead center position – as the piston reaches that point its velocity is 0, so the crankshaft has to drag the piston down. Roughly halfway through its stroke the piston reaches its maximum velocity, and now the crankshaft has to actually slow the piston down so that it stops moving by the time it reaches the bottom dead center position. The piston, however, wants to keep going, so it exerts a pushing force. These inertial forces keep oscillating back and forth creating an inertial torque on the crankshaft:
The magnitude of the inertial forces depends on the speed of the piston and thus on the crankshaft’s rotational velocity. That system is very dynamic since crankshaft’s rotational velocity in turn is affected by the inertial forces acting on it.
The resulting output crankshaft’s torque is a sum of these pressure-based and inertia-based torques. The cumulative diagram of torque on the crankshaft from a single piston looks roughly like this:
As you can see, the torque created by a single piston is very varied. Even when we overlap the resulting torque from all four pistons the total torque is still fairly uneven:
A torque T acting on a shaft creates an angular acceleration α that is proportional to that torque:
T = I · α
This is a rotational equivalent of traditional linear equation that ties force F to mass m and linear acceleration a :
F = m · a
In rotational motion the equivalent of mass m is moment of inertia I . Similarly to how velocity is affected by acceleration, angular velocity is affected by angular acceleration. Let’s see how angular velocity of the crankshaft varies over time under a constant load:
As you can see the value fluctuates a lot. To reduce the angular acceleration and thus variation in angular velocity we have to increase the rotational inertia I of the system. For that purpose a heavy flywheel is attached to the crankshaft with a bunch of bolts :
Because the flywheel is heavy and has a large moment of inertia the variation in angular velocity of the crankshaft is reduced which makes the engine work more evenly:
Notice that the flywheel has gear teeth cut on its perimeter. Those teeth mesh with a pinion gear that is powered by an electric starter motor when the engine is being turned on.
Once the flywheel starts moving its inertia helps to keep the crankshaft going which in turn lets the engine continue to operate on its own. Note that while the high inertia of the flywheel helps to smooth out the variation in angular velocity, it also comes at a cost – a very heavy flywheel is difficult to spin up so the engine becomes less responsive to throttle input.
In cars with manual transmission an engaged clutch presses against the flywheel to transfer the rotational motion to the transmission and further down to the wheels. Cars with automatic transmission don’t have a flywheel but instead they use a flexplate which is connected to a torque converter which serves as a source of large inertia to smooth out the engine’s efforts.
The journey through our engine ends here, but there are still many components needed to fully embed an engine in a car. The previously mentioned cooling system ensures the engine is kept at an appropriate operating temperature. The intake and exhaust manifolds direct the flow of gases into and out of the cylinders. An oil pump , oil filter , and oil passages in the engine block and cylinder head ensure all components are properly lubricated. Many modern engines also employ a turbocharger that uses the exhaust gases to increase the amount of air that gets pushed into the cylinders. All those components make sure that the engine can operate at expected level of power and efficiency.
Further Watching
Engineering Explained is one of the most popular channels dedicated to car technologies enthusiasts. Over the years Jason Fenske has covered a breadth of topics including a comparisons of injection systems , intake manifold design , and even rotary engines .
PapadakisRacing has some great videos on engine assembly and teardowns . If you think you’d enjoy more videos from the latter category I Do Cars does in-depth deconstruction videos of used engines .
How a Car Works is a fantastic video course on the operation of a car. In high quality episodes the presenter goes into a lot more details than what I’ve described here. While the course is paid, there are some free preview videos available on YouTube .
Unchallenged for decades, the internal combustion engines in cars are slowly being supplanted by their electric equivalents, which are simpler, quieter, and more environmentally friendly.
Despite their drawbacks, classic engines still have something mythical about them – their intricate mechanisms are synchronized together to create carefully controlled conditions for harnessing fire in a truly Promethean way.
Cameras and Lenses

Pictures have always been a meaningful part of the human experience. From the first cave drawings, to sketches and paintings, to modern photography, we’ve mastered the art of recording what we see.
Cameras and the lenses inside them may seem a little mystifying. In this blog post I’d like to explain not only how they work, but also how adjusting a few tunable parameters can produce fairly different results:
Over the course of this article we’ll build a simple camera from first principles. Our first steps will be very modest – we’ll simply try to take any picture. To do that we need to have a sensor capable of detecting and measuring light that shines onto it.
Recording Light
Before the dawn of the digital era, photographs were taken on a piece of film covered in crystals of silver halide . Those compounds are light-sensitive and when exposed to light they form a speck of metallic silver that can later be developed with further chemical processes.
For better or for worse, I’m not going to discuss analog devices – these days most cameras are digital. Before we continue the discussion relating to light we’ll use the classic trick of turning the illumination off. Don’t worry though, we’re not going to stay in darkness for too long.
The image sensor of a digital camera consists of a grid of photodetectors. A photodetector converts photons into electric current that can be measured – the more photons hitting the detector the higher the signal.
In the demonstration below you can observe how photons fall onto the arrangement of detectors represented by small squares. After some processing, the value read by each detector is converted to the brightness of the resulting image pixels which you can see on the right side. I’m also symbolically showing which photosite was hit with a short highlight. The slider below controls the flow of time:
The longer the time of collection of photons the more of them are hitting the detectors and the brighter the resulting pixels in the image. When we don’t gather enough photons the image is underexposed , but if we allow the photon collection to run for too long the image will be overexposed .
While the photons have the “color” of their wavelength , the photodetectors don’t see that hue – they only measure the total intensity which results in a black and white image. To record the color information we need to separate the incoming photons into distinct groups. We can put tiny color filters on top of the detectors so that they will only accept, more or less, red, green, or blue light:
This color filter array can be arranged in many different formations. One of the simplest is a Bayer filter which uses one red, one blue, and two green filters arranged in a 2x2 grid:
A Bayer filter uses two green filters because light in green part of the spectrum heavily correlates with perceived brightness. If we now repeat this pattern across the entire sensor we’re able to collect color information. For the next demo we will also double the resolution to an astonishing 1 kilopixel arranged in a 32x32 grid:
Note that the individual sensors themselves still only see the intensity, and not the color, but knowing the arrangement of the filters we can recreate the colored intensity of each sensor, as shown on the right side of the simulation.
The final step of obtaining a normal image is called demosaicing . During demosaicing we want to reconstruct the full color information by filling in the gaps in the captured RGB values. One of the simplest way to do it is to just linearly interpolate the values between the existing neighbors. I’m not going to focus on the details of many other available demosaicing algorithms and I’ll just present the resulting image created by the process:
Notice that yet again the overall brightness of the image depends on the length of time for which we let the photons through. That duration is known as shutter speed or exposure time. For most of this presentation I will ignore the time component and we will simply assume that the shutter speed has been set just right so that the image is well exposed.
The examples we’ve discussed so far were very convenient – we were surrounded by complete darkness with the photons neatly hitting the pixels to form a coherent image. Unfortunately, we can’t count on the photon paths to be as favorable in real environments, so let’s see how the sensor performs in more realistic scenarios.
Over the course of this article we will be taking pictures of this simple scene. The almost white background of this website is also a part of the scenery – it represents a bright overcast sky. You can drag around the demo to see it from other directions:
Let’s try to see what sort of picture would be taken by a sensor that is placed near the objects without any enclosure. I’ll also significantly increase the sensor’s resolution to make the pixels of the final image align with the pixels of your display. In the demonstration below the left side represents a view of the scene with the small greenish sensor present, while the right one shows the taken picture:
This is not a mistake. As you can see, the obtained image doesn’t really resemble anything. To understand why this happens let’s first look at the light radiated from the scene.
If you had a chance to explore how surfaces reflect light , you may recall that most matte surfaces scatter the incoming light in every direction. While I’m only showing a few examples, every point on every surface of this scene reflects the photons it receives from the whiteish background light source all around itself:
The red sphere ends up radiating red light, the green sphere radiates green light, and the gray checkerboard floor reflects white light of lesser intensity. Most importantly, however, the light emitted from the background is also visible to the sensor.
The problem with our current approach to taking pictures is that every pixel of the sensor is exposed to the entire environment. Light radiated from every point of the scene and the white background hits every point of the sensor. In the simulation below you can witness how light from different directions hits one point on the surface of the sensor:
Clearly, to obtain a discernible image we have to limit the range of directions that affect a given pixel on the sensor. With that in mind, let’s put the sensor in a box that has a small hole in it. The first slider controls the diameter of the hole, while the second one controls the distance between the opening and the sensor:
While not shown here, the inner sides of the walls are all black so that no light is reflected inside the box. I also put the sensor on the back wall so that the light from the hole shines onto it. We’ve just built a pinhole camera , let’s see how it performs. Observe what happens to the taken image as we tweak the diameter of the hole with the first slider, or change the distance between the opening and the sensor with the second one:
There are so many interesting things happening here! The most pronounced effect is that the image is inverted. To understand why this happens let’s look at the schematic view of the scene that shows the light rays radiated from the objects, going through the hole, and hitting the sensor:
As you can see the rays cross over in the hole and the formed image is a horizontal and a vertical reflection of the actual scene. Those two flips end up forming a 180° rotation. Since rotated images aren’t convenient to look at, all cameras automatically rotate the image for presentation and for the rest of this article I will do so as well.
When we change the distance between the hole and the sensor the viewing angle changes drastically. If we trace the rays falling on the corner pixels of the sensor we can see that they define the extent of the visible section of the scene:
Rays of light coming from outside of that shape still go through the pinhole, but they land outside of the sensor and aren’t recorded. As the hole moves further away from the sensor, the angle, and thus the field of view visible to the sensor gets smaller. We can see this in a top-down view of the camera:
Coincidentally, this diagram also helps us explain two other effects. Firstly, in the photograph the red sphere looks almost as big as the green one, even though the scene view shows the latter is much larger. However, both spheres end up occupying roughly the same span on the sensor and their size in the picture is similar. It’s also worth noting that the spheres seem to grow when the field of view gets narrower because their light covers larger part of the sensor.
Secondly, notice that different pixels of the sensor have different distance and relative orientation to the hole. The pixels right in the center of the sensor see the pinhole straight on, but pixels positioned at an angle to the main axis see a distorted pinhole that is further away. The ellipse in the bottom right corner of the demonstration below shows how a pixel positioned at the blue point sees the pinhole:
This change in the visible area of the hole causes the darkening we see in the corners of the photograph. The value of the cosine of the angle I’ve marked with a yellow color is quite important as it contributes to the reduction of visible light in four different ways:
Two cosine factors from the increased distance to the hole, it’s essentially the inverse square law
A cosine factor from the side squeeze of the circular hole seen at an angle
A cosine factor from the relative tilt of the receptor
These four factors conspire together to reduce the illumination by a factor of cos 4 (α) in what is known as cosine-fourth-power law , also described as natural vignetting .
Since we know the relative geometry of the camera and the opening we can correct for this effect by simply dividing by the falloff factor and from this point on I will make sure that the images don’t have darkened corners.
The final effect we can observe is that when the hole gets smaller the image gets sharper. Let’s see how the light radiated from two points of the scene ends up going through the camera depending on the diameter of the pinhole:
We can already see that larger hole size ends up creating a bigger spread on the sensor. Let’s see this situation up close on a simple grid of detecting cells. Notice what happens to the size of the final circle hitting the sensor as that diameter of the hole changes:
When the hole is small enough rays from the source only manage to hit one pixel on the sensor. However, at larger radii the light spreads onto other pixels and a tiny point in the scene is no longer represented by a single pixel causing the image to no longer be sharp.
It’s worth pointing out that sharpness is ultimately arbitrary – it depends on the size at which the final image is seen, viewing conditions, and visual acuity of the observer. The same photograph that looks sharp on a postage stamp may in fact be very blurry when seen on a big display.
By reducing the size of the cone of light we can make sure that the source light affects a limited number of pixels. Here, however, lays the problem. The sensor we’ve been using so far has been an idealized detector capable of flawless adjustment of its sensitivity to the lighting conditions. If we instead were to fix the sensor sensitivity adjustment, the captured image would look more like this:
As the relative size of the hole visible to the pixels of the sensor gets smaller, be it due to reduced diameter or increased distance , fewer photons hit the surface and the image gets dimmer.
To increase the number of photons we capture we could extend the duration of collection, but increasing the exposure time comes with its own problems – if the photographed object moves or the camera isn’t held steady we risk introducing some motion blur .
Alternatively, we could increase the sensitivity of the sensor which is described using the ISO rating. However, boosting the ISO may introduce a higher level of noise . Even with these problems solved an actual image obtained by smaller and smaller holes would actually start getting blurry again due to diffraction effects of light.
If you recall how diffuse surfaces reflect light you may also realize how incredibly inefficient a pinhole camera is. A single point on the surface of an object radiates light into its surrounding hemisphere, however, the pinhole captures only a tiny portion of that light.
More importantly, however, a pinhole camera gives us minimal artistic control over which parts of the picture are blurry. In the demonstration below you can witness how changing which object is in focus heavily affects what is the primary target of attention of the photograph:
Let’s try to build an optical device that would solve both of these problems: we want to find a way to harness a bigger part of the energy radiated by the objects and also control what is blurry and how blurry it is. For the objects in the scene that are supposed to be sharp we want to collect a big chunk of their light and make it converge to the smallest possible point. In essence, we’re looking for an instrument that will do something like this:
We could then put the sensor at the focus point and obtain a sharp image. Naturally, the contraption we’ll try to create has to be transparent so that the light can pass through it and get to the sensor, so let’s begin the investigation by looking at a piece of glass.
Glass
In the demonstration below I put a red stick behind a pane of glass. You can adjust the thickness of this pane with the gray slider below:
When you look at the stick through the surface of a thick glass straight on , everything looks normal. However, as your viewing direction changes the stick seen through the glass seems out of place. The thicker the glass and the steeper the viewing angle the bigger the offset.
Let’s focus on one point on the surface of the stick and see how the rays of light radiated from its surface propagate through the subsection of the glass. The red slider controls the position of the source and the gray slider controls the thickness. You can drag the demo around to see it from different viewpoints:
For some reason the rays passing through glass at an angle are deflected off their paths . The change of direction happens whenever the ray enters or leaves the glass.
To understand why the light changes direction we have to peek under the covers of classical electromagnetism and talk a bit more about waves.
Waves
It’s impossible to talk about wave propagation without involving the time component, so the simulations in this sections are animated – you can play and pause them by clicking tapping on the button in their bottom left corner.
By default all animations are enabled, but if you find them distracting, or if you want to save power, you can globally pause all the following demonstrations. disabled, but if you’d prefer to have things moving as you read you can globally unpause them and see all the waves oscillating.
Let’s begin by introducing the simplest sinusoidal wave:
A wave like this can be characterized by two components. Wavelength λ is the distance over which the shape of the wave repeats. Period T defines how much time a full cycle takes.
Frequency f , is just a reciprocal of period and it’s more commonly used – it defines how many waves per second have passed over some fixed point. Wavelength and frequency define phase velocity v p which describes how quickly a point on a wave, e.g. a peak, moves:
v p = λ · f
The sinusoidal wave is the building block of a polarized electromagnetic plane wave. As the name implies electromagnetic radiation is an interplay of oscillations of electric field E and magnetic field B :
In an electromagnetic wave the magnetic field is tied to the electric field so I’m going to hide the former and just visualize the latter. Observe what happens to the electric component of the field as it passes through a block of glass. I need to note that dimensions of wavelengths are not to scale:
Notice that the wave remains continuous at the boundary and inside the glass the frequency of the passing wave remains constant, However, the wavelength and thus the phase velocity are reduced – you can see it clearly from the side .
The microscopic reason for the phase velocity change is quite complicated , but it can be quantified using the index of refraction n , which is the ratio of the speed of light c to the phase velocity v p of lightwave in that medium:
n = c / v p
The higher the index of refraction the slower light propagates through the medium. In the table below I’ve presented a few different indices of refraction for some materials:
vacuum 1.00
air 1.0003
water 1.33
glass 1.53
diamond 2.43
Light traveling through air barely slows down, but in a diamond it’s over twice as slow. Now that we understand how index of refraction affects the wavelength in the glass, let’s see what happens when we change the direction of the incoming wave:
The wave in the glass has a shorter wavelength, but it still has to match the positions of its peaks and valleys across the boundary. As such, the direction of propagation must change to ensure that continuity.
I need to note that the previous two demonstrations presented a two dimensional wave since that allowed me to show the sinusoidal component oscillating into the third dimension. In real world the lightwaves are three dimensional and I can’t really visualize the sinusoidal component without using the fourth dimension which has its own set of complications .
The alternative way of presenting waves is to use wavefronts . Wavefronts connect the points of the same phase of the wave, e.g. all the peaks or valleys. In two dimensions wavefronts are represented by lines:
In three dimensions the wavefronts are represented by surfaces . In the demonstration below a single source emits a spherical wave, points of the same phase in the wave are represented by the moving shells:
By drawing lines that are perpendicular to the surface of the wavefront we create the familiar rays. In this interpretation rays simply show the local direction of wave propagation which can be seen in this example of a section of a spherical 3D wave:
I will continue to use the ray analogy to quantify the change in direction of light passing through materials. The relation between the angle of incidence θ 1 and angle of refraction θ 2 can be formalized with the equation known as Snell’s law :
n 1 · sin(θ 1 ) = n 2 · sin(θ 2 )
It describes how a ray of light changes direction relative to the surface normal on the border between two different media. Let’s see it in action:
When traveling from a less to more refractive material the ray bends towards the normal , but when the ray exits the object with higher index of refraction it bends away from the normal .
Notice that in some configurations the refracted ray completely disappears, however, this doesn’t paint a full picture because we’re currently completely ignoring reflections.
All transparent objects reflect some amount of light. You may have noticed that reflection on a surface of a calm lake or even on the other side of the glass demonstration at the beginning of the previous section . The intensity of that reflection depends on the index of refraction of the material and the angle of the incident ray. Here’s a more realistic demonstration of how light would get refracted and reflected between two media:
The relation between transmittance and reflectance is determined by Fresnel equations . Observe that the curious case of missing light that we saw previously no longer occurs – that light is actually reflected. The transition from partial reflection and refraction to the complete reflection is continuous, but near the end it’s very rapid and at some point the refraction completely disappears in the effect known as total internal reflection .
The critical angle at which the total internal reflection starts to happen depends on the indices of refraction of the boundary materials. Since that coefficient is low for air, but very high for diamond a proper cut of the faces makes diamonds very shiny.
While interesting on its own, reflection in glass isn’t very relevant to our discussion and for the rest of this article we’re not going to pay much attention to it. Instead, we’ll simply assume that the materials we’re using are covered with high quality anti-reflective coating .
Manipulating Rays
Let’s go back to the example that started the discussion of light and glass. When both sides of a piece of glass are parallel, the ray is shifted, but it still travels in the same direction. Observe what happens to the ray when we change the relative angle of the surfaces of the glass.
When we make two surfaces of the glass not parallel we gain the ability to change the direction of the rays. Recall, that we’re trying to make the rays hitting the optical device converge at a certain point. To do that we have to bend the rays in the upper part down and, conversely, bend the rays in the lower part up.
Let’s see what happens if we shape the glass to have different angles between its walls at different height. In the demonstration below you can control how many distinct segments a piece of glass is shaped to:
3

As the number of segments approaches infinity we end up with a continuous surface without any edges. If we look at the crossover point from the side you may notice that we’ve managed to converge the rays across one axis, but the top-down view reveals that we’re not done yet. To focus all the rays we need to replicate that smooth shape across all possible directions – we need rotational symmetry:
We’ve created a convex thin lens . This lens is idealized, in the later part of the article we’ll discuss how real lenses aren’t as perfect, but for now it will serve us very well. Let’s see what happens to the focus point when we change the position of the red source:
When the source is positioned very far away the incoming rays become parallel and after passing through lens they converge at a certain distance away from the center. That distance is known as focal length .
The previous demonstration also shows two more general distances: s o which is the distance between the o bject, or source, and the lens, as well as s i which is the distance between the i mage and the lens. These two values and the focal length f are related by the thin lens equation :
1 / s o + 1 / s i = 1 / f
Focal length of a lens depends on both the index of refraction of the material from which the lens is made and its shape :
Now that we understand how a simple convex lens works we’re ready to mount it into the hole of our camera. We will still control the distance between the sensor and the lens, but instead of controlling the diameter of the lens we’ll instead control its focal length :
When you look at the lens from the side you may observe how the focal length change is tied to the shape of the lens. Let’s see how this new camera works in action:
Once again, a lot of things are going on here! Firstly, let’s try to understand how the image is formed in the first place. The demonstration below shows paths of rays from two separate points in the scene. After going through the lens they end up hitting the sensor:
Naturally, this process happens for every single point in the scene which creates the final image. Similarly to a pinhole a convex lens creates an inverted picture – I’m still correcting for this by showing you a rotated photograph.
Secondly, notice that the distance between the lens and the sensor still controls the field of view. As a reminder, the focal length of a lens simply defines the distance from the lens at which the rays coming from infinity converge. To achieve a sharp image, the sensor has to be placed at the location where the rays focus and that’s what’s causing the field of view to change.
In the demonstration below I’ve visualized how rays from a very far object focus through a lens of adjustable focal length , notice that to obtain a sharp image we must change the distance between the lens and the sensor which in turn causes the field of view to change:
If we want to change the object on which a camera with a lens of a fixed focal length is focused, we have to move the image plane closer or further away from the lens which affects the angle of view. This effect is called focus breathing :
A lens with a fixed focal length like the one above is often called a prime lens, while lenses with adjustable focal length are called zoom lenses. While the lenses in our eyes do dynamically adjust their focal lengths by changing their shape, rigid glass can’t do that so zoom lenses use a system of multiple glass elements that change their relative position to achieve this effect.
In the simulation above notice the difference in sharpness between the red and green spheres. To understand why this happens let’s analyze the rays emitted from two points on the surface of the spheres. In the demonstration below the right side shows the light seen by the sensor just from the two marked points on the spheres:
The light from the point in focus converges to a point, while the light from an out-of-focus point spreads onto a circle. For larger objects the multitude of overlapping out-of-focus circles creates a smooth blur called bokeh . With tiny and bright light sources that circle itself is often visible, you may have seen effects like the one in the demonstration below in some photographs captured in darker environments:
Notice that the circular shape is visible for lights both in front of and behind the focused distance. As the object is positioned closer or further away from the lens the image plane “slices” the cone of light at different location:
That circular spot is called a circle of confusion . While in many circumstances the blurriness of the background or the foreground looks very appealing, it would be very useful to control how much blur there is.
Unfortunately, we don’t have total freedom here – we still want the primary photographed object to remain in focus so its light has to converge to a point. We just want to change the size of the circle of out-of-focus objects without moving the central point. We can accomplish that by changing the angle of the cone of light:
There are two methods we can use to modify that angle. Firstly, we can change the focal length of the lens – you may recall that with longer focal lengths the cone of light also gets longer. However, changing the focal length and keeping the primary object in focus requires moving the image plane which in turn changes how the picture is framed.
The alternative way of reducing the angle of the cone of light is to simply ignore some of the “outer” rays. We can achieve that by introducing a stop with a hole in the path of light:
This hole is called an aperture . In fact, even the hole in which the lens is mounted is an aperture of some sort, but what we’re introducing is an adjustable aperture:
Let’s try to see how an aperture affects the photographs taken with our camera:
In real camera lenses an adjustable aperture is often constructed from a set of overlapping blades that constitute an iris . The movement of those blades changes the size of the aperture:
The shape of the aperture also defines the shape of bokeh. This is the reason why bokeh sometimes has a polygonal shape – it’s simply the shape of the “cone” of light after passing through the blades of the aperture. Next time you watch a movie pay a close attention to the shape of out-of-focus highlights, they’re often polygonal:
As the aperture diameter decreases, larger and larger areas of the photographed scene remain sharp. The term depth of field is used to define the length of the region over which the objects are acceptably sharp. When describing the depth of field we’re trying to conceptually demark those two boundary planes and see how far apart they are from each other.
Let’s see the depth of field in action. The black slider controls the aperture, the blue slider controls the focal length, and the red slider changes the position of the object relative to the camera. The green dot shows the place of perfect focus, while the dark blue dots show the limits, or the depth, of positions between which the image of the red light source will be reasonably sharp, as shown by a single outlined pixel on the sensor:
Notice that the larger the diameter of aperture and the shorter the focal length the shorter the distance between the dark blue dots and thus the shallower the depth of field becomes. If you recall our discussion of sharpness this demonstration should make it easier to understand why reducing the angle of the cone increases the depth of field.
If you don’t have perfect vision you may have noticed that squinting your eyes make you see things a little better. Your eyelids covering some part of your iris simply act as an aperture that decreases the angle of the cone of light falling into your eyes making things sightly less blurry on your retina.
An interesting observation is that aperture defines the diameter of the base of the captured cone of light that is emitted from the object. Twice as large aperture diameter captures roughly four times more light due to increased solid angle . In practice, the actual size of the aperture as seen from the point of view of the scene, or the entrance pupil , depends on all the lenses in front of it as the shaped glass may scale the perceived size of the aperture.
On the other hand, when a lens is focused correctly, the focal length defines how large a source object is in the picture. By doubling the focal length we double the width and the height of the object on the sensor thus increasing the area by the factor of four. The light from the source is more spread out and each individual pixel receives less light.
The total amount of light hitting each pixel is proportional to the ratio between the focal length f and the diameter of the entrance pupil D . This ratio is known as the f-number :
N = f / D
A lens with a focal length of 50 mm and the entrance pupil of 25 mm would have N equal to 2 and the f -number would be known as f /2. Since the amount of light getting to each pixel of the sensor increases with the diameter of the aperture and decreases with the focal length, the f -number controls the brightness of the projected image.
The f -number with which commercial lenses are marked usually defines the maximum aperture a lens can achieve and the smaller the f -number the more light the lens passes through. Bigger amount of incoming light allows reduction of exposure time, so the smaller the f -number the faster the lens is. By reducing the size of the aperture we can modify the f -number with which a picture is taken.
The f -numbers are often multiples of 1.4 which is an approximation of 2 . Scaling the diameter of an adjustable aperture by 2 scales its area by 2 which is a convenient factor to use. Increasing the f -number by a so-called stop halves the amount of received light. The demonstration below shows the relatives sizes of the aperture through which light is being seen:
f /1.4
To maintain the overall brightness of the image when stopping down we’d have to either increase the exposure time or the sensitivity of the sensor.
While aperture settings let us easily control the depth of field, that change comes at a cost. When the f -number increases and the aperture diameter gets smaller we effectively start approaching a pinhole camera with all its related complications.
In the final part of this article we will discuss the entire spectrum of another class of problems that we’ve been conveniently avoiding all this time.
Aberrations
In our examples so far we’ve been using a perfect idealized lens that did exactly what we want and in all the demonstrations I’ve relied on a certain simplification known as the paraxial approximation . However, the physical world is a bit more complicated.
The most common types of lenses are spherical lenses – their curved surfaces are sections of spheres of different radii. These types of lenses are easier to manufacture, however, they actually don’t perfectly converge the rays of incoming light. In the demonstration below you can observe how fuzzy the focus point is for various lens radii:
This imperfection is known as spherical aberration . This specific flaw can be corrected with aspheric lenses , but unfortunately there are other types of problems that may not be easily solved by a single lens. In general, for monochromatic light there are five primary types of aberrations: spherical aberration , coma , astigmatism , field curvature , and distortion .
We’re still not out of the woods even if we manage to minimize these problems. In normal environments light is very non -monochromatic and nature sets another hurdle into optical system design. Let’s quickly go back to the dark environment as we’ll be discussing a single beam of white light.
Observe what happens to that beam when it hits a piece of glass. You can make the sides non-parallel by using the slider:
What we perceive as white light is a combination of lights of different wavelengths. In fact, the index of refraction of materials depends on the wavelength of the light. This phenomena called dispersion splits what seems to be a uniform beam of white light into a fan of color bands. The very same mechanism that we see here is also responsible for a rainbow.
In a lens this causes different wavelengths of light to focus at different offsets – the effect known as chromatic aberration . We can easily visualize the axial chromatic aberration even on a lens with spherical aberration fixed. I’ll only use red, green, and blue dispersed rays to make things less crowded, but remember that other colors of the spectrum are present in between. Using the slider you can control the amount of dispersion the lens material introduces:
Chromatic aberration may be corrected with an achromatic lens , usually in the form of a doublet with two different types of glass fused together.
To minimize the impact of the aberrations, camera lenses use more than one optical element on their pathways. In this article I’ve only shown you simple lens systems, but a high-end camera lens may consist of a lot of elements that were carefully designed to balance the optical performance, weight, and cost.
While we, in our world of computer simulations on this website, can maintain the illusion of simple and perfect systems devoid of aberrations, vignetting , and lens flares , real cameras and lenses have to deal with all these problems to make the final pictures look good.
Further Watching and Reading
Over on YouTube Filmmaker IQ channel has a lot of great content related to lenses and movie making. Two videos especially fitting here are The History and Science of Lenses and Focusing on Depth of Field and Lens Equivalents .
What Makes Cinema Lenses So Special!? on Potato Jet channel is a great interview with Art Adams from ARRI . The video goes over many interesting details of high-end cinema lens design, for example, how the lenses compensate for focus breathing , or how much attention is paid to the quality of bokeh .
For a deeper dive on bokeh itself Jakub Trávník’s On Bokeh is a great article on the subject. The author explains how aberrations may cause bokeh of non uniform intensity and shows many photographs of real cameras and lenses.
In this article I’ve mostly been using geometrical optics with some soft touches of electromagnetism. For a more modern look at the nature of light and its interaction with matter I recommend Richard Feynman’s QED: The Strange Theory of Light and Matter . The book is written in a very approachable style suited for general audience, but it still lets Feynman’s wits and brilliance shine right through.
We’ve barely scratched the surface of optics and camera lens design, but even the most complex systems end up serving the same purpose: to tell light where to go. In some sense optical engineering is all about taming the nature of light.
The simple act of pressing the shutter button in a camera app on a smartphone or on the body of a high-end DSLR is effortless, but it’s at this moment when, through carefully guided rays hitting an array of photodetectors, we immortalize reality by painting with light.