Understanding Photometric and Radiometric units and their application to computer graphics

(Note: This post is 1st draft and will be updated and probably gain some figures and images, probably of gnomes.)

Or: "How to understand photo- and radiometry using only gnomes with basketballs"

Photometry. Ah.

The word alone have many people running for the hills. Going to the fine Wikipedia page in the subject isn't likely to clear things up much. Why so many units, why so confusingly similar, yet different, and how many candela is one lux anyway?

Even I - and I worked with this professionally for years - had to have this stuff gnawing on my brain for quite a while until I finally grokked it all.

I think a good 90% of the explanations out there simply lacks the ability to visualize the problem, or they start on a way too high level, mathematically speaking.

So we'll gonna make this really simple, and we're going to use gnomes and basketballs. But first we're gonna talk to per, and kick a candela out of the house.

Talking to our friend "Per"

If you ventured to the wikipedia page you've seen that many of the photo- and radiometric units is expressed in a this-per-that fashion (cd/m^2, lm/sr) ... lets let the meaning of this sink in, and lets take a familiar example to let it sink in.

Many people ask things like "how many candelas go in one lux", when the question has no answer. "But it's all light" people grumble.

Well, yeah, but It's like asking "how many miles goes into 20 miles per hour" - it absolutely makes no sense without additional information.

To fully understand this, we must study what we mean by saying "per" something. And lets take something familiar - speed - i.e. "miles per hour".

Location A and location B is 100 miles apart.

How many miles per hour? Well, we can't know yet. We need more information.

Ted drives the distance in two hours.

How many miles per hour? Well, now we can calculate it, but it'll be an average: 50 miles per hour.

However, Ted may have been at a rest stop for one hour, and drove the other hour at 100 miles per hour, and still make the same result. We don't know yet.

So while in one sense we can see "miles per hour" as an average, we can also, in a sense, see it as a miles as a function of time (hours).

I.e. one way to interpret "miles per hour" is to say that "how many miles had ted travelled at time T"?

The same goes for the photometric units. For example, lumen (lm) is a measure of power, but power going off in all directions. However lumens per steradian (lm/sr) is a measure of how many lumens go in a particular direction (Steradians is a measurement of an angle in 3D space).

Keeping this interpretation of "per" in mind, makes things a lot easier, and makes it easier to understand that just because you know the lumens, you do not necessarily know the lumens-per-steradian. Sure, you can infer an average, just like we did with Ted's speed, but without actual values, we can not say that there is a certain amount of lumen going in some particular direction.

If we do have values, however, conversions are possible, because just like you could measure Ted's speed every second of his journey, and sum up the distance Ted travelled that particular second, the result for the whole journey will be the distance travelled for the whole journey, so does the various lumen-per-steradian (lm/sr) measurement in all directions sum up (or, technically, the term is "integrate") to the total amount of lumens (lm)!

With us so far. Okay. Lets kick out a friend and explain why.

Kicking the Candela

Photometry and Radiometry is very much related. We'll get to exactly why further down, but lets make things simple for now, and say that the lumen (lm) and the Watt (W) are linked. If you know the spectra of the light, you can actually convert one into the other with a simple number, called the luminous efficacy. Whoah. Big word there. The key in that sentence was "know the spectra", though, since the efficacy is different for different spectra. But we'll get to that.

For now, just pretend the lumen and Watt are pretty much interchangeable. A good memory rule for this is that the luMen contains an M and an upside-down M looks like a W.

Now, a unit used a lot in photometry is the candela (cd). A candela is simply a lumen-per-steradian. We'll get to what that means in a second, but if you guessed "light in a particular direction" you are not far off.

The point is that even though cd is well used unit, it is more confusing to understand the units if we use it. It is actually much easier to understand the whole thing if we keep talking about lumens. Then, when it all sunk in, simply learn "cd = lm/sr" and you'll be golden.

A second reason is that on the radiometry side, there is no special unit for the equivalent watts-per-steradian. This makes the radiometry and photometry appear different when they really are not.

