New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images...

50
저작자표시-비영리-변경금지 2.0 대한민국 이용자는 아래의 조건을 따르는 경우에 한하여 자유롭게 l 이 저작물을 복제, 배포, 전송, 전시, 공연 및 방송할 수 있습니다. 다음과 같은 조건을 따라야 합니다: l 귀하는, 이 저작물의 재이용이나 배포의 경우, 이 저작물에 적용된 이용허락조건 을 명확하게 나타내어야 합니다. l 저작권자로부터 별도의 허가를 받으면 이러한 조건들은 적용되지 않습니다. 저작권법에 따른 이용자의 권리는 위의 내용에 의하여 영향을 받지 않습니다. 이것은 이용허락규약 ( Legal Code) 을 이해하기 쉽게 요약한 것입니다. Disclaimer 저작자표시. 귀하는 원저작자를 표시하여야 합니다. 비영리. 귀하는 이 저작물을 영리 목적으로 이용할 수 없습니다. 변경금지. 귀하는 이 저작물을 개작, 변형 또는 가공할 수 없습니다.

Transcript of New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images...

Page 1: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

저 시-비 리- 경 지 2.0 한민

는 아래 조건 르는 경 에 한하여 게

l 저 물 복제, 포, 전송, 전시, 공연 송할 수 습니다.

다 과 같 조건 라야 합니다:

l 하는, 저 물 나 포 경 , 저 물에 적 된 허락조건 명확하게 나타내어야 합니다.

l 저 터 허가를 면 러한 조건들 적 되지 않습니다.

저 에 른 리는 내 에 하여 향 지 않습니다.

것 허락규약(Legal Code) 해하 쉽게 약한 것 니다.

Disclaimer

저 시. 하는 원저 를 시하여야 합니다.

비 리. 하는 저 물 리 목적 할 수 없습니다.

경 지. 하는 저 물 개 , 형 또는 가공할 수 없습니다.

Page 2: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

Master’s Thesis

Interactive Expressive Editing of Lens

Flare Effect

Sangmin Lee

Department of Electrical and Computer Engineering

The Graduate School

Sungkyunkwan University

Page 3: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

Interactive Expressive Editing of Lens

Flare Effect

Sangmin Lee

Department of Electrical and Computer Engineering

The Graduate School

Sungkyunkwan University

Page 4: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

Interactive Expressive Editing of Lens

Flare Effect

Sangmin Lee

A Master's Thesis Submitted to the Department of

Electrical and Computer Engineering

and the Graduate School of Sungkyunkwan University

in partial fulfillment of the requirements

for the degree of Master of Science in Engineering

October 2016

Approved by

Professor Sungkil Lee

Page 5: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

This certifies that the master's thesis

of Sangmin Lee is approved.

Committee Chair :

Committee Member :

Major Advisor:

The Graduate School

Sungkyunkwan University

December 2016

Page 6: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

i

Contents

List of Figures ··············· ii

Abstract ··············· Iii

1. Introduction ··············· 1

2. Related works and Background ··············· 4

2.1 Diffraction Rendering ··············· 4

2.2 Approximation of Diffraction Equations ··············· 5

2.3 Color Dispersion ··············· 9

3. Algorithm ··············· 12

3.1 Abstract Aperture ··············· 12

3.2 Diffraction Synthesis ··············· 18

3.3 Color Editing ··············· 24

4. User Interface ··············· 29

5. Results ··············· 32

6. Discussion and Limitations ··············· 36

7. Conclusions ··············· 38

References ··············· 39

Korean Abstract ··············· 41

Page 7: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

ii

List of Figures

Fig.1. Overview of our interaction scheme ······ 2

Fig.2. An example of an aperture and image plane ······ 5

Fig.3. A diffraction pattern with RGB colors ······ 10

Fig.4. Aperture shapes and lens flares ······ 13

Fig.5. A circular aperture and the lens flare of it ······ 14

Fig.6. Thin square apertures using splines ······ 15

Fig.7. Abstract apertures and lens flares ······ 17

Fig.8. Addition and subtraction of diffraction patterns ······ 18

Fig.9. Comparison of different diffractions creating process ······ 20

Fig.10. Comparison of different diffractions creating process ······ 21

Fig.11. Comparison of regular and abstract apertures ······ 22

Fig.12. The way how to create a chromatic lens flare ······ 25

