### Tonemapping

#### Relevant code:

`src/core/cameras/Tonemap.hpp`

Currently, three different tonemapping operators are implemented: Gamma, Reinhard, and Filmic.

#### Gamma correction only

This tonemapping operator only applies gamma correction and does nothing else:

*Gamma correction only*

#### Reinhard

This tonemapping operator is based on Photographic Tone Reproduction for Digital Images by Reinhard et al. I am using the simple operator without adaptive dodging and burning. Although it handles HDR images well, it also washes out colors in the image:

*Reinhard tonemapping operator*

#### Filmic

This tonemapping operator is based on an article by John Hable, which discusses several "Filmic" tonemapping operators. I chose the operator proposed by Jim Hejl and Richard Burgess-Dawson, which is a rational function designed to mimic the response curve of a type of Kodak film commonly used in film making. Below is an image rendered with this operator; note the saturated blacks:

*Filmic tonemapping operator*

### Handling multiple lights

#### Relevant code:

`src/core/integrators/PathTraceIntegrator.hpp :: chooseLight`

If there are multiple light sources in a scene, we have to pick a light source to draw samples from before performing direct light sampling, Sampling all lights uniformly can perform unfavourably if there are many lights in the scene. To remedy this problem, I implemented a heuristic based on the approximate solid angle of the light sources.

At each shading point, a weighted sampling distribution over all light sources is constructed before picking a light source to sample from. Each light source in the renderer is capable of computing its approximate solid angle seen from an arbitrary point. Each light then receives a probability of being sampled proportional to its approximate solid angle times its emission. While this distribution can be expensive to compute with many lights, the noise reduction is significant, since the inverse squared distance term is baked into the sampling distribution.

The images below demonstrate this: A large room with a diffuse floor is illuminated by 32 quad lights. In the first image, light sources are picked according to a uniform distribution. In the second image, the light sources are picked according to a distribution proportional to the product of their solid angle and their emission. Note the difference in noise:

*Picking light sources uniformly during light sampling*

*Picking light sources according to their solid angle during light sampling*

### Other BSDFS

#### Relevant code:

`src/core/bsdfs/ConductorBsdf.hpp`

`src/core/bsdfs/DielectricBsdf.hpp`

`src/core/bsdfs/MirrorBsdf.hpp`

`src/core/bsdfs/LambertBsdf.hpp`

#### Smooth conductor

Smooth version of the rough conductor BSDF.

*Smooth conductor*

#### Smooth dielectric

Smooth version of the rough dielectric BSDF.

*Smooth dielectric*

#### Mirror

*Mirror BSDF*

#### Lambert

*Lambert BSDF*