<p>You need to convert luminous flux (lumens, $lm$) to luminance ($\frac{lm}{m^2sr}$) for the <a href="https://en.wikipedia.org/wiki/Rendering_equation" rel="nofollow noreferrer">rendering equation</a>. For that you need to know the physical properties of the light source. For example luminance $L$ of spherical light source of radius $r$ radiating over $4\pi$ solid angle and luminous flux $\phi$ has luminance:
$$L = \frac{\phi}{4\pi^2r^2}$$
I think it's better to define lights straight using luminance instead of luminous flux though since you can simply measure luminance with spot meter instead of using <a href="https://en.wikipedia.org/wiki/Luminous_flux#/media/File:Luminance_Chamber.jpg" rel="nofollow noreferrer">cumbersome special equipment</a> or be limited by values provided by manufacturers in illuminant packaging.</p>

<p>Regarding distance attenuation, all lights in PBR should be area lights and there's no explicit attenuation formula for lights because the distance attenuation emerges naturally from the rendering equation.</p>

<p>It's also better use <a href="https://en.wikipedia.org/wiki/Category:Units_of_photometry" rel="nofollow noreferrer">photometric units</a> instead of <a href="https://en.wikipedia.org/wiki/Template:SI_radiometry_units" rel="nofollow noreferrer">radiometric units</a> for RGB-rendering (not spectral/monochromatic rendering). In photometric units the extraterrestrial sun luminance is ~1.9B cd/m^2 (don't try to measure sun with spot meter though!). If you want to use radiometric units, you need to take the <a href="https://en.wikipedia.org/wiki/Spectral_power_distribution" rel="nofollow noreferrer">spectral power distribution</a> of the sun and integrate that with <a href="https://en.wikipedia.org/wiki/CIE_1931_color_space" rel="nofollow noreferrer">CIE color matching functions</a> to get any reasonable values rendering.</p>

CC BY-SA 3.0
2017-08-27T04:32:43.977Z
2017-08-27T04:42:51.887Z
2017-08-27T04:42:51.887Z
JarkkoL
<blockquote>
  <p>How should I define the <code>radiance</code>, if I have a directional light, for example the sun?</p>
</blockquote>

<p>The radiance in physics has different definitions in different books. I will use the definition with irradiance and radiant flux here.</p>

<p>Imagine photons having some energy $Q$. Your <strong>radiant flux</strong> $\Phi$ is the amount of energy $Q$ (and therefore the amount of photons) per unit time $t$. To get the energy for an instant (an infinitesimally short time), you use the change ($\Delta$) of energy over the change of time for $\lim_{t\rightarrow0}$ i.e.</p>

<p>$$\Phi = \lim_{t\rightarrow0} \frac{\Delta Q}{ \Delta t} = \frac{dQ}{dt}$$</p>

<p>Energy is measured in Joules and time in seconds, therefore radiant flux is measured in $\frac{J}{s}$.</p>

<p>This however doesn't say anything about the surface you're measuring the energy at, but if you want to light an object, that needs to be taken into account.
Therefore, you define <strong>irradiance</strong> $E$ as your radiant flux per area $A$ (note that irradiance usually means energy arriving at an area, whereas <em>radiosity</em> is energy leaving the area, but is otherwise defined exactly the same way). Since some integrations later on are easier to do with infinitesimally small area patches, we go that route again, but I will not rewrite the limes stuff all the time.</p>

<p>$$E = \frac{d\Phi}{dA}$$</p>

<p>Note that it is assumed, that the photons' traveling direction is assumed to be perpendicular to the surface.
Irradiance is thus measured in $\frac{J}{sm^2}$.</p>

<p>To understand radiance, you need to understand solid angles. I will just assume that you do, otherwise read up on it, this is really an important concept for physically based lighting.</p>

<p>The problem with irradiance is, that you cannot take into consideration any directionality of the light. The directionality can be expressed through solid angles $\omega$, where an infinitesimally small solid angle $d\omega$ can be seen as a vector.</p>

<p>Imagine that you have a sheet of paper parallel to another sheet of paper, one emitting and one receiving light, both equal in size. You can express all you need with irradiance. Now let the emitting sheet of paper transform into your light bulb centered at where the emitting sheet of paper was before. All of a sudden, it makes a difference, if you measure the light at the corners of the receiving sheet of paper or at its center.</p>

<p>Therefore, to take directionality into account, you define <strong>radiance</strong> $L$ as the irradiance per solid angle of the light. $\omega$ is the solid angle and we want to use the infinitessimally small one again, thus $d\omega$.
$$L = \frac{dE}{d\omega}$$
Thus your radiance is measured in $\frac{J}{sm^2sr}$ where sr is the solid angle unit steradians and really is dimensionles. </p>