Fig.13. Spectra power distribution ······ 26

Fig.14. Diffraction patterns with color dispersion ······ 27

Fig.15. Diffraction patterns with color dispersion ······ 28

Fig.16. Edition of a blade diffraction pattern ······ 30

Fig.17. Edition of a circular diffraction pattern ······ 31

Fig.18. Results image with a 3D scene ······ 33

Fig.19. Results image with a 3D scene ······ 34

Fig.20. Results image with a real photo ······ 35

Page 8: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

iii

Abstract

Interactive Expressive Editing of Lens Flare Effect

Lens flare or ghost effects that occur in lens system are important artifacts

to make images more realistic. This diffraction effects can be rendered

applying Fourier transform to aperture images. However, since the aperture

shape is indirectly related to the diffraction pattern, it is hard to expect the

result in advance and edit the shape of the diffraction. In this paper, we

abstracted the general aperture into two key geometry features, a curved

edge and circular core, which generate the blade shape and highlight of the

diffraction pattern, respectively. We modify the abstracted aperture, apply

Fourier transform, rotate, and synthesize them to create a new diffraction

pattern. Also, we provide user interface to control the shape of diffraction and

the editors can generate the plausible output.

Keywords: lens flare, diffraction synthesis, diffraction editing, fast Fourier

transform

Page 9: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

1

1. Introduction

In photograph, lens flare, ghost, and bokeh effects are unintended

artifacts from fault of lens system that lens manufacturers struggle to get rid

of. However, the effects are often used to make images more realistic.

Furthermore, since these artifacts give more aesthetic atmosphere, the effects

are commonly used in video editing, rendered images, and 3D games.

Among the effects, lens flare or glare effects are important features to

show how bright light sources are. Also, lens flare that shows a number of

light needles gives aesthetic feeling on photos, especially on the night scene.

Thus, most of editing tools for photos or videos provide some functions that

add lens flare effect on contents. However these application only provide

prefixed shape of lens flare and the users are not able to control the number

of streaks or rotations of the diffraction patterns. Controlling the lens flare

shape can be thought easily by transform the shape of an aperture. Since the

effect is caused by diffraction at an aperture of lenses, the shapes of flare are

mostly influenced by shapes of the aperture. However, because the glare

images could be verified after computing Fourier transform (FT) [5, 6, 7, 9],

aperture shapes are related with the glare images indirectly. Therefore, it is

hard to expect which apertures create a specific flare image, and producing

creative flares that editors preliminary intended is still challenging.

Page 10: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

2

In this paper, we present a novel scheme of diffraction addition with basic

diffraction elements, and an interactive framework to edit lens flare images.

Since diffraction mostly occurs at the edges of apertures, we abstract the

apertures into edges and apply additive fast Fourier transform (FFT). The

edge properties create blades and a core highlight which are basic components

of lens flare. With abstracted apertures, we rotate, and synthesize them to

make a new virtual aperture. After computing FFT of the abstracted aperture

image, we scale the result to be rendered for visible wavelengths to make the

output colorful, and the color of lens flare is changed according to the

spectrum of light sources.

Figure 1. A realistic lens flare can be generated synthesizing abstract apertures and

applying fast Fourier Transform. We define blade (E) and circular (C) diffraction

patterns as atomic diffraction patterns. In addition, our scheme provide two control

points for intuitive editing.

The framework provides two control points, green and red points, to

deform the abstracted apertures parametrically. The green and red point

control the brightness and rotation of the basic diffraction elements,

Page 11: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

3

respectively (see Figure 1). With given control points, users can add and

modify diffraction shapes and generate a new diffraction image intuitively.

Also, due to the physical-based rendering, our framework provides plausible

diffraction pattern comparing with photographs.

Page 12: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

4

2. Related work and Background

2.1 Diffraction Rendering

Since Fraunhofer approximation can be interpreted as Fourier transform

in far field, many researches use discrete Fourier transform (DFT) to produce

glare images based on physics. Previous work built a 2D aperture image

including pupils and eyelashes which can be seen eyes [4], and rendered

diffraction images with DFT based on wave optics. In addition, they rendered

various glare images changing the aperture shape, and implemented color

dispersion using spectra simulation for realistic outputs. Other work

constructed photographic full lens systems and rendered lens flares and ghost

effects with ray tracing [6] or multiplying matrices in effective ways [7].