No, radiometry and photometry work the same way, it's just about how you weight your measurements. Simplified, Radiometry is about how much radiation (for example light, but not necessarily) there is. Photometry is about how much actual light there is, and how bright it appears to us humans.

So for now we'll just talk about photometry, but with the candela on vacation.

Sounds fair? Okay, lets introduce the gnomes with the basketballs.

How Gnomes Clarify Everything

Instead of talking abstractly about watts, photons, and whatnot, we'll use some much more imaginative imagery, just because it's more fun that way. If you ever find photometry boring, think of gnomes throwing basketballs, and all will clear up.

Imagine a candle flame. But instead of it emitting photons like in the real world, it's made up of a whole bunch of small gnomes, and each of the gnomes has a magic backpack of never ending basketballs. The gnomes grab basketballs out of their magic backpack, and throw them in all directions. Lets say the flame of the candle is about an inch high, so these are really small gnomes, and the basketballs are to scale.

Now if there is a hundred gnomes, each throwing ten basketballs per second in some random direction, this means that from this candle flame, a total of 1000 basketballs per second are thrown. (Also know this is done in zero gravity, so there is no basketball pile on the floor to worry about, basketballs travel in a straight line until hitting something).

So, the amount of basketballs leaving the entire light per second is 1000. To make this easy, lets leave out the "per second" part, and just consider a certain second of time... lets pretend the gnomes are only actually throwing for one second, and then stop, so we can concentrate on the number of basket balls and don't have to say "per second" all the time. It also saves me typing. I'm lazy that way.

Luminous flux (or power)

That which what we just measured is the luminous flux, or luminous power, in lumen. (Little Underground MEN throwin basketballs for one second, perhaps?). It was, to recap, the total amount of basketballs, from the entire light source (the entire candle flame, all 100 gnomes).

Many people are surprised by the fact that the lumen doesn't change by distance, having learned in school that light falls of by a "distance squared" rule.

This can be understood, because to "capture" a lumen (i.e. know how many basketballs in total are thrown) we would, in principle, have to put a bag around the whole contraption, capture the basket balls, and count them. No matter if we put the bag near, or far, the total gathered over this one second will be 1000. (The size of the bag will be different, though.)

But this was a total measurement. The whole light, in all directions. Lumen. Mkay.

Luminous emittance

What about light not leaving the entire candle, but a particular point on the candle? If the lumen measurement was a total for the whole candle, what about the amount of light per unit of area?

This is the luminous emittance, and is measured in lm/m^2 (lumen per square meter). Simplified, you can think about this as a measurement of how much basketballs one particular gnome is throwing, but in all directions at once.

Imagining a contraption to measure luminous emittance is difficult; You would have to rig up some form of sphere of sensors that exists in absolutely every direction, but yet only aim at one tiny point (one gnome). It's also not of such a large practical use.

Luminous intensity

Instead of considering what a particular gnomes i throwing, lets instead turn to which direction the gnomes are throwing the basketballs.

If we only care about the basketballs thrown due north (but by any gnome), we are concerned about the luminous intensity of the candle. I.e. the entire candle emits a certain amount of light in a particular direction.

The unit for this is lumens per steradian (lm/sr). Now since steradians is a measure of angle in space (if you imagine a normal flat 2D angle as a infinite triangle, imagine the steradian as an infinite cone).

Since any basketballs that started out going in a particular direction will continue to do so, any basketballs that were within this given angle when they started, will be within this given angle until they hit something.

So again, surprising to many, the luminous intensity does not change by distance! This can be trivially understood by a laser, which is basically a ruby crystal full of gnomes that are highly trained and throw their basketballs in exactly the same direction. The intensity of the laser ray is the pretty much the same for its entire length (although in reality it gets absorbed, scattered, and is never perfectly parallel to begin with etc, all of which we are ignoring here).

So: Luminous intensity is any basketballs in a given direction, and is measured in lm/sr (lumen per steradian). And yes, this is the "Candela" unit that we are ignoring for now, because when we write it as lm/sr it's much easier to remember that it is really 'light from some object in a given direction')