<p>Looking at the definitions of Watts it's $W = \frac{J}{s}$ , therefore radiance measurement can be seen as $\frac{W}{m^2sr}$.</p>

<p><strong>Edit 04th of August 2017:</strong>
The radiance in the end is exactly what you calculate as a pixel's color, it is what you see. In the real world, it is wave length dependend, but of course in computer graphics it is an RGB color vector. Therefore, <strong>you don't define radiance, you calculate it.</strong></p>

<blockquote>
  <p>What should the <code>lightColor</code> be, if the light source is a 60W lightbulb (780 lm) and in my scene one unit is one cm?</p>
</blockquote>

<p>Light usually uses different wave lengths lambda which determine the color of the light. For example, imagine a photon of red light, i.e. $\lambda=700nm$ , then it has the energy of $\frac{hc}{\lambda}$ where $h$ is Planck's constant and $c$ is the speed of light, leading to about $2.838\times10^{-19}J$ for this red photon.</p>

<p>If your light bulb "uses" just one single wave length and is a $60W=60\frac{J}{s}$ light bulb, then you can calculate the energy, radiant flux, irradiance and finally radiance... If you know the exact spectral emission, you can also calculate this.
However, that is probably not really what you are looking for.</p>

<p><strong>Edited 04th of August 2017:</strong>
Therefore, your (or rather the tutorials code) to calculate radiance is an oversimplified way of modeling the lightsource.  It does not take into account the power of the light source directly, it is just modelled by a color vector.</p>

<hr>