These researches draw variable glares when the position of light source or

existing apertures are changed in interactive manner. Otherwise existing

approaches render static shape of glare image, Ritschel et al. modeled

anatomical human eyes and focused on temporal change of crystalline lens for

dynamic glare rendering.

In these previous work, however, the aperture shape are fixed and the

diffraction patterns are pre-defined, and the way how to transform the

diffraction pattern by users in interactive purpose has not been studied yet.

On the other hand, our work offers control points for users to transform the

diffraction patterns intuitively and freely, and the users can generate various

Page 13: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

5

and realistic lens flares. We focus on how the users can control diffraction

pattern without any care of the aperture shapes with abstract aperture that is

not treated on previous work.

2.2 Approximation of Diffraction Equations

Lens flare is created because of diffraction on the aperture of a lens

system. As diffraction pattern can be obtained with Huygens ’ principle, a lens

flare image can be obtained applying Huygens’ principle on a 2D aperture

image. Huygens’ principle can be expressed mathematically as below [4].

�(�, �, �) = −�

�∬ �(��, ��, ��)

����

���′��′ (1)

Figure 2. Ray transfer from aperture plane (�� = �) to image plane (�).

Page 14: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

6

where

� = �(� − ��)� + (� − ��)� + ��, � =��

�. (2)

Here, the point (��, ��, �� = 0) is the location of aperture and

�(��, ��, ��) is luminance of light field at the aperture. As the phase of

light waves are different according to the distance � between aperture

and the image plane, the distribution of �(�, �, �) at the intersect point

has diffraction patterns. Thus, a realistic diffraction pattern can be

created by substituting the distance � and wavelength of a light into

Huygens’ principle.

However, because computing Huygens ’ principle is time consuming, we

used approximation that can be used when the distance between the aperture

and the image plane in Figure 2 is long enough. Fresnel approximation set the

distance � as � only in the denominator part of the Equation (1).

� ≅ � (3)

Differently from the denominator approximation, the small change of �

value makes considerable change of the phases in the exponent part ���� of

the Equation (1). Fresnel approximated the exponent under the condition (4)

with Taylor expansion.

Page 15: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

7

� ≫ (� − ��)� + (� − �)� (4)

� = ��� − �′�2

+ �� − �′�2

+ �2 = ��1 +��−�′�

2+��−�′�

2

�2 ≅ � +��−�′�

2+��−�′�

2

2�(5)

Using the Equation (3) and (5), the Fresnel approximation can be

written as the following equation (6).

�(�, �, �) = −�

�∬ �(��, ��, 0)

�������

�������������������������

���′��′

= −������

��

2�(�2+�2)

��∬ �(��, ��, 0)��

��(���

����)���

�(�������)��′��′ (6)

Furthermore, Fraunhofer approximated the integral part under the

condition (7) that the distance is far enough, called far-field [4].

� ≫�

�(aperture radius)� (7)

In this condition, the model of diffraction satisfies

���

��(�������) ≅ 1 (8)

and Fraunhofer approximation can be presented

Page 16: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

8

�(�, �, �) ≅ −������

��

��(�����)

��∬ �(�� , ��, ��)���

�(�������)��′��′ . (9)

This formulation can be translated as Fourier transform �(�, �).

�(�, �) = ∬ �(�, �)�����(�����)���� (10)

�(�, �, �) ≅ −������

��

���������

���(�, �)|

����

��, ��

��

��

(11)

This approach gives benefit in time complexity terms. If the size of 2D

aperture texture is � × � pixels, time complexity of computing Huygens’

diffraction equation will be �(��). On the other hand, diffraction pattern can

be computed in two pass using FFT and computing FFT has �(ln(�) + ln(�)).

Page 17: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

9

2.3 Color Dispersion

The diffraction pattern obtained from Fraunhofer approximation using 2D

FFT shows monochromatic image for one wavelength. To render the

diffraction image for real lights, computing FFT should be applied for the

number of samples for real lights’ spectra distribution. For instance, for a light

source which contains three colors, red, green and blue, a proper diffraction

pattern can be created by computing FFT three times for each wavelength,

450nm, 550nm and 650nm, respectively, and synthesizing the three results

into a single output (Figure 3).

In case of increasing the number of samples of the continuous spectra to

obtain a realistic result, this process dramatically reduces the performance

