## The Introduction

Recently, I’ve been doing a bit of extra research into exposure in the context of physically based rendering. Primarily, I was looking to strengthen my understanding of the underlying concepts and values involved. This post can perhaps be described as a diary and something of an explainer? Either way, here we go!

## The Intuition

When we want to capture a scene with some lights involved, we will likely end up capturing surfaces with luminance values far above 1. If we were to simply take these values and output them to our screen, it is likely you might end up with a scene that is primarily white. Unless your desired aesthetic is completely blown out lighting, this is likely not desirable. To handle these values and remap them to a more acceptable range you might want you camera to adjust to the brightness of the scene in order to translate the brightness of your scene from 0->VeryBright to something more reasonable.

To achieve this you could simply find the brightest point in your scene, and remap every value with . Unfortunately, this means that if you have a small surface in your scene with a brightness of 1000 and the rest of your scene in the range of 0->10, the majority of your scene will have a brightness of 0.01! Perhaps this is your desired aesthetic but I will assume that it is not.

There is a huge amount of possibility here (maybe there’s some neat new ideas that could make for some very cool looks!), however for this post we will use the approach described in [1]. This approach makes use of the scene’s average luminance to determine the maximum luminance that we want to allow for our capture. As a result, all values above this maximum luminance will have values above 1 and will become pure white while our other values will be remapped to values between 0 and 1.

To do this, we can convert our average luminance to our desired maximum luminance with (Where we get this formula will be explained in time). This approach is informed by Saturation Based Sensitivity and we will use it’s concepts to reach this formula (and others like it).

Saturation Based Sensitivity assumes that our camera will reach maximum brightness when the luminance reaching the camera from a surface is 41% brighter than a 100% reflective Lambertian surface (a total reflectivity of 141%). This allows for specular highlights to retain some detail instead of being washed out in perfectly white surfaces.

141% in this case is chosen using Exposure Values which are a unit of brightness largely used in photography. Exposure Values or EV represent values that grow exponentially. Where an EV of 2 is twice as bright as an EV of 1. 141% is the brightness of half an EV (or a “half-stop”). This can be derived by noting that EVs can be converted to brightness with the formula . For half an EV, we can see that our brightness would be (I use brightness here ambiguously, as EVs aren’t necessarily a scientific unit and this conversion depends on some additional camera parameters that I will not be touching on yet.)

With this in mind, Saturation Based Sensitivity calibrates our sensor so that when a middle grey card (an 18% reflective Lambertian surface) is illuminated in our scene we can determine our maximum luminance reaching the camera as .

For future equations, we will reference “LuminanceAtCamera” as ( for MiddleGreyLuminanceAtCamera). This is often known as Luminous Exposure which is luminance arriving at our camera sensor modulated by our various camera parameters.

Now that we can determine our maximum luminous exposure from our middle grey exposure with , we need a way to take our average luminance and turn it into our middle grey luminous exposure.

## The Derivation

To begin, we note that we can relate luminance to luminous exposure with:

(1)

Where is our lens and vignetting attenuation [1][2], is our shutter time, controls our aperture width and is our luminance.

Additionally, we note that we can also calculate our middle grey exposure with:

(2) [2]

Where is our camera sensitivity.

And finally, we can relate our average luminance to our camera sensitivity with:

(3)

Where is our calibration constant [1][5]. We can rearrange this question for as:

(4)

If we equate (1) and (2)

And substitute (4)

Solving for we get

And using and [1]

(5)

As a result, we can see that our middle grey luminance is equal to 1.23 times our average scene luminance.

Finally, we can use this relationship to derive our maximum luminance with:

Replacing with (1)

Substituting with (5) we get

And there you have it! We now have our maximum luminance from our average luminance.

Another approach to deriving the maximum luminance from average luminance can be seen with [1].

Following the steps outlined in the document we get:

Which we then substitute with (1)

Solving for

We can substitute with (3):

[1] assuming and we get:

However a piece that gives me pause in this derivation is the use of:

Where does that 78 come from?

The ISO standard dictates that

Since with Saturation Based Sensitivity we can derive that:

Therefore the 78 results from the relationship between middle grey luminous exposure and maximum luminous luminous exposure set by Saturation Based Sensitivity.

## The Conclusion

I find it particularly amusing how you can reach the same results from various directions in math. With this post complete, I feel far more comfortable dealing with exposure and hopefully this has provided some insights into the various formulas and values in play when dealing with exposure.

As a side note, when writing this post, I got particularly confused about the difference between , and . Originally believing that which led to some very strange results.

If you believe that you end up believing that . And as a result, taking and turning it into which becomes Which completely disagrees with our conclusion that ! I thought I was going mad…

Thankfully my coworker Bruno (@BruOps) pointed out my mistake to me. (Thanks Bruno! Also thanks to my coworker Thomas Hill for dealing with me rambling about exposure for a week.)

In the next post, I will likely be working through the derivation for various Normal Distribution Functions as I’ve had the pleasure of working through the mathematics of it all and I find it particularly interesting! I’d recommend reading https://www.reedbeta.com/blog/hows-the-ndf-really-defined/ as it provided the foundation I needed to derive those functions. (Really my next post will likely just be a rehash of that post just formulated differently and with some intuitions I gathered along the way… seriously, go read it!) Maybe we’ll use it as an opportunity to make up some fun NDFs. Who knows!

## The References

[2] https://www.imatest.com/docs/sensitivity_ei/

[3] https://www.dpreview.com/forums/thread/4579986?page=2

[4] https://en.wikipedia.org/wiki/Film_speed#Saturation-based_speed

[5] http://www.yedlin.net/NerdyFilmTechStuff/ExposureEquationsAndMeterCalibration.html