Now remember how we contrasted the flux and the emittance as the former being from the "whole light" and the latter from a point?

The relationship between intensity and luminance is the same.

This is not just how may basketballs are thrown due north by all the gnomes. It's about how many basketballs are thrown due north by one particular gnome, i.e. "per unit surface area".

Since the "all gnomes in one direction" was lm/sr (lumen per steradian) the "one gnome in one direction" obviously is "lm/sr/m^2" (lumen per steradion per square meter).

Since we now understand the notation (and are avoiding the confusing "candela" unit) we understand that this means 'light from some point going in some given direction'. "How many basketballs is gnome 39 throwing due north"?

Amusingly, and still shocking to many people is that this unit too is stubbornly unaffected by distance. If something is a certain number of lm/sr/m^2, it is that at any distance.

But - I hear you yell - my mom told me when I was three that "light from a point source falls off by the square of the distance to the point source". Was mom lying?

No, she wasn't. Except of course that there is no such thing as a point source. Lets talk about


Now it starts to get interesting!

Lets stop for a second to think about those gnomes throwing the basketballs, and considering where these basketballs actually end up.... on some surface.

Illuminance is simply how many basketballs that hit a surface, from any old direction, over some given area. Since "basketballs in any old direction" was lumen, "basketballs in any old direction over some area" is lm/m^2 (lumen per square meter).

"Hey wait", you say, wasn't that "luminous emittance"?

Yes. True. The unit works out to the same, but the meaning is different (light is coming in, not going out). And while the emittance was pretty much useless and hard to measure, the illuminance is extremely useful and easy to measure:

- Draw a square meter
- Wait one second
- Count the basketballs
- Done.

As a matter of fact, this unit is so terribly useful they gave it their own name too. It's called "lux" (lx). But we'll stick with lm/m2 for simplicity, to remember that it's "basketballs in any direction, per unit area".

This is what you generally measure with your run of the mill light meter. Lux meters are readily available and used for a lot of things.

And now, finally, we are starting to get into the distance dependency.

The amount of lm/m^2 (= lux) received from some light depends on the distance to the light together with the lights emission profile.

"Ah" you say, "this is where the distance squared" comes in?

Yes. And... no.

Remember our laser? It most certainly won't follow the distance-squared rule, even when measured as illuminance, because it's light rays are (for all practical purpouses) parallel.

Same goes for light that come from a light that is - for practical purpouses - infinitely far away, which would include the sun.

"But" I hear you yell, "what about this distance squared thing"?

Well.... imagine a point light source. All gnomes, sitting throwing basketballs in exactly the same spot (those 100 gnomes will have it very very crowded). This means that all the basketballs will start at the same point, and fly in straight lines outwards.

Remember that figuring out the lm/m^2 (lux) was easy? Draw a square meter, wait a second, count the balls?

So lets draw a square meter on a wall one meter from our point light. A certain number of basketballs will hit it. Now lets move the light one more meter away. Since the basketballs all diverge from a central point, the basketball density will change as they move away from the light.

A square meter at double the distance will be hit by much less basket balls. As a matter of fact, it will - being 2 times further away . be hit by exactly 4 times fewer basketballs. Yes... distance squared... finally!

But please note this was only exactly true for a light that
- started in an infinitely small point
- emitted light exactly the same amount in every direction

Anything else is more complicated than that but can often be adequately approximated by a "distance squared" rule.

But lights are not infinitely small points, so there must be a different way to look at this?

Yes - there is.

Remember, "illuminance" was the amount of basketballs coming from all possible directions that hit a particular area, i.e. lm/m^2.

So, what if we summed up all the basketballs coming from all possible directions?

This would mean that we would have to look in every particular direction, look at the incoming light from that particular direction, and go over all possible directions and construct the sum (technically, the "integral") of it all.

Okay, so what is 'light from a particular direction' in this context? Is it the luminous intensity or the luminance? Both were "light in a direction"?

Well, we have to keep in mind that we are sitting at some given point, looking around. At every particular direction we look, we see some particular point on some object, which may or may not emit some light.