and it makes hard to offer rapid feedback that is important for editing.

A solution for efficient color dispersion is utilizing that the change of

wavelength does not affect diffraction patterns, but the wavelength is involved

in the scale of the diffraction patterns [8]. Therefore, color dispersion can be

implemented to set an arbitrary seed of the wavelength and scale the

monochromatic result from FFT as the ratio of seed lambda and the sample

values of the spectra.

Page 18: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

10

Figure 3. Synthesizing monochromatic diffraction pattern to RGB color space.

Page 19: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

11

This approach enables us to obtain a diffraction pattern easily applying

FFT once, and can be simply implemented on GPU with only scaling texture

coordinates.

Converting spectra data of wavelength to RGB color space follows 2

steps. First, convert the spectra data to CIE XYZ color space using �,̅ ��, and �̅

that are obtained empirically. Secondly, transform CIE XYZ color space to

RGB color space [10]. It needs three data, �,̅ ��, and �,̅ for each wavelength,

and we need a table that contains totally 285 floating points for 95 wavelength

samples from 360nm to 830nm. Wyman et al. proposes to approximate the

curves of � ,̅ �� , and � a̅s three equations (see Equation (12)) [2], and it

enables to convert spectra data to CIE XYZ color space without the tabulate.

����(�) = 1.065 ���

�(

�����.�

��.��)�

+ 0.366 ���

�(

�����.�

��.��)�

,

����(�) = 1.014 ���

�(

�� ���� ���.�

�.���)�

, (12)

��̃�(�) = 1.839 ���

�(

�� ���� ���.�

�.���)�

In this paper, we use the tabulate to convert spectra data to CIE XYZ

color space to avoid error of approximation and time consuming computation

of exponential and log function of Equation (12).

Page 20: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

12

3. Algorithm

In this section, we introduce how to abstract regular apertures and add

the abstracted apertures to build a virtual aperture. Furthermore, we present a

method to convert a monochromatic diffraction pattern, the result of FFT, to a

chromatic image using spectrum of light sources for visible wavelength.

3.1 Abstract Aperture

Most shapes of lens flares or glares are deeply related to the shape of

apertures. In this work, we define basic patterns among multiple diffraction

patterns from the apertures and create a new diffraction image by modifying

and adding the basic patterns.

In general camera apertures, light scattering occurs at the edge of the

apertures and it appears as blades in photographs. As Figure 4 describes, the

straighter the edges of apertures are, the narrower the areas of blades are,

and the more curved the edges are, the broader the areas of blades are

(Figure 4a and Figure 4b). We define the blades shape as one of the basic

diffraction patterns, and utilize the characteristic extracted from the edges in

the apertures. In other case, because the iris of eyes has circle-shaped

aperture and generates curved patterns, circle pattern is also one of the basic

diffraction patterns (Figure 5).

Page 21: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

13

Figure 4. Aperture shapes and lens flares

Page 22: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

14

Figure 5. A circular aperture and the lens flare of it

To create the basic patterns of diffraction, we extract key geometry

features from general apertures called abstract apertures. The key features

are the edge parts of apertures where the diffraction effects mainly occur, and

we define two abstract aperture as a thin square and circle aperture which

produce the blade and circle patterns, respectively.

The abstract aperture of the blade shape is consisted with splines at the

top and bottom of the thin square to control the top and bottom edge for

editing. The splines are created by Catmull-Rom spline [3]. Catmull-Rom

spline needs four points to create a curve basically, and the leftmost and

rightest points take a role of anchor. Catmull-Rom spline create a curve

between two points which located in center. In this paper, we use seven points

involving the anchor points and create four curves between five points that

located in the center (see Figure 6).

Page 23: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

15

Figure 6. Thin square apertures created using spline curves

The variation of the five points to control splines is decided empirically,

and the location of the points varies according to the control points which are

offered in user interface explained in Section 4. Using these curves, editors

can control the width of the bladed pattern of lens flare.

In Figure 7, the square aperture which looks like a line creates a blade

(Figure 7a), and the curved edge of the aperture makes the blade wider

(Figure 7b and Figure 7c). The way how to rotate the blade pattern is to apply

rotation matrix to vertex shader and rotate the thin-abstract aperture.

While the thin square aperture needs to update the position of vertices to

control splines, the other abstract aperture, circle shape, can be modified

