Revision 16 as of 2007-06-13 02:39:32

    JulienChaumond/FinalProject

Realistic Camera - Lens Flares

The original project proposal can be found at JulienChaumond/FinalProjectProposal.

My idea was to extend the realistic camera model in order to simulate some of the interesting lens-internals related phenomenas in real cameras: lens flares and scattering around the sun.

Final Image

Motivations

Sources of inspiration for this project included:

Fresnel Equations

The first step of the project was to think about which physical phenomenas are at stake.

Intuitively:

  1. Circles and spots of light on the picture are due to the light "going back and forth" (reflections) between the lenses and at the aperture.
  2. Spikes of light in priviledged directions are most likely due to diffraction on the camera sensor (grid-shaped on a digital camera) and/or at the aperture diaphragm.
  3. The glow around the light sources (I'm not speaking of any atmopheric effect here) is due to the scattering of intense light in the glass material of the lenses.

To implement 1. and 3. I needed to extend the realistic camera model. We have to consider rays that are reflected on some lenses in addition to rays that are only refracted through them.

The physical equations that govern the repartition of light at an interface between two different materials are the Fresnel equations. They can be derived from the Maxwell equations that more generally govern the propagation of electromagnetic waves in a material.

The Fresnel equations give the percentage R of light that is reflected at an interface, depending on Snell's angles θi and θt and the two materials' indices of refraction n1 and n2. There are two equations, depending on whether the incident light is polarised in the plane of incidence of perpendicular to this plane. For unpolarised light - we'll assume the photographer doesn't use any polarizing filter here - R is simply the average of the two terms Rs and Rp.

Let's have a look at the values of R depending on the parameters. As we can see, the reflection coefficient R increases faster - and is equal to 1 for a long range of angles (total internal reflection) when the light goes from a material with larger index of refraction to a material with smaller index of refraction.

In our case, this means that the reflections are more frequent outside the lenses than inside them - which is somewhat counterintuitive.

An example of a ray that's reflected 4 times in its way through the camera can be seen below:

The way I implemented this is probalistically: at each interface, I compute the reflection coefficient R. I then randomly decide whether the ray's reflected or refracted according to this value. It's equivalent to actually splitting each ray at each interface and weighing them by R or (1-R), but it is easier to implement this way.

Below is an example of a ray that is split at randomly chosen interfaces.

Light Ray Tracing

Mie Scattering

Building the scene

Environment light

Experiments

Influence of the position of the sun

Shape of the aperture diaphragm

Background cloud texture

I tried to use a cloudy sky as a texture for the background, however it looked kind of funny so I ended up not using it.

Conclusion

References

  1. A Realistic Camera Model for Computer Graphics - http://www.graphics.stanford.edu/papers/camera/

  2. Understanding Lens Flare in Photography - http://www.cambridgeincolour.com/tutorials/lens-flare.htm

  3. http://en.wikipedia.org/wiki/Lens_flare

  4. http://en.wikipedia.org/wiki/Fresnel_equations

  5. Mie Scattering
Recent