This means that what we are interested in is the light in a particular direction from a particular point. That was "Luminance", i.e. lm/sr/m^2 (luminous intensity was from the entire light, not just a point on it).

So we look in every possible direction. Most directions will see nothing, and some of those directions will see the candle flame. Now we said that our candle flames luminance was unaffected by distance. However, the distance to the candle flame makes it bigger (closer) or smaller (further). I.e. if it is closer, the candle flame covers more possible directions. The ratio of directions in which we see nothing to directions in which we see candle flame changes. So even though each particular "look" at the candle flame sees the same luminance, disregarding how close and far it would be, the number of "looks" that see it is much larger when closer!

(In tech speak, the closer object subtends a larger solid angle.)

This is what actually causes falloff from a lightsource. And funnily, for most moderate distances, an object twice as far away will show an area (subtend a solid angle) that is four times as small.... so the "distance squared" rule still holds as a good approximation!

Ergo: The illuminance at a point is created by integrating the luminances from all possible directions. For a flat surface, "all possible directions" is bound by a hemisphere above the surface (since the surface itself blocks the other hemisphere).

Now how do you look up "all possible distances" practically? There is an infinite number of them!!

Well, in a rendering context, such as, for example, mental ray's "final gathering", you do not look up an infinite number of directions, but you look up a set number of directions (this is what the finalgather ray count is!).

So final gather rays look around the scene and look for luminance samples, by simply probing the scene.

For direct light, the illuminance is calculated directly based on the lights luminous intensity (number of basketballs from the whole light in a given direction) and the distance-squared rule, because that is easier and more accurate for the renderer to do it that way.

So what about Radiometry, then?

All the photometric units (when expressed using lumen, and ignoring candela) has exact equivalents in radiometry, i.e. we have:

Radiant flux: W
Radiant exitance: W/m^2
Radiant intensity: W/sr
Radiance: W/sr/m^2
Irradiance: W/m^2

The principle is the same, and the basketball analogies work the same. As a matter of fact, the basketball analogy works even better on radiometry, and here's why:

There are different types of balls (wavelengths). There are balls filled with lead, so they are extremely heavy. And there are balls filled with helium, so they weigh nothing at all.

Radiometry is like we are counting the balls.

Photometry is like we are weighing the balls on a scale.

In Radiometry, a ball is a ball is a ball. In Photometry, it may be a heavy ball (green), a light ball (deep red), or a ball of no weight whatsoever (infrared or ultra violet).

... and finally bringing the Candela back

Also, as noted above lm/sr is the same as a candela. Generally, the units lm/sr are written as "cd" and lm/sr/m^2 as "cd/m^2", the latter being a value you probably hear a lot of as luminance measurement of all sorts of things. If you just keep in mind that "cd" means "lm/sr", you know now what that actually means. (Yes, basketballs from a particular point thrown in a given direction)

So what is computer graphics? Radiometry, or Photometry

Amusingly, it is both.

If you take a standard RGB color, you can see each of the R, G and B components as radiometric, but if you calculate the total intensity of the color (which are generally weighted at 21% red, 72% green and 7% blue) is photometric.

I.e. if you consider the white color (1 1 1) to have the intensity "1", then that intensity if photometric. (Had it been radiometric, the intensity of color (1 1 1) would have been considered 3).

Conversely, the actual R, G and B component can be considered radiometric.

Since a pixel value on screen can be considered a measurement of the light from a particular direction coming from a particular point, it means that a pixel value is a luminance (and each of the R, G and B values are radiances).

So the total value of the pixel will have some relation to an actual lm/sr/m^2 (= cd/m^2) value, and the value of each R, G and B component will have some relation to an actual W/sr/m^2 value.

The exact "conversion coefficient" depends on the application.

For 3ds max, the conversion factor between the total pixel value and the luminance in (cd/m^2) is the "physical scale" (found in the exposure control configuration) divided by PI.