applying scale and rotate matrix according to control axes. The shape of

diffraction pattern of the circle aperture is similar with the shape of the

aperture but the difference is that the shapes have orthogonal relationship.

Page 24: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

16

Figure 7d shows a general circle aperture and a diffraction pattern

created through the aperture. To stretch the diffraction pattern, the aperture

are distorted to perpendicular direction of the editing axis (see Figure 7e).

Also, rotating the diffraction pattern is able to rotate the aperture as same

degree and direction (see Figure 7f).

Page 25: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

17

Figure 7. Abstract apertures and lens flares

Page 26: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

18

3.2 Diffraction Synthesis

A complex aperture can be broken up to simple apertures, then the sum

of the diffraction patterns of the simple apertures is same with the glare image

of the original aperture (Figure 8). Babinet's principle support the addition of

aperture [4].

Figure 8. Addition or subtraction of simple apertures and their diffraction can generate

a new complex aperture and its diffraction.

Because edge features of apertures mostly affect diffraction results, we

decompose regular apertures into two abstract apertures, a thin square and

circular shape as mentioned above. Using these abstract apertures, we create

a new diffraction pattern to synthesize basic diffraction patterns from the

abstract apertures. However, when editors add lots of basic patterns,

synthesizing the basic diffraction patterns needs to apply FFT as the number

of the added abstract aperture, and it increases computational cost.

In this paper, we synthesize the basic aperture first to create a virtual

aperture, and compute FFT once for the virtual aperture to create same result

according to Babinet’s principle rather than applying FFT several times. To

Page 27: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

19

prove the fact that results are identical, we compare the results of applying

FFT for each basic apertures and a synthesis of basic apertures using

structural similarity (SSIM) [12] and mean squared error (MSE).

Figure 9 shows the differences when three abstract apertures create a

diffraction patterns. Figure 9a is the case that the output is created by

applying FFT three times and add the results. In case of Figure 9b, the lens

flare is generated by computing FFT once for one assemble aperture adding

the three basic abstract apertures. When comparing the two output, we set the

output of Figure 9a as a reference image and the value of SSIM is 1.0 and

MSE is 0.0. The results of SSIM and MSE of all pixels of the images mean

the two images are identical [12]. Furthermore, computational time of Figure

9a and Figure 9b is 1.03ms and 0.43ms, respectively, and we can figure out

that applying FFT once is more efficient almost two times. Figure 10 shows

the same procedure with Figure 9 with five abstract apertures, and the result

of comparing two outputs using SSIM and MSE is 1.0 and 0.0, respectively.

Computational cost of Figure 10a is 1.6ms, and 0.44ms for Figure 10b case,

roughly four times faster. As a result, applying FFT once is more efficient

generating same results, and in this paper, we synthesize basic apertures and

apply FFT once.

Page 28: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

20

Figure 9. Comparison of diffraction patterns caused by applying FFT three times (a)

and once (b). The result is identical.

Page 29: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

21

Figure 10. Comparison of diffraction patterns caused by applying FFT five times (a)

and once (b). The result is identical.

Page 30: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

22

Figure 11. Regular apertures (a and b), abstracted apertures (e and f), and the lens

flares of them (c, d, g, and h).

Page 31: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

23

Another thing that we can figure out in Figure 9 and Figure 10 is

relationship between the number of square aperture and variation of blades.

When a curved edge aperture is added on to a virtual aperture, the diffraction

pattern of it gain one more blades shape which are orthogonal with the

abstract aperture. So when the virtual aperture has three square apertures,

the diffraction pattern has also three blades (Figure 9), and the pattern of

Figure 10 has four blades as same reasons. Thus, when users add the number

of blades patterns, our framework add the square abstract aperture on a vrtual

aperture.

Editors can create lens flare images similar to real one with virtual

apertures. Figure 11 shows that adding the edge characteristics can generate

similar diffraction pattern. As the regular aperture which has straight edges

produces a starburst which has sharp blades, the virtual aperture made from

addition of three square creates similar starburst diffraction pattern (Figure

11a and Figure 11e). Also, the diffraction pattern of the virtual aperture

having three curved abstract aperture is similar to the lens flare from curved

regular aperture (Figure 11b and Figure 11f).

Page 32: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

24

3.3 Color Editing

The result of FFT shows monochromatic lens flare including ringing

effect. To make the result more realistic and remove the ringing effect, we

