Final Project Milestone

Realistic Rendering of Lens Flare Distortions

Noah Saso, Cassandra Melax, Aatif Jiwani, Ritwik Dixit

Milestone Video

Milestone Slides

Current Progress

Since our proposal phase, we've had to do quite a bit of in-depth research before we started on any sort of implementation. As such, we found that the lens flare artifact is composed of 2 main components: the Starburst Effect, and Ghost Reflections. Currently, we have finished the research phase of the Starburst effect and have begun the implementation in Project 3-1's PathTracer program. Also, we are currently underway with the research phase of the Ghost Reflections.

Starburst Effect: Research

Simulating a physically realistic lens flare involves breaking down the resulting flare into its various components and understanding them mathematically. This process of discovery is our primary accomplishment for the milestone.

The Starburst Effect happens when rays of light observed from a far distance diffracts through the lens, and as a result assume a new complex magnitude as it hits the image plane or the sensor within the camera. This law in optics is modeled exactly by the Fraunhofer diffraction equation:


Fraunhofer Diffraction Equation

It states that the complex amplitude $U$ of the light intensity that hits a point $p = (x, y, z)$ on the image plane is approximately the integral over all light that diffracts through the aperture plane and hits point $p$. Also, when light from far-field objects diffract through the aperture plane, it has a phase shift applied to it depending on the point of incidences. A crucial observation to make is that this model is exactly the Fourier Transform of the Aperture Function $A$, which is a real function that defines the amplitude of a ray of light when it hits the aperture plane at point $(x', y')$ and diffracts through.

Before we implement modules in the PathTracer program to perform Monte-Carlo integration on the Fraunhofer Diffraction Equation, we wanted to make sure that we had a prototype for a Fourier Implementation. This way, we could at least ensure that performing Monte-Carlo integration should reproduce the results of the Fourier Transform in expectation.

Starburst Effect: Fourier Implementation

Performing the Fourier Transform in any language is fairly trivial as there are common libraries out there with quality implementations of a 2-dimensional FFT. In our case, we had NumPy:


Implementation (with scaling power of 0.6)

However, the actual analysis of the relationship between aperture functions and the starburst it produces was the primary contribution to this milestone. To prevent our overview from becoming too long, we present our in-depth analysis between aperture functions and its resulting starbursts for the video/slides . Here is a visual analysis of a few aperture functions:


Normal aperture

Resulting starburst

Aperture with dots

Resulting starburst

Aperture with lines

Resulting starburst

Aperture with both

Resulting starburst

Starburst Effect: PathTracer Implementation

Our PathTracer implementation to reproduce the starburst effect surrounds performing Monte-Carlo Integration by taking many samples on the aperture plane for each point on the image plane. However, before we can begin with performing MC integration, we must have the infrastructure set up.

Among all the new infrastructure modules we need to implement, the first thing we focused on was being able to read in the position of a directional light, like one from blender, and be able to compute the center of the lens flare based on this position. A figure in the video/slides depicts this new module. From Blender, we were able to create a directional light (called "area light" in Blender) and position it such that it would appear in the camera frame during rendering. Then, before rendering starts, we compute the origin of the lens flare using the parameters of the camera. Currently as of this milestone, we have it such that we can compute the origin on the image plane in camera-frame coordinates. Translating this into normalized screen-space coordinates is trivial.

Updated Work Plan & Reflection

Week Tasks
Weeks 1-2 (complete)
  • Looked into Mitsuba 2 and decided against using it as our engine, since we have plenty of experience with the existing path tracer project engine.
  • Deconstructed the lens flare in order to understand the components that lead to a realistic image.
  • Figured out how to calculate the position for the generated lens flare based on lights in the scene.
  • Investigated the use of Fractional Fourier Transform from a proof-of-concept perspective in creating ghost flares.
Week 3 (Apr 27 - May 4)
  • Implement the ability to load an aperture function as a texture.
  • Apply Monte-Carlo integration to the sampled points on the dirty aperture to perform the Fraunhofer Diffraction as described above and generate the lens flare image.
  • Integrate a thick-lens model into the pathtracer code to allow for ray tracing of ghost flares.

Our work plan shifted as a result of better understanding the physics behind lens flares. We are on schedule in that we have chosen our rendering engine, broken down the lens flare physics, and figured out how to position the generated flare in the scene. We still need to implement loading aperture functions, Fraunhofer Diffraction to actually generate the approximation, and the ghost reflections. Since we are discarding the fourier transform-centric approach for ghost generation, we need to figure out how to position and the lens and trace rays through it, then apply it to create ghosts.