Of course, the exposure control itself must be off or it will affect the pixel values. As a trick can be noted, that if you add an exposure control (but keep it disabled!) and set the physical scale to PI (3.1415) and render to a floating point frame buffer, the total pixel values reported when you right click on them (by the "Mono:" heading) are in cd/m^2.



thebogdan said...

Very, extremely easy to understand approach! Why don't others write their lessons/tutorials so clearly? Thanks a bunch!

Rockin Horea said...

Thanks! Until now the exposure control's "physical scale" parameter confused me, but I'll give it another try with the user reference now;) It's really hard to find good info about these things, so thanks again Master Zap!

Unknown said...

Awesome, very very very appreciated abuse of gnomes !Just wrote an abstract and sent it around to our TDs ;)

Simmi said...

Hi Zap,

I've read your very comprehensive and amusing article about light units. Thanks a lot! Entertaining explanations of such dry topics are rare to find but they ease learning a lot!
Do you answer questions of stupid students about this topic, too? I still do have one about the sunlight:
You write that sunlight is an infinite light source on earth because human perception doesn't realize a falloff due to the huge distance. But what about (especially indirect) sunlight coming through a windwow? I've read in a book that each window is like a light source which illuminance falls off with the square of the distance. I think correctly it's just the approximation case of the square falloff, which you describe in your text. So I assume a window is a(n) (approximated) "square falloff light source" because it's just a hole in a room with 6 sides and because light can't come from all directions but just from the window(hole). This is just valid for indirect daylight, right? If direct sun rays reach a room through a window, THEY are still infinite and don't loose energy about the distance, right?
If not too confused would you say my thoughts are right?
In this case just answer "right, girl" and everything will be fine! :)



blipoids said...

Well I think simmi has an interesting point there...
Should it be more accurately to use a lower photon exponent when dealing with direct sun light in interior shots?

Master Zap said...

But what about (especially indirect) sunlight coming through a windwow? I've read in a book that each window is like a light source which illuminance falls off with the square of the distance.

This is true because this is talking about illuminance from the sky, not the sun.

The sky has a certain luminance, the window exposes a certain amount of that luminance, i.e. a certain subtended solid angle (which is traditionally approximated with the distance-squared rule).

If actual sunlight came in through the window, then, no, it would not diminish by distance (unless the window had a subtended solid angle smaller than the sun disk itself, or occluded some of it).

This is just valid for indirect daylight, right?

...which would be "skylight", so, yes.

If direct sun rays reach a room through a window, THEY are still infinite and don't loose energy about the distance, right?


In this case just answer "right, girl" and everything will be fine! :)

Right girl!


Thomas Goddard said...

You rawk! Such an intuitive approach to learning.

chris r bernal said...

I was just reading about this concept in Mental Ray for Maya, 3ds Max, and Xsi. it was putting me to sleep.

This was much more enjoyable,

Glad I am digging through your older posts.


Unknown said...
This comment has been removed by the author.
Koonal Rajguru said...

Master Zap,
Thanks a lot for such a great tut on light units and its working in Real as well as in CG world.
Before reading this i was unable to understand, what exactly this units,etc means and i can say the Wikipedia thing is not very helpful in this way either.
If you don't mind, I have Posted this on my blog with untitle courtesy to you.
Hope you will create much more tutorial of such kind.
Once again thanks a lot.

Valiant said...

The trick with Exposure Control is:
use Active Linear Exposure Control with default settings (so no change to light values) but change the Physical Scale to 1.0

Now your RTT and Renders will store irradiance or emittance.

Change the Physical Scale to PI and you will get radiance.

Valiant said...

You could reduce confusion still further by explaining "in a direction" to mean "in a cone around the direction"

Master Zap said...

Nope, that actually increases confusion.

Just like the speed example, "30 minutes into my 100 mile drive I was 25 miles per hour" doesn't mean that the "25 miles per hour" measure is in a "timeslice around the 30 minute mark"... it's a point sample.

Completely contrary to your suggestion, I think the "cone" nonesense IS what is confusing. Thinking of it as a point-sample of a direction is much more relevant as a "mental picture" of what is going on.