need to render the diffraction patterns for visible wavelength. The process to

create chromatic lens flares is done with computing FFT several time for

diverse λ in equation 6. However, computing FFT several times for visible

wavelength causes serious performance degradation and cannot give

immediate feedback to editors. Instead, the simple and effective way to create

chromatic diffraction patterns is scaling the monochromatic diffraction

patterns and adding them because the size and color of the result are the only

differences when the lambda values are different [5, 8, 9].

Figure 12 shows how to create a chromatic lens flare. To scale the

monochromatic diffraction pattern, set anchor lambda value λ�

and scale the

result of FFT with proportion of different wavelength. We lets 575nm as λ�

and the diffraction image is scaled by �

��. Totally 48 multi-spectra

wavelengths samples are added from 360 to 830 nm with 10 nm steps. After

the sampling and scaling, we need to convert wavelength to RGB color.

Spectral colors are converted to CIE 1931 XYZ color space and converted to

RGB color space again with multiplying constants which are defined by

experiments [10]. It removes ringing and produces realistic diffraction

patterns which can be usually seen in photograph.

Page 33: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

25

Figure 12. The way how to create a chromatic lens flare.

Page 34: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

26

Each light source has different electromagnetic spectrum for visible

wavelength and the lens flares show different colors when editors change the

light sources. Thus, the framework also provide preset variable light sources

data to change the color of lens flare and editors can change the color of lens

flare. Figure 13 shows four spectra power distributions prepared in the

framework. The distributions contain natural daylight (standard solar spectra),

halogen lamp (Osram 12V Diachroic), LED lamp (Toshiba E-Core Par30s

23Deg), and compact fluorescent lamp (Pro-Lite Daylight SRI-30W) [1, 12].

Figure 13. Spectra power distribution of natural daylight (red), halogen lamp (green),

LED lamp (violet), and fluorescent lamp (blue).

0

0.2

0.4

0.6

0.8

1

380

400

420

440

460

480

500

520

540

560

580

600

620

640

660

680

700

720

740

760

780

Standard Solar Spectra Osram 12V Diachroic

Toshiba E-Core Par30s 23Deg Pro-Lite Daylight SRI-30W

Page 35: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

27

Figure 14. Diffraction patterns with color dispersion using pre-defined spectra power

distribution.

Page 36: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

28

Also, our framework provide a graph for spectra distribution as well as

the rendered lens flare image. Figure 14 illustrates the spectra power

distributions and the result of the lens flare in the framework (lens flare of

Figure 14a, Figure 14b, Figure 14c, and Figure 14d are results of the light

source, standard solar spectra, halogen lamp, LED lamp, and fluorescent lamp,

respectively).

Furthermore, editors can modify the intensity of spectra data as their

intention. Clicking or dragging a mouse, editors can change specific power of

the spectra and it generates various color dispersion of outputs according to

the spectra power distribution (see Figure 15).

Figure 15. Diffraction patterns with color dispersion modifying spectra data (see the

upper spectra power distribution graph).

Page 37: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

29

4. User Interface

The blade and circle diffraction pattern has two control points; red one

and green one. The red point controls the intensity and rotation of both the

blade and circle diffraction pattern. The rotation of the blade and circle with

red point is done by rotating the aperture with same angle between original

red point’s position and modified point’s position. The intensity of the

diffraction shapes is related with length between red point and the center of

the abstracted aperture, and if the distance is longer, the diffraction pattern

will be brighter.

In the blade case, the green point controls the width of the blade (Figure

16a). When editors attempt to make the width of the blade wider, drag and

drop the green point in a vertical axis direction. The brightness of the blade

pattern can be modified by the length of the location of red point and center of

image (Figure 16b). The central axis of the blade is also rotated according to

the red point (Figure 16c).

On the other hand, the green point distorts the circle diffraction pattern

(Figure 17a). As the role of the blade’s red point, a red point of circular

diffraction pattern also controls the intensity and central axis (Figure 17b and

Figure 17c).

Page 38: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

30

Figure 16. Edition of a blade diffraction pattern with control points. When editors move

a green point on the blade (a), the width of the blade become wider (b). The intensity

of the pattern is brighter when the red point becomes far from the center of the image

(c). Also, the central axis of the pattern is changed according to the red point.

Page 39: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

31

