<p>You have a lot of questions so let me take a shortcut and just try to explain how this is properly done (:</p>

<p>What you are interested in calculating is luminance (cd/m^2) for a pixel. A simple way you can do this is by using brute-force Monte Carlo integration over the hemisphere defined by the normal of a pixel, i.e. cast few thousand randomly distributed rays over the hemisphere. For each of those sample rays you evaluate the BRDF (1/sr) and multiply it with the luminance of the area light source the ray hits, or 0 if it doesn't hit anything. Sum up all these results and multiply by 2*pi/num_samples in the end, i.e. by the solid angle of each sample.</p>

<p>This operation gives you the the luminance for the pixel, which you then multiply by camera exposure factor to map to a proper range which you can tone map, i.e. calculate EV100 from camera aperture, shutter time and ISO-settings as follows:</p>

<pre><code>float ev100=log2((aperture*aperture/shutter_time)*100.0f/iso);
</code></pre>

<p>And then calculate exposure factor:</p>

<pre><code>float exposure_factor=1.2f*pow(2.0f, ev100);
</code></pre>

<p>For IES light profiles you can normalize the profile and modulate light luminance with the IES factor for the given direction the ray hits the light.</p>

CC BY-SA 3.0
2016-09-27T02:53:24.330Z
2016-09-27T02:53:24.330Z
JarkkoL
<p>So, I started writing my second raytracer - this time focusing on photometric rendering that uses IES lights and standard photometric units.  I've got the basic raytracing up and running (using pure geometry), I've read any article I could found on radio- and photometry (I think I developed an intuition for it) but the issues started when I tried to validate/play with the underlying math.</p>

<p>I use IES lights as a function of spherical coordinates that gives me the intensity of light in that direction in candelas (lumens per unit solid angle). Also in the equation for Luminance/Radiance there are differential solid angle and differential surface area. On the paper everything looks good, however:</p>

<p><strong>My question is</strong>: how should I deal with those parameters in my raytracer? I assume (but I'm not sure) that my (differential) solid angle is just a (unit) vector in descrete world and the surface area is simply a point - but what values should I plug in to those equations? I saw that on some websites that people just ignored those terms and replaced the integral with sum - but no explanation was given...</p>

<p>And my second question is related to those IES lights - how can I simply convert intensity to radiance? The intensity already has the solid angle, but for radiance I need the surface area... Or should I somehow integrate the luminious intensity to get luminious flux and then somehow calculate the radiance from that.</p>

<p><strong>EDIT:</strong> I decided to try to grab a sheet of paper, try again and share with you my thought process. In order to simplify a lot of things:</p>

<ul>
<li><p>each plane has a single scalar value as material (let's name it <em>reflectivity</em> between 0 and 1)</p>

<ul>
<li>$p1$ has $reflectivity = 0.5$</li>
<li>$p2$ has $reflectivity = 1$</li>
</ul></li>
<li><p>all materials are lambertian (no specular reflections nor emission)</p></li>
</ul>

<p>So with those in mind let's imagine that we have following scene:
<a href="https://i.sstatic.net/BRL0Y.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BRL0Y.png" alt="Example scene with 2 planes"></a></p>

<p><strong>Step 1 - Illuminance at $p1$</strong></p>

<p>The light luminious intensity at vertical angle $V=0$ is $I = 6619 [cd]$. In order to compute the illuminance at point $p1$ we can create a sphere with radius equal to the distance between the light and intersection point $p1$ which is $r = 2$ meters. That virtual sphere intersects with the first plane creating a small differential area $dA$. Knowing that $d\omega = \frac {dA}{r^2}$ we get $E_L(r) = \frac {I}{r^2} [ \frac {W}{m^2}]$ which is equal to illuminance measured at a plane perpendicular to light. We have to project it to know how many light hits the $p1$, so $E = E_L \times cos \theta$. I <strong>assume</strong> that $L_i = E$, but that is just a guess. I hope that at this point I got it right...</p>

<p><strong>Step 2 - Outgoing luminance</strong></p>

<p>In order to calculate the outgoing radiance I think that is the place for the rendering equation to kick in:
$$
L_o = L_e + \int_{\Omega} f_r(\omega_i, \omega_o) L_i(p, \omega_i) cos \theta d\omega
$$
since I ignore the emission and my BRDF is $f_r(\omega_i, \omega_o) = \frac {reflectivity}{\pi}$ which is constant across the integral giving me:
$$
L_o = \frac {reflectivity}{\pi} \int_{\Omega} L_i(p, \omega_i) cos \theta d\omega
$$
Now I have to discretize it, which I don't fully understand. Based on my notes that I've made based on many pages I've got:
$L_o = \frac {reflectivity}{\pi} \sum L_i(p, \omega_i) cos \theta \Rightarrow L_o = \frac {0.5}{\pi} L_i cos \theta$, where $L_i$ was calculated in step 1</p>

<p><strong>Step 3 - Luminance at $p2$</strong></p>

<p>Can I assume that $L_{i_{p2}} = L(p_1 \rightarrow p_2) \times cos \theta = L_{o_{p1}} \times cos \theta$ ? I'm not sure if I have to apply the $cos \theta$ twice (for outgoing and incoming $dA$s).</p>

<p><em>I also would like to apologize for making this question sooo long - but I had never taken any course that would introduce radiometry and I was forced to (try to) learn it by myself.</em></p>

CC BY-SA 3.0
2016-09-12T15:17:37.053Z
If you don't get good answers, graphicscodex.com talks about these things.
Alan Wolfe
<raytracing><lighting>
Solid angle and surface area values in (photometric) raytracing
George Wilson
# Solid angle and surface area values in (photometric) raytracing

(Asked by: username_0 on 2016-09-12)

So, I started writing my second raytracer - this time focusing on photometric rendering that uses IES lights and standard photometric units. I've got the basic raytracing up and running (using pure geometry), I've read any article I could found on radio- and photometry (I think I developed an intuition for it) but the issues started when I tried to validate/play with the underlying math.

I use IES lights as a function of spherical coordinates that gives me the intensity of light in that direction in candelas (lumens per unit solid angle). Also in the equation for Luminance/Radiance there are differential solid angle and differential surface area. On the paper everything looks good, however:

**My question is**: how should I deal with those parameters in my raytracer? I assume (but I'm not sure) that my (differential) solid angle is just a (unit) vector in descrete world and the surface area is simply a point - but what values should I plug in to those equations? I saw that on some websites that people just ignored those terms and replaced the integral with sum - but no explanation was given...

And my second question is related to those IES lights - how can I simply convert intensity to radiance? The intensity already has the solid angle, but for radiance I need the surface area... Or should I somehow integrate the luminious intensity to get luminious flux and then somehow calculate the radiance from that.

**EDIT:** I decided to try to grab a sheet of paper, try again and share with you my thought process. In order to simplify a lot of things:

* each plane has a single scalar value as material (let's name it *reflectivity* between 0 and 1)

  + $p1$ has $reflectivity = 0.5$
  + $p2$ has $reflectivity = 1$
* all materials are lambertian (no specular reflections nor emission)

So with those in mind let's imagine that we have following scene:
[![Example scene with 2 planes](https://i.sstatic.net/BRL0Y.png)](https://i.sstatic.net/BRL0Y.png)

**Step 1 - Illuminance at $p1$**

The light luminious intensity at vertical angle $V=0$ is $I = 6619 [cd]$. In order to compute the illuminance at point $p1$ we can create a sphere with radius equal to the distance between the light and intersection point $p1$ which is $r = 2$ meters. That virtual sphere intersects with the first plane creating a small differential area $dA$. Knowing that $d\omega = \frac {dA}{r^2}$ we get $E\_L(r) = \frac {I}{r^2} [ \frac {W}{m^2}]$ which is equal to illuminance measured at a plane perpendicular to light. We have to project it to know how many light hits the $p1$, so $E = E\_L \times cos \theta$. I **assume** that $L\_i = E$, but that is just a guess. I hope that at this point I got it right...

**Step 2 - Outgoing luminance**

In order to calculate the outgoing radiance I think that is the place for the rendering equation to kick in:
$$
L\_o = L\_e + \int\_{\Omega} f\_r(\omega\_i, \omega\_o) L\_i(p, \omega\_i) cos \theta d\omega
$$
since I ignore the emission and my BRDF is $f\_r(\omega\_i, \omega\_o) = \frac {reflectivity}{\pi}$ which is constant across the integral giving me:
$$
L\_o = \frac {reflectivity}{\pi} \int\_{\Omega} L\_i(p, \omega\_i) cos \theta d\omega
$$
Now I have to discretize it, which I don't fully understand. Based on my notes that I've made based on many pages I've got:
$L\_o = \frac {reflectivity}{\pi} \sum L\_i(p, \omega\_i) cos \theta \Rightarrow L\_o = \frac {0.5}{\pi} L\_i cos \theta$, where $L\_i$ was calculated in step 1

**Step 3 - Luminance at $p2$**

Can I assume that $L\_{i\_{p2}} = L(p\_1 \rightarrow p\_2) \times cos \theta = L\_{o\_{p1}} \times cos \theta$ ? I'm not sure if I have to apply the $cos \theta$ twice (for outgoing and incoming $dA$s).

*I also would like to apologize for making this question sooo long - but I had never taken any course that would introduce radiometry and I was forced to (try to) learn it by myself.*

**Tags:** raytracing, lighting

> **Comments:**
> **username_1**: If you don't get good answers, graphicscodex.com talks about these things.  

---

## 1 answers

### Answer by username_2 on 2016-09-27. Score: 3 | Accepted answer

You have a lot of questions so let me take a shortcut and just try to explain how this is properly done (:

What you are interested in calculating is luminance (cd/m^2) for a pixel. A simple way you can do this is by using brute-force Monte Carlo integration over the hemisphere defined by the normal of a pixel, i.e. cast few thousand randomly distributed rays over the hemisphere. For each of those sample rays you evaluate the BRDF (1/sr) and multiply it with the luminance of the area light source the ray hits, or 0 if it doesn't hit anything. Sum up all these results and multiply by 2\*pi/num\_samples in the end, i.e. by the solid angle of each sample.

This operation gives you the the luminance for the pixel, which you then multiply by camera exposure factor to map to a proper range which you can tone map, i.e. calculate EV100 from camera aperture, shutter time and ISO-settings as follows:

```
float ev100=log2((aperture*aperture/shutter_time)*100.0f/iso);

```

And then calculate exposure factor:

```
float exposure_factor=1.2f*pow(2.0f, ev100);

```

For IES light profiles you can normalize the profile and modulate light luminance with the IES factor for the given direction the ray hits the light.


---