<p>What the tutorial is asking you to do is to think of the color you want your light to be, and write down the RGB value for it. If your light is just white, use an RGB value of (1,1,1), try it in your scene and if you then think it's too bright, lower the values until you're satisfied (or increase them, if it's not bright enough).</p>

<p><strong>Edited 04th of August 2017:</strong>
If you want to use the physically based light bulb, then you will need to take more into account and I'd really advice you to read up on this.
A good book for this is Physically Based Rendering (by Matt Pharr et al.). 
As that is expensive and takes a long time to read, you can also try to get along with some of the Physically Based Shading course materials of previous years, to be found <a href="http://blog.selfshadow.com/archives/" rel="nofollow noreferrer">on the Selfshadow Blog</a>. Especially, there is some explanation on Sebastien Lagarde's <a href="https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf" rel="nofollow noreferrer">Moving Frostbite to Physically Based Rendering</a></p>

<p>On a side note, the sun is usually modeled as being so distant to the receiver of the light, that you don't take attenuation into account. Thus you would just multiply by the light color (or set the attenuation to 1).</p>

CC BY-SA 3.0
2017-08-04T21:42:26.160Z
Thank you for the long explanation. "try it in your scene and if you then think it's too bright, lower the values until you're satisfied": The whole purpose of PBR is to not just look good, but follow the laws of physic to get the result. I am looking for (linear) RGB values and intensities, which I can use to display a scene with daylight, or with lamps. But at the moment I can not put lights in that scene, because I have no idea, which color and intensity values would be realistic in the `radiance = lightColor * intensity * attenuation` equation
Iter Ator
CC BY-SA 3.0
2017-08-06T08:45:06.650Z
@IterAtor, sorry, I assumed you were looking to understand the rendering method rather than a translation of the real world to simulation (or as close as possible).

As far as I can see it, the color (in PBR) is usually determined by the luminous intensity and the temperature. Chapter 4 in the Frostbite notes explains this. Note that this is perception based.
Another way to get the color is with CIE color matching and the spectral emission of the light.

I really advice to look into the Frostbite notes, I don't think I can give you a better explanation than they delivered already.
Tare
CC BY-SA 3.0
2017-08-03T09:46:45.640Z
2017-08-17T14:06:14.830Z
2017-08-17T14:06:14.830Z
Tare
<p>I would like implement physically based rendering, following <a href="https://learnopengl.com/#!PBR/Lighting" rel="noreferrer">this tutorial</a></p>

<p>I was able to find a <a href="https://en.wikipedia.org/wiki/Orders_of_magnitude_(luminous_flux)" rel="noreferrer">list of light sources ordered by lumens</a>, but I have no idea how to use it in the calculations.</p>

<pre><code>float attenuation = 1.0 / (distance * distance);
vec3 radiance = lightColor * attenuation;
</code></pre>

<p>What should the <code>lightColor</code> be, if the light source is a 60W lightbulb (780 lm) and in my scene one unit is one cm?</p>

<p>How should I define the <code>radiance</code>, if I have a directional light, for example the sun?</p>

CC BY-SA 3.0
2017-08-30T20:56:05.283Z
The Colour of a 60w light source can be any colour, it depends on its wavelengths. For a white colour light source "it cannot consist solely of the green light to which the eye's image-forming visual photoreceptors are most sensitive, but must include a generous mixture of red and blue wavelengths, to which they are much less sensitive."
ali
<opengl><lighting><physically-based><pbr><radiosity>
How to calculate attenuation and radiance in PBR? (point and directional lights)
Iter Ator
# How to calculate attenuation and radiance in PBR? (point and directional lights)

(Asked by: username_0 on 2017-08-02)

I would like implement physically based rendering, following [this tutorial](https://learnopengl.com/#!PBR/Lighting)

I was able to find a [list of light sources ordered by lumens](https://en.wikipedia.org/wiki/Orders_of_magnitude_(luminous_flux)), but I have no idea how to use it in the calculations.

```
float attenuation = 1.0 / (distance * distance);
vec3 radiance = lightColor * attenuation;

```

What should the `lightColor` be, if the light source is a 60W lightbulb (780 lm) and in my scene one unit is one cm?

How should I define the `radiance`, if I have a directional light, for example the sun?

**Tags:** opengl, lighting, physically-based, pbr, radiosity

> **Comments:**
> **username_1**: The Colour of a 60w light source can be any colour, it depends on its wavelengths. For a white colour light source "it cannot consist solely of the green light to which the eye's image-forming visual photoreceptors are most sensitive, but must include a generous mixture of red and blue wavelengths, to which they are much less sensitive."  

---

## 2 answers

### Answer by username_2 on 2017-08-27. Score: 2

You need to convert luminous flux (lumens, $lm$) to luminance ($\frac{lm}{m^2sr}$) for the [rendering equation](https://en.wikipedia.org/wiki/Rendering_equation). For that you need to know the physical properties of the light source. For example luminance $L$ of spherical light source of radius $r$ radiating over $4\pi$ solid angle and luminous flux $\phi$ has luminance:
$$L = \frac{\phi}{4\pi^2r^2}$$
I think it's better to define lights straight using luminance instead of luminous flux though since you can simply measure luminance with spot meter instead of using [cumbersome special equipment](https://en.wikipedia.org/wiki/Luminous_flux#/media/File:Luminance_Chamber.jpg) or be limited by values provided by manufacturers in illuminant packaging.

Regarding distance attenuation, all lights in PBR should be area lights and there's no explicit attenuation formula for lights because the distance attenuation emerges naturally from the rendering equation.

It's also better use [photometric units](https://en.wikipedia.org/wiki/Category:Units_of_photometry) instead of [radiometric units](https://en.wikipedia.org/wiki/Template:SI_radiometry_units) for RGB-rendering (not spectral/monochromatic rendering). In photometric units the extraterrestrial sun luminance is ~1.9B cd/m^2 (don't try to measure sun with spot meter though!). If you want to use radiometric units, you need to take the [spectral power distribution](https://en.wikipedia.org/wiki/Spectral_power_distribution) of the sun and integrate that with [CIE color matching functions](https://en.wikipedia.org/wiki/CIE_1931_color_space) to get any reasonable values rendering.


---

### Answer by username_3 on 2017-08-03. Score: 2

> How should I define the `radiance`, if I have a directional light, for example the sun?

The radiance in physics has different definitions in different books. I will use the definition with irradiance and radiant flux here.

Imagine photons having some energy $Q$. Your **radiant flux** $\Phi$ is the amount of energy $Q$ (and therefore the amount of photons) per unit time $t$. To get the energy for an instant (an infinitesimally short time), you use the change ($\Delta$) of energy over the change of time for $\lim\_{t\rightarrow0}$ i.e.

$$\Phi = \lim\_{t\rightarrow0} \frac{\Delta Q}{ \Delta t} = \frac{dQ}{dt}$$

Energy is measured in Joules and time in seconds, therefore radiant flux is measured in $\frac{J}{s}$.

This however doesn't say anything about the surface you're measuring the energy at, but if you want to light an object, that needs to be taken into account.
Therefore, you define **irradiance** $E$ as your radiant flux per area $A$ (note that irradiance usually means energy arriving at an area, whereas *radiosity* is energy leaving the area, but is otherwise defined exactly the same way). Since some integrations later on are easier to do with infinitesimally small area patches, we go that route again, but I will not rewrite the limes stuff all the time.

$$E = \frac{d\Phi}{dA}$$

Note that it is assumed, that the photons' traveling direction is assumed to be perpendicular to the surface.
Irradiance is thus measured in $\frac{J}{sm^2}$.

To understand radiance, you need to understand solid angles. I will just assume that you do, otherwise read up on it, this is really an important concept for physically based lighting.

The problem with irradiance is, that you cannot take into consideration any directionality of the light. The directionality can be expressed through solid angles $\omega$, where an infinitesimally small solid angle $d\omega$ can be seen as a vector.

Imagine that you have a sheet of paper parallel to another sheet of paper, one emitting and one receiving light, both equal in size. You can express all you need with irradiance. Now let the emitting sheet of paper transform into your light bulb centered at where the emitting sheet of paper was before. All of a sudden, it makes a difference, if you measure the light at the corners of the receiving sheet of paper or at its center.

Therefore, to take directionality into account, you define **radiance** $L$ as the irradiance per solid angle of the light. $\omega$ is the solid angle and we want to use the infinitessimally small one again, thus $d\omega$.
$$L = \frac{dE}{d\omega}$$
Thus your radiance is measured in $\frac{J}{sm^2sr}$ where sr is the solid angle unit steradians and really is dimensionles.

Looking at the definitions of Watts it's $W = \frac{J}{s}$ , therefore radiance measurement can be seen as $\frac{W}{m^2sr}$.

**Edit 04th of August 2017:**
The radiance in the end is exactly what you calculate as a pixel's color, it is what you see. In the real world, it is wave length dependend, but of course in computer graphics it is an RGB color vector. Therefore, **you don't define radiance, you calculate it.**

> What should the `lightColor` be, if the light source is a 60W lightbulb (780 lm) and in my scene one unit is one cm?

Light usually uses different wave lengths lambda which determine the color of the light. For example, imagine a photon of red light, i.e. $\lambda=700nm$ , then it has the energy of $\frac{hc}{\lambda}$ where $h$ is Planck's constant and $c$ is the speed of light, leading to about $2.838\times10^{-19}J$ for this red photon.

If your light bulb "uses" just one single wave length and is a $60W=60\frac{J}{s}$ light bulb, then you can calculate the energy, radiant flux, irradiance and finally radiance... If you know the exact spectral emission, you can also calculate this.
However, that is probably not really what you are looking for.

**Edited 04th of August 2017:**
Therefore, your (or rather the tutorials code) to calculate radiance is an oversimplified way of modeling the lightsource. It does not take into account the power of the light source directly, it is just modelled by a color vector.

---

What the tutorial is asking you to do is to think of the color you want your light to be, and write down the RGB value for it. If your light is just white, use an RGB value of (1,1,1), try it in your scene and if you then think it's too bright, lower the values until you're satisfied (or increase them, if it's not bright enough).

**Edited 04th of August 2017:**
If you want to use the physically based light bulb, then you will need to take more into account and I'd really advice you to read up on this.
A good book for this is Physically Based Rendering (by Matt Pharr et al.).
As that is expensive and takes a long time to read, you can also try to get along with some of the Physically Based Shading course materials of previous years, to be found [on the Selfshadow Blog](http://blog.selfshadow.com/archives/). Especially, there is some explanation on Sebastien Lagarde's [Moving Frostbite to Physically Based Rendering](https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf)

On a side note, the sun is usually modeled as being so distant to the receiver of the light, that you don't take attenuation into account. Thus you would just multiply by the light color (or set the attenuation to 1).

> **Comments:**
> **username_0**: Thank you for the long explanation. "try it in your scene and if you then think it's too bright, lower the values until you're satisfied": The whole purpose of PBR is to not just look good, but follow the laws of physic to get the result. I am looking for (linear) RGB values and intensities, which I can use to display a scene with daylight, or with lamps. But at the moment I can not put lights in that scene, because I have no idea, which color and intensity values would be realistic in the `radiance = lightColor * intensity * attenuation` equation  
> **username_3**: @username_0, sorry, I assumed you were looking to understand the rendering method rather than a translation of the real world to simulation (or as close as possible).  As far as I can see it, the color (in PBR) is usually determined by the luminous intensity and the temperature. Chapter 4 in the Frostbite notes explains this. Note that this is perception based. Another way to get the color is with CIE color matching and the spectral emission of the light.  I really advice to look into the Frostbite notes, I don't think I can give you a better explanation than they delivered already.  

---