Figure 17. In the circle diffraction pattern, the green point distorts the circle to an

ellipse shape (b). The red point is involved for the intensity and rotation of the

circular diffraction pattern (c and d).

Page 40: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

32

5. Results

We implemented our framework on Intel i7 3.6GHz CPU and NVIDIA

980Ti GPU with OpenGL. The resolutions of diffraction images are 512×512

and 1024 × 1024. The framework requires to compute FFT once for an

aperture that is a result of synthesizing abstract apertures. The performance

to render a lens flare involving the color dispersion process takes roughly

0.7ms and 2.85ms at 512×512 and 1024×1024 resolution, respectively.

Form Figure 18 to Figure 20, we illustrate edited lens flare images and

scenes applying the diffraction patterns. We compose rendered 3D scene with

diffraction patterns (see Figure 18 and Figure 19). In Figure 18, we create a

general and symmetric lens flare with seven blades and apply the lens flare in

the brightest part of the rendered scene. Otherwise the general lens flare,

Figure 19 describes non-symmetric lens flare which can be seen when using

anamorphic lenses. Also, we edit the color of the lens flare according to the

violet light source of the scene. In addition, we synthesize a diffraction pattern

to a real photo to emphasize a light source and diffraction effect (see Figure

20).

Page 41: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

33

Figure 18. A generated lens flare and a 3D scene with it. The lens flare has symmetric

pattern.

Page 42: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

34

Figure 19. Synthesized 3D scene with non-symmetric diffraction pattern. The color of

the diffraction also edited as the light source of the scene.

Page 43: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

35

Figure 20. Edited lens flare with a real photo to emphasize the diffraction effect.

Page 44: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

36

6. Discussion and Limitations

Our objective is that editors can easily modify the shape or color of lens

flare, and apply them to rendered scenes or real photos. We define basic

diffraction patterns as the blade shape and circular core. The atomic patterns

can be controlled by modifying abstract apertures, a thin square and circle

aperture.

Our framework composes abstract apertures to a virtual aperture not to

need re-computing FFT for create diffraction patterns. This approach causes

little degradation for performance even the basic diffraction patterns are

added. It enables editors to give fast feedback when they work on low

performance devices. Also, we provide neat user interface that enable to

increase the number of the blades, control the shape and intensity of the basic

diffraction patterns and the color of the results. It is strength of our

framework that user does not need to care about the shape of a virtual

aperture because they directly transform the lens flare using control points

and the framework add or modify abstract apertures according to the

parameters.

However, the synthesized aperture to generate and modify lens flare

cannot be utilized on lens simulations which need physical aperture shapes

because the apertures are still virtual apertures. The virtual aperture has

overlapped area when adding abstract apertures and it cannot be explain in

physics. Therefore, our approach has a limitation that some effect closely

Page 45: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

37

related with aperture shape such as the ghost or bokeh effects is not able to

be generated by using the virtual aperture. Because the ghost and bokeh

effects are also significant elements for creating realistic images, the result

images which only involving lens flare effect without the ghost or bokeh

effects give unnatural feeling. Our result images support these effect and

Figure 20 is more natural than Figure 18 because Figure 20 has glare and

ghost effects already. Beside using abstract apertures, to extend our method

creating physical based aperture for editing lens fares is a great goal of our

future work.

We do not propose the relationship between the width of blade pattern

and the green point provided in user interface. When editors modify the

control points in user interface, the width of the blade is decided

approximately for iterative tries, and the location of points and shape of

diffraction pattern do not fit exactly. If we suggest user interface that makes

enable to control accurately the width and intensity of the patterns with

equations, users can edit lens flare images more intuitively.

Page 46: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

38

7. Conclusions

In this paper, we propose an editing framework for diffraction patterns

which is crucial for realistic images. Our method provides physically based

diffraction patterns with Fraunhofer approximation and spectra power

distribution of light sources. Also, the framework enables to edit the lens flare

in real-time applying FFT in parallel for diffraction equation.

This framework aids editors to modify lens flares using two atomic

diffraction patterns, the blade and circle, which come from the abstracted

apertures. Also, users can control the shape, intensity and rotation of the

atomic patterns using user interface and user interface enable to generate a

new lens flare intuitively.

Editors can generate non-symmetric and irregular diffraction patterns as

well as symmetric lens flares that can be seen easily in most camera lenses

with our framework. In addition, editors can manage the color of the patterns

using not only pre-defined spectra power distribution but modifying the graph

of spectra data. On our framework, the users can create realistic lens flares or

distinctive diffraction patterns. Also they can make an artistic impression

composing them into rendered scene or real photos.

Page 47: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

39

References

[1]. C. Honsberg, S. Bowden, Photovoltaic Education Network, Standard Solar Spectra,

http://www.pveducation.org/pvcdrom/appendices/standard-solar-spectra, 2016.

[2]. C. Wyman, P. P. Sloan, P. Shirley, "Simple analytic approximations to the CIE XYZ

color matching functions", Journal of Computer Graphics Techniques, vol. 2, 2, pp. 1-

11, 2013.

[3]. E. Catmull, R. Rom, "A class of local interpolating splines", Computer Aided

Geometric Design, pp. 317-326, 1974.

[4]. J. Peatross, M. Ware, "Physics of light and optics", Brigham Young University,

Department of Physics, 2015.

[5]. M. Kakimoto, K. Matsuoka, T. Nishita, T. Naemura, H. Hrashima, “Glare

Generation based on wave optics”, Pacific Graphics, 2004.

[6]. M. Hullin, E. Eisemann, H.-P. Seidel, S. Lee, "Physically-Based Real-Time

Lens Flare Rendering", ACM Transaction on Graphics, vol. 30, pp. 108:1-9, 2011.

[7]. S. Lee., E. Eisemann, "Practical Real-Time Lens-Flare Rendering", Computer

Graphics Forum, vol. 32, 4, pp. 1–6, 2013.

[8]. T. J. van den Berg, M. P. Hagenouw, J. E. Coppens, "The ciliary corona: physical

model and simulation of the fine needles radiating from point light sources",

Investigative ophthalmology & visual science, vol. 46, 7, pp. 2627-2632, 2005.

[9]. T. Ritschel, M. Ihrke, J. R. Frisvad, J. Coppens, K. Myszkowski, H.-P. Seidel,

"Temporal Glare: Real-Time Dynamic Simulation of the Scattering in the Human Eye",

Computer Graphics Forum, vol. 28, 2, pp. 183–192, 2009.

[10]. T. Smith, J. Guild, "The CIE colorimetric standards and their use", Transactions

of the Optical Society, vol. 33, 3, pp. 73, 1931.

Page 48: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

40

[11]. National Gallery, Further information relating to examination of SPD Curves,

http://research.ng-london.org.uk/scientific/spd, 2016

[12]. Z. Wang, A. C. Bovik, H. R. Sheikh, E. P. Simoncelli, "Image quality assessment:

from error visibility to structural similarity", IEEE transactions on image processing,

vol. 13, 4, pp. 600-612, 2004.

Page 49: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

41

논 요약

상 즈 어 편집 법

자 컴퓨 공 과

이 상 민

고스트, 보 , 그리고 즈 어 등 효과는 카 라 즈시스 에

히 일어나며, 이미지를 사실 느끼게 는데 요 역 다. 특히 즈

어는 회 효과 , 푸리에 트랜스폼 조리개 이미지에 용 경우 얻

있다. 그러나 조리개 모양 회 후에 생 과 간 연결 어있

에 미리 회 결과 모양 고 그를 편집 는 것 쉽지 않다. 본

논 일 인 조리개 모양 개 주요 요소 추상 다.

추상 조리개는 일 인 조리개에 곡 가장자리 앙부 근

심이며, 이는 회 모양에 뾰족 날 모양과 앙부 모양 각각

다. 우리는 이 추상 조리개를 변경, 푸리에 트랜스폼 용, 회 , 그리고

합 여 새 운 회 모양 만들어 낸다. 또 우리가 공 임워크는 회

모양 변경 있는 개 인 인 페이스를 공 며, 사용자는 이를

사용 여 실 사 모양 결과를 생 있다.

주 어: 즈 어, 회 합 , 회 변경 법, 고속 푸리에 트랜스폼

Page 50: New Disclaimercg.skku.edu/pub/korean/thesis/2017-lee-thesis.pdf · 2019. 1. 1. · glare images based on physics. Previous work built a 2D aperture image including pupils and eyelashes

Inte

ractiv

e E

xpre

ssiv

e E

ditin

g o

f Lens F

lare

Effe

ct

2016

Sangm

in L

ee