# Calculating intensities of Virtual Point Lights in Instant Radiosity from IES lights

### Short introduction

I created a function that interpolates the IES luminious intensities (candelas) using Hermite interpolation, so in my code all light sources have $I(\theta, \phi)$ function - but for simplicity lets assume we are dealing with a hemispherical light source with constant intensity $I = 100cd$ and we are dealing with monochromatic light.

I managed to compute the direct illumination part from an IES point light source by calculating illuminance at each shading point using $E = \frac{I \cos(\theta_i)}{r^2}$ which I can easily convert to luminance $L_o$ by multiplying it by BRDF (since all my materials are diffuse, so $f_r = \frac{\rho}{\pi}$).

This time I decided to implement Instant Radiosity to approximate the global illumination using Virtual Point Lights. I did some research, and I found a presentation with equations at slide 10 and 11. So I spent my last month experimenting with it, but the results I've got are too dark.

My current implementation is split into 2 applications. The first one is tracing random rays from light source. The second one is an OpenGL application for shading.

### VPL generation (for single light path)

1. Create a new ray in random direction
2. Since I'm dealing with a point light, I believe that we can't calculate $L_i$, but I know that $L_o = f_r \times E$ and $E = \frac{I \cos{\theta_i}}{r^2}$ so now I know the outgoing luminance. Since I'm using a Lambertian BRDF, I know that $L_o$ is constant - that's why I store it as light intensity (I know that this is not "luminious intensity" per se, but at this point I don't know the outgoing direction).
3. Randomize a new outgoing reflection direction.
4. This time I know $L_i$ (it is equal to $L_o$ from previous iteration - no participating medium). I use the equation from slide 10, so $L_o = \frac{\rho}{\pi} L_i$. Again I store $L_o$ as VPL's intensity.
5. Randomize a new outgoing (reflected) direction.
6. if (depth++ < max_depth) goto step_4;

1. Set the illumination accumulator to $E = 0$
2. foreach (vpl in vpls)

a. Check light visibility $V$ (from shadow map), if in shadow then continue.

b. Compute the distance $r$ to light and a normalized vector $\hat{l}$ "to the light"

c. $E_{vpl} = I_{vpl} \frac{\cos{\theta_i} \cos{\theta_e}}{r^2}$, where $\cos \theta_e = \hat{l} \circ \hat{n}_{vpl}$ based on equation from slide 11

d. E += $\frac{E_{vpl}}{N}$, where $N$ is the number of traced light paths

3. $L_o = f_r \times E$

## Problem

1. The problem is that the resulting $L_o$ values are always below $1$, while an identical scene rendered in Radiance (and limited to 1 bounce) has values above $20$.

2. (If my method is wrong) How to compute VPLs intensity?

3. In the mentioned presentation at page 13 is an algorithm (which I don't fully understand). Can somebody enlighten me how to calculate "average_reflectivity"? As you can see my implementation is derived from The Rendering Equation and the equations look similar.