Soap Bubble Clusters with Swirly Bokeh Background
Jun Li, Zhenzhi Xia
OVERVIEW
We aim to create a bubble cluster photography with Bokeh effect background. The idea of bubless as the front object
is inspired from the beautiful forms and colors of bubble clusters as well as the interesting physics laws that comewith them. The backfound effect is inspired from photography produced with Lomography Petzval Bokeh 58 art lens.
We divided our work into two technical parts: the Bokeh effect background and the bubble cluster simulation.

PART1: BACKGROUND (Zhenzhi Xia)
Unlike the most rendering systems that generate images where the entire scene is in sharp focus and mimics theperformance of a pinhole camera, this background scene that requires some deliberate blurring is created by a more
real camera lens of optimized Petzval lens. Petzval lens was designed by the German-Hungarian mathematics
professor Josef Maximilian Petzval in 1840 in Vienna. This type of doublet lens which was very sharp in the center, but
due to field curvature, the plane of focus and relative illumination fall off quite sharply as going away from the centerof the image. This artifact, however, ideally suits for portrait, and it became the standard lens for portrait
photographers. Here we would like to further modify the parameters of the Petzval lens through some lens design
knowledge and wave optics.
Realistic Camera Plugin
Refer to the assignment offered from previous year's CS348b, a camera plugin for pbrt that simulates the traversal oflight through these lens assemblies onto the film plane of a virtual camera is applied. Usually random ray bundles
are traced from object space to image space and each ray at the object space is conjugated to a point on the final
image. The standard algorithm for tracing a ray through the lens is given in the image below. The propagation of aray through a lens surface involves both finding the point of intersection between the ray and the surface and therefraction of the ray as it crosses the interface between the two media.

Lens Design and Aberrations
Benefiting from the realistic camera plugin, a lens system is designed to be fed into the camera simulator. Thestarting point for this lens design is a patent lens of 100mm focal length and 50deg field of view. Since the swirly
Bokeh pattern results mostly from the aberrations of astigmatism and coma, it is important that we introduce moreaberrations off-axis while keeping the on-axis image in focus as we would like to position the bubbles in the middle.
The ray aberrations plot and 2D simulation of the image of the newly designed lens are shown below.

Since asymmetry of the lens system introduces astigmatism, it's more desirable to put the aperture stop in the front.
The drawback is that the rays tend to be more easily cut out at the edges of the lens, thus the vignetting effect isobserved. But in some cases of photography, a small amount of vignetting is also desired.
Render Bokeh effect with Background
The realistic camera is then applied to the landscape scene downloaded from pbrt scenes as background where aswirly artistic Bokeh pattern more visible at the edge of the frame.

PART2: BUBBLE CLUSTERS (Jun Li)
Thin Film InterferenceWave interference of light is sometimes neglected in computer graphics since it requires interpreting light as waves
instead of particles (photons) and can sometimes be hard to simulate. In our project we simulated thin film
interference. When a light wave comes into contact with a film layer, it reflects and refracts multiple times inside thelayer system, and interferes with itself in the process. Examples of thin film interference are soap bubbles, gasoline
rainbow patterns, or even animal wings.

The Fresnel equations provide a quantitative description of how much of the light will be transmitted or reflected at
an interface. The light reflected from the upper and lower surfaces will interfere. The degree of constructive ordestructive interference between the two light waves depends on the difference in their phase. This difference inturn depends on the thickness of the film layer, the refractive index of the film, and the angle of incidence of theoriginal wave on the film.
To simulate thin film interference, we extended bxdf to a bubble material class. We used the following equations tocompute reflection/transmission coefficients for s-polarized and p-polarized light, as well as the final fresnel
coefficient for the interference:

We used refraction rate of bubble = 1.4, and simulated interference of red, green, blue lights with wavelength 650,510, 475 nanometers, respectively.

Without and with thin film interfereice applied:

Bubble Cluster Geometry
A bubble is the minimal energy surface of a type formed by a soap film. In relation to its volume, it has the smallest
surface. Plateau’s Laws and later works, we were able to simulate bubble clusters according to this pattern.

We used the following equations as well as the SSS sin rules to compute the relative coordinates of all the centers:

Two and three bubbles collision according to Plateau's Law's:

Fluid Simulation and Stereographic Projection (future work for better effect)

This section describes an implementation that did not show our desired effect. We aimed to simulate the fluid
dynamics on a more reflective bubble. We adapted the real-time fluid dynamic simulation model by Jon Stam withsource code provided.

Stereographic projection:

This model simulates fluid using a state machine, like one for Game of Lifes. We created a state grid of size 100 by100, then we used half stereographic projection to project each hemisphere of the bubble to the grid. To someextent, the distortion from the projection should correspond to the natural distortion on soap film due to gravity.

PART3: FINAL IMAGESOur combined image does not sample well due to our technical limitation. Below are better quality images withbackground and bubbles separated:(Halton sampler, 512 samples/pixel, resolution 400 400)

(Halton sampler, 256 samples/pixel, resolution 1280 960)

Reference[1] A. Glassner, "Soap bubbles. 2 [Computer graphics]," in IEEE Computer Graphics and Applications, vol. 20, no. 6, pp.
99-109, Nov/Dec 2000.
[2] Bacterius, "Thin Film Interference for Computer Graphics", Graphics and GPU Programming, Apr 2013,https://www.gamedev.net/articles/programming/graphics/thin-film-interference-for-computer-graphics-r2962/.
[3] Roman Durikovic1, "Computer Animation: Animation of Soap Bubble Dynamics, Cluster Formation and Collision",
Journal of the Applied Mathematics, Statistics and Informatics (JAMSI), 2005, No. 2.
[4] Kolb, Craig, Don Mitchell, and Pat Hanrahan. "A realistic camera model for computer graphics." Proceedings of the22nd annual conference on Computer graphics and interactive techniques. ACM, 1995.
[5] Jos Stam, “Real-Time Fluid Dynamics for Games”, Proceedings of the game developer conference, 2003.
[6] David Eppstein, “The Graphs of Planar Soap Bubbles”, Symposium on Computational Geometry Rio de Janeiro,
Brazil, June 2013.
[7] Syvokin, Viktor P., and Michael D. Thorpe. "Fast calculation of bokeh image structure in camera lenses withmultiple aspheric surfaces." International Optical Design Conference. Optical Society of America, 2014.
[8] https://graphics.stanford.edu/wikis/cs348b-07/Assignment3.
Copyright 2018 Stanford University