BRDFLIB - software library for reflectance functions .fr

Dec 30, 2011 - 4.2 BRDFs performance tests results. .... variables used in Eq. 1.5 and in the rest of this thesis, see Table 1.2. BRDFs can have several ...... other words, PDF should resemble BSDF function as close as it possible. There is.
9MB taille 26 téléchargements 674 vues
Czech Technical University in Prague Faculty of Electrical Engineering Department of Computer Graphics and Interaction

Master's Thesis

BRDFLIB - software library for reectance functions Bc. Ji°í Nekola

Supervisor:

doc. Ing. Vlastimil Havran, Ph.D.

Study Programme: Open Informatics

Field of Study: Computer Graphics and Interaction

December 30, 2011

iv

v

Aknowledgements Here I would like to thank Vlastimil Havran for supervising and leading this thesis, as well as to my parents and my girlfriend for their support during the work on it.

vi

vii

Declaration I hereby declare that I have completed this thesis independently and that I have listed all the literature and publications used. I have no objection to usage of this work in compliance with the act Ÿ60 Zákon £. 121/2000Sb. (copyright law), and with the rights connected with the copyright act including the changes in the act.

In Praha on December 29, 2011

.............................................................

viii

Abstract BRDFLib is a library written in C++ programming language, providing a set of bidirectional reectance distribution functions (BRDF) models, which mathematically describe the visual properties of materials and are used for photorealistic image synthesis. The purpose of this library is then to provide developers with comprehensive, intuitive interface for working with this set of BRDF models that can be simply used for creation of their own rendering applications. The aim of this work is to unite BRDFLib library and its already implemented models respectively and then extend it with several new models.

Another important part of this

work is design and implementation of visualization application, that will use this library and provide to user an interface for testing and studying various BRDF models. Beside the BRDF visualization, the application will dispose of rendering tools that allow user to verify the correct model behavior.

Abstrakt BRDFLib je knihovna napsaná v jazyce C++, poskytující sadu funkcí odrazivosti povrchu (dvousm¥rová funkce odrazivosti povrchu, angl. BRDF), které matematicky popisují vizuální vlastnosti materiál· a pouºívají se pro fotorealistickou syntézu obrazu. Ú£elem této knihovny je pak poskytovat vývojá°·m ucelené a intuitivní rozhraní pro práci s touto sadou BRDF model·, kterou mohou jednodu²e vyuºít p°i tvorb¥ svých vlastních renderovacích aplikací. Cílem této práce je sjednotit knihovnu BRDFLib, resp. v ní jiº implementované modely a následn¥ ji pak o n¥kolik dal²ích model· roz²í°it. Nemén¥ d·leºitou £ástí této práce je dále návrh a tvorba aplikace, která bude knihovnu BRDFLib vyuºívat a poskytovat uºivatel·m rozhraní pro testování a studování jednotlivých BRDF model·. Aplikace bude krom¥ vizualizace BRDF disponovat i nástroji pro renderování, díky nimº lze správné chování model· ov¥°it.

ix

x

Contents 1 Introduction

1

1.1

Realistic image synthesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1.2

Radiometry

1.3

Description of surface reectance with BRDF

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2 3

1.3.1

BRDF denition, basic properties . . . . . . . . . . . . . . . . . . . . .

3

1.3.2

BRDF functionality

. . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

1.3.3

BRDF generalization . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

1.3.4

Importance sampling (Monte Carlo integration) . . . . . . . . . . . . .

7

1.3.5

Integral characteristics of BRDF

. . . . . . . . . . . . . . . . . . . . .

8

1.3.6

Reectance and transmittance via Fresnel Equations . . . . . . . . . .

9

1.3.6.1

Fresnel Equations

. . . . . . . . . . . . . . . . . . . . . . . .

9

1.3.6.2

Schlick Approximation . . . . . . . . . . . . . . . . . . . . . .

10

1.4

BRDF models classication

1.5

Forms of BRDF representation

1.6

. . . . . . . . . . . . . . . . . .

1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10 12

1.5.1

Storage and interpolation of BRDF samples . . . . . . . . . . . . . . .

12

1.5.2

Explicit parametric function . . . . . . . . . . . . . . . . . . . . . . . .

12

1.5.3

More complex mathematical models

Existing BRDF models overview

. . . . . . . . . . . . . . . . . . .

13

. . . . . . . . . . . . . . . . . . . . . . . . .

14

2 Reectance models library - BRDFLib

21

2.1

Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

2.2

Library design and its properties

22

2.3

Library interface

2.4

Library components

2.5

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23 24

2.4.1

Components overview

. . . . . . . . . . . . . . . . . . . . . . . . . . .

24

2.4.2

Detailed description of BRDFLib classes . . . . . . . . . . . . . . . . .

24

Implemented BRDF models . . . . . . . . . . . . . . . . . . . . . . . . . . . .

32

2.5.1

Implemented models overview . . . . . . . . . . . . . . . . . . . . . . .

32

2.5.2

Description of implemented models . . . . . . . . . . . . . . . . . . . .

33

2.5.2.1

Lambertian, 1760

. . . . . . . . . . . . . . . . . . . . . . . .

33

2.5.2.2

Minnaert, 1941 . . . . . . . . . . . . . . . . . . . . . . . . . .

34

2.5.2.3

Oren-Nayar, 1994

. . . . . . . . . . . . . . . . . . . . . . . .

34

2.5.2.4

Ideal mirror reector . . . . . . . . . . . . . . . . . . . . . . .

35

2.5.2.5

Ideal metallic reector . . . . . . . . . . . . . . . . . . . . . .

35

2.5.2.6

Specular reector

35

. . . . . . . . . . . . . . . . . . . . . . . .

xi

CONTENTS

xii

2.5.2.7

Ideal dielectric

2.5.2.8

Ideal diuse refractor

. . . . . . . . . . . . . . . . . . . . . . . . . .

36

2.5.2.9

Ideal refractor

2.5.2.10

Phong, 1975

2.5.2.11

Phong physical, 1994

. . . . . . . . . . . . . . . . . . . . . .

37

2.5.2.12

Phong grazing mirror

. . . . . . . . . . . . . . . . . . . . . .

38

2.5.2.13

Phong physical with deterministic reection . . . . . . . . . .

39

2.5.2.14

Blinn-Phong, 1994 . . . . . . . . . . . . . . . . . . . . . . . .

39

2.5.2.15

Lafortune, 1997

2.5.2.16

Neumann-Neumann-Kalos, 1998

2.5.2.17

Coupled Model (Shirley-Hu-Smits-Lafortune), 1997 . . . . . .

40

2.5.2.18

Phong anisotropic (Ashikhmin-Shirley), 2000 . . . . . . . . .

40

2.5.2.19

Beard-Maxwell, 2002 . . . . . . . . . . . . . . . . . . . . . . .

42

2.5.2.20

Cook-Torrance, 1982 . . . . . . . . . . . . . . . . . . . . . . .

43

2.5.2.21

Schlick (Survey), 1994 . . . . . . . . . . . . . . . . . . . . . .

43

2.5.2.22

Cook-Torrance simplied (Kelemen-Kalos), 2001

2.5.2.23

Kurt-Kalos-Krivanek, 2010

2.5.2.24

Ward, 1992 . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46

2.5.2.25

Ward-Dür, 2006

. . . . . . . . . . . . . . . . . . . . . . . . .

46

2.5.2.26

Moroder-Dür, 2010 . . . . . . . . . . . . . . . . . . . . . . . .

47

2.5.2.27

Neumann, 1999 . . . . . . . . . . . . . . . . . . . . . . . . . .

47

2.5.2.28

Layered mixture

49

. . . . . . . . . . . . . . . . . . . . . .

36

. . . . . . . . . . . . . . . . . . . . . . . . . .

36

. . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

37

39 39

. . . . . . .

44

. . . . . . . . . . . . . . . . . . .

45

. . . . . . . . . . . . . . . . . . . . . . . . .

3 BRDF visualization application - BRDFVis

51

3.1

Basic requirements

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

51

3.2

Application design

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

52

3.3

Application structure and hierarchy . . . . . . . . . . . . . . . . . . . . . . . .

53

3.4

Detailed description of application components

. . . . . . . . . . . . . . . . .

54

. . . . . . . . . . . . . . . .

54

3.4.1

3.4.2

3.4.3

BRDFVis application - main component 3.4.1.1

Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

55

3.4.1.2

Resource provider

. . . . . . . . . . . . . . . . . . . . . . . .

55

3.4.1.3

Help provider . . . . . . . . . . . . . . . . . . . . . . . . . . .

56

3.4.1.4

Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

56

3.4.1.5

Error collector

56

. . . . . . . . . . . . . . . . . . . . . . . . . .

BRDF widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

3.4.2.1

GL widget

. . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

3.4.2.2

Path tracer . . . . . . . . . . . . . . . . . . . . . . . . . . . .

58

3.4.2.3

BRDF model GUI . . . . . . . . . . . . . . . . . . . . . . . .

58

3.4.2.4

Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

59

3.4.2.5

Animation manager

. . . . . . . . . . . . . . . . . . . . . . .

60

3.4.2.6

Error organizer . . . . . . . . . . . . . . . . . . . . . . . . . .

60

3.4.2.7

Performance tester . . . . . . . . . . . . . . . . . . . . . . . .

60

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

61

3.5

Connection to BRDFLib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

62

3.6

Core functionality 3.6.1

Resource manager

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

63

BRDF visualization mode . . . . . . . . . . . . . . . . . . . . . . . . .

63

CONTENTS

3.7

xiii

3.6.2

Point light mode (direct illumination)

3.6.3

Environmental mapping mode . . . . . . . . . . . . . . . . . . . . . . .

64

3.6.4

Path tracing mode

68

Additional functionality

. . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

64

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

70

3.7.1

Manipulation with BRDF models . . . . . . . . . . . . . . . . . . . . .

70

3.7.2

Conguration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

70

3.7.3

Export of rendered image

. . . . . . . . . . . . . . . . . . . . . . . . .

72

3.7.4

Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

72

3.7.5

BRDF performance testing

. . . . . . . . . . . . . . . . . . . . . . . .

73

3.7.6

BRDF help

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

73

3.7.7

Multi-layered models support . . . . . . . . . . . . . . . . . . . . . . .

74

4 Results

77

4.1

BRDF models verication

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

77

4.2

BRDF performance measurement . . . . . . . . . . . . . . . . . . . . . . . . .

93

4.3

Application usability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

94

4.4

Application testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

97

5 Conclusion and future work 5.1

Future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

99 99

A List of abbreviations

107

B Previous work on the project

109

C Installation and user guide

111

D Conguration les syntax

113

E DVD Content

117

xiv

CONTENTS

List of Figures a)

dierential area,

b)

1.1

Hemispherical geometry:

. . . . . . . . . .

2

1.2

Bidirectional reectance distribution function. . . . . . . . . . . . . . . . . . .

solid angle.

4

1.3

Bidirectional scattering distribution function as a sum of BRDF and BTDF. .

6

1.4

Importance sampling.

7

1.5

Reection coecient given by Fresnel equations as a function of incident angle. 10

2.1

BRDFLib functionality overview. . . . . . . . . . . . . . . . . . . . . . . . . .

25

2.2

Implemented BSDF models hierarchy.

. . . . . . . . . . . . . . . . . . . . . .

33

2.3

Snell's law.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

36

2.4

Microfacet geometry.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Upper left: Surface composed of microfacets.

Upper

right: single V-cavity with normal A. Bottom row: Interaction between microfacets, form left to right: interreection, masking, shadowing.

. . . . . . .

41

2.5

Geometry of the BRDF denition by Neumann. . . . . . . . . . . . . . . . . .

48

2.6

Principle of layered mixture BRDF. . . . . . . . . . . . . . . . . . . . . . . . .

49

3.1

BRDFVis structure overview.

. . . . . . . . . . . . . . . . . . . . . . . . . . .

54

3.2

BRDFVis application UI.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

55

3.3

BRDF widget and its parts. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

3.4

Examples of UI elements for BRDF a) boolean parameter, b) texture parameter, c) Fresnel term, d) layer

. . . . . . . . . . . . . . . . . . . . . . . . . . .

59

3.5

BRDF Performance tester. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

61

3.6

Resource manager UI.

62

3.7

BRDF visualization examples a) visualization by shape, b) visualization by

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

pseudocolor on unit hemisphere, c) visualization by shape using pseudocolor, d) visualization by direct BRDF value on unit hemisphere, e) visualization with auxiliary unit hemisphere, f ) triangulation of the visualization shape. . .

65

3.8

Point light mode

66

3.9

Environmental mapping mode performed by a) Importance sampling b) Direct

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

illumination method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

67

3.10 Path tracing mode. a) Scene preview with direct lighting only using OpenGL b) path tracing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

68

3.11 BRDF referencing feature. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

71

3.12 Animation manager.

72

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.13 BRDF parameter description area.

. . . . . . . . . . . . . . . . . . . . . . . .

75

3.14 UI for arbitrary layered BRDF models. . . . . . . . . . . . . . . . . . . . . . .

75

xv

LIST OF FIGURES

xvi

4.1

Comparison of Ward-Dür BRDF model results with reference images. . . . . .

78

4.2

Moroder-Dür BRDF analysis for high incident angles.

80

4.3

Comparison of isotropic Kurt-Kalos-Krivanek BRDF model with reference

4.4

Comparison of anisotropic Kurt-Kalos-Krivanek BRDF model with reference

4.5

Reference image of comparison between original Phong and its normalized form. 83

4.6

Comparison of original Phong model with its physically plausible version (normalized form) in our implementation. . . . . . . . . . . . . . . . . . . . . . . .

83

4.7

Physical implausibility of original Phong BRDF model. . . . . . . . . . . . . .

84

4.8

Oren-Nayar BRDF model experimental analysis.

. . . . . . . . . . . . . . . .

85

4.9

Minnaert BRDF model experimental analysis. . . . . . . . . . . . . . . . . . .

86

4.10 Neumann BRDF verication for s = 2. . . . . . . . . . . . . . . . . . . . . . .

87

. . . . . . . . . . . . .

image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . images.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

81 82

4.11 Neumann BRDF verication for s = 5. . . . . . . . . . . . . . . . . . . . . . .

88

4.12 Neumann BRDF verication for s = 20.

. . . . . . . . . . . . . . . . . . . . .

89

4.13 Example of usage of layered mixture BRDF. . . . . . . . . . . . . . . . . . . .

91

4.14 Visualization of layered mixture BRDF.

. . . . . . . . . . . . . . . . . . . . .

92

4.15 Execution times for 1 000 000 evaluations of BSDF. . . . . . . . . . . . . . . .

96

4.16 Execution times for 1 000 000 evaluation of method for stochastic rays spawning. 96

List of Tables 1.1

Radiometric quantities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2

1.2

BRDF notation and terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

5

4.1

Test machine conguration

. . . . . . . . . . . . . . . . . . . . . . . . . . . .

94

4.2

BRDFs performance tests results. . . . . . . . . . . . . . . . . . . . . . . . . .

95

D.1

BRDF parameters settings conguration le syntax.

D.2

Application settings conguration le syntax.

D.3

BRDF widget settings conguration le syntax, part 1. . . . . . . . . . . . . . 115

D.4

BRDF widget settings conguration le syntax, part 2. . . . . . . . . . . . . . 116

xvii

. . . . . . . . . . . . . . 113

. . . . . . . . . . . . . . . . . . 114

xviii

LIST OF TABLES

Chapter 1

Introduction In the pursuit of lifelike images, artists have attempted to understand the behavior of light and its propagation in the environment, as well as the characteristics of perception. Principles of optics have been studied for many years, but with the advent of computers and a signicant rise of computer graphics in the last 40 years, this knowledge gained an entirely new dimension.

Based on the application of this knowledge, there were developed many

techniques that signicantly improves quality and visual authenticity of computer rendered images.

In the last few years computer graphics got to the stage, where it is almost im-

possible to distinguish these images from photographs of a real world, taken with a camera. Ability to create such a realistic images is one of the main reasons why computer graphics has so widespread usage across many sectors of human activity such as entertainment, art, architecture, cinematography, and many others.

1.1 Realistic image synthesis One of the many goals of computer graphics is the generation of images by a computer in such a way that they appear to an observer as if they were real photographs.

To create

photo-realistic images, the lighting and shading computations should be based on physical principles. The input to a physically based light transport simulation is a full description of the scene to be rendered. This description includes the 3D geometry, the material properties, the emission characteristic of the light source and a virtual camera. Over the last few centuries physicists have developed mathematical models, describing interaction between the light and surfaces as well as the light propagation through an environment. With the advent of the computer it has become practical to evaluate such models on a large enough scale to simulate complex phenomena.

Using a computer, a model of

light reection and propagation can be evaluated for a scene, whose geometry and material properties have been specied numerically. scene that does not exist in reality.

In eect, a photograph can be taken of a

The ability to create images of nonexistent environ-

ments is important to many applications ranging from industrial design to advertising and entertainment. As an addition, phenomena not accessible to normal visual experience can also be visualized by applying the illumination model to other forms of three-dimensional data. For ex-

1

CHAPTER 1. INTRODUCTION

2

ample, data from magnetic resonance imaging can be rendered to provide three-dimensional images of the body interior. The creation of images by evaluating a model of light propagation is called image synthesis and has been studied extensively in the eld of computer graphics since the 1970s. The goal of image synthesis is often stated as photo-realism.

However, this method of generating

lifelike images is very computationally expensive, and therefore modern trends in this eld deals with an ability to generate such images in a real time. This idea is supported, among others, by hardware manufacturers and so we can expect, that the eld of realistic image synthesis usage will grow in the near future.

1.2 Radiometry Radiometry is the eld of study involved with the measurement of electromagnetic radiation, including, but not limited to, visible light. Although rarely used directly in real-time computer graphics, knowing the basic radiometric quantities and the related formulas helps to understand the simplications and approximations typically used in rendering equations. Light is a form of electromagnetic radiation and understanding of its nature requires studying of many dierent disciplines, such as geometrical optics, physical or wave optics, quantum or photon optics, transport theory, radiometry and photometry. The hemispherical geometry used through all the theories about light is shown in Fig. 1.1 [4].

Figure 1.1: Hemispherical geometry:

a)

dierential area,

b)

solid angle.

In order to better understand the phenomena of light propagation, we need to introduce some physics background, most of it coming from the

Q Φ L E B I

Radiometric quantity Radiant energy Radiant power Radiance Irradiance Radiosity Radiant intensity

radiometry

(see Table 1.1).

Units

(ux) (angular ux density) (incident ux density) (outgoing ux density)

Table 1.1: Radiometric quantities

J = [kg·m2 /s2 ] W = [joules/s] W/(m2 sr) W/m2 W/m2 W/sr

1.3. DESCRIPTION OF SURFACE REFLECTANCE WITH BRDF Radiant

energy

photons carry.

Q

is measured in

Radiant

ux

Φ

joules

and can be thought as the total energy that

n

is the energy owing through a surface per unit time [13]:

Φ = dQ/dt The

3

[W ] .

(1.1)

radiance L is power per unit projected area perpendicular to the ray per unit solid angle

in the direction of the ray (see Fig. 1.1).

L(x, ω) =



dΦ cos θ dA dω

h W i . m2 sr

(1.2)

Irradiance E is the total energy per unit area incident onto a surface with a xed orientation and radiosity B is the total outgoing energy per unit are E(x) =



Z Ω

hW i , m2

Lin (x, ω ~ in ) cos θin dωin

Intensity I



Z

B(x) =





Lout (x, ω ~ out ) cos θout dωout



hW i m2

.

(1.3)

denes the ratio of ux with respect to solid angle, i.e.

it describes the ux

arriving or leaving a single point [4]:

hW i

I = dΦ/dω

sr

.

(1.4)

The above quantities generally also vary with the wavelength of light.

spectral radiance Lλ

is dened as

dL/dλ.

For example,

In computer graphics spectral quantities are

usually represented with the help of basis functions dened over the spectrum. For example, the RGB color space is commonly used. For each channel

Lr , Lg ,

and

Lb ,

R , G,

or

B

there is one sample,

which are the coecients of the corresponding basis functions [13].

1.3 Description of surface reectance with BRDF In order to suciently simulate light interaction with various materials, one need to describe the properties of its surface. The most famous form of such a description is BRDF.

1.3.1 BRDF denition, basic properties Surface visual properties can be described by mathematical formula, called BRDF. The bidirectional reectance distribution function (BRDF;

fr (ω ~ in ,ω ~ out ))

function that denes how light is reected at an opaque surface. incoming light direction, surface normal and the

~, N

ω ~ in ,

and outgoing direction,

ω ~ out ,

and returns the ratio between reected

irradiance E

both dened with respect to the

radiance Lout

incident on the surface from direction

fr (x, ω ~ in , ω ~ out ) =



Note that each direction

is a four-dimensional

The function takes an

dLout (x, ω ~ out ) dLout (x, ω ~ out ) ~ ) = L (x, ω cos θ d~ω dE(x, ω ~ ) out in in in in



ω ~

exiting along

ω ~ out

ω ~ in :

[sr−1 ] .

(1.5)



is itself parametrized by azimuth angle

ϕ and zenith angle θ, sr−1 , with steradians

therefore the BRDF as a whole is 4-dimensional. The BRDF has units

CHAPTER 1. INTRODUCTION

4

Figure 1.2: Bidirectional reectance distribution function.

(sr ) being a unit of solid angle. All mentioned quantities are shown in Fig. 1.2. For a list of variables used in Eq. 1.5 and in the rest of this thesis, see Table 1.2. BRDFs can have several further properties. Depending on the intended usage some may be more desirable than others. Here is a collection of the most important ones [47]: 1.

Energy conservation,

that is no more energy can be reected than is received, which

can be simply described by following equation :

Z Ω 2.

Lout (x, ω ~ out ) dω ≤ Li (x, ω ~ in ).



(1.6)



Helmholtz reciprocity, that is BRDF will remain unchanged if the incident and reected directions are interchanged, that is:

fr (x, ω ~ in , ω ~ out ) = fr (x, ω ~ out , ω ~ in ) .



3.

Anisotropy. and

θout

(1.7)



If a BRDF depends only on the elevation components of

ω ~ in

and

ω ~ out , θin

, it is rotationally symmetric with respect to the surface normal. Such BRDFs

are called

isotropic

and can be described by following equation:

fr (x, θin , ϕin , θout , ϕout ) = fr (x, θin , θout , ϕout − ϕin ) .





(1.8)

BRDFs that change their value as the surface is rotated around the surface normal are called

anisotropic.

brushed metal.

Some materials exhibit anisotropic reection, e.g. the often cited

1.3. DESCRIPTION OF SURFACE REFLECTANCE WITH BRDF

Variable

Meaning

dω , dA λ

dierential solid angle, dierential area wavelength of light wave point on the surface (hit point) normal to the surface at the point x incoming (illumination) direction outgoing (viewing) direction polar coordinates for ω ~ in polar coordinates for ω ~ out mirror reected ray ~ +ω~in ) ) half-vector between ω ~ out and ω ~ in (h = (ωout 2 polar coordinates for ~h ~ = ~h ) normalized ~h (H |~ h| ~ polar coordinates for H ~ ~ angle between H andN (equal to θH ) incident radiance reected radiance bidirectional reectance distribution function (BRDF) bidirectional scattering distribution function (BSDF) bidirectional transmission distribution function (BTDF) probability density function albedo at the hit point for a given incoming direction albedo for diuse/specular part of BRDF reection coecient for diuse/specular part of BRDF usual notation for positive part : (X)+ = max(0, X)

x N~

ω ~ in ω ~ out (θin , φin ) (θout , φout ) ~m R ~h (θh , φh ) ~ H

(θH , φH ) δ Lin Lout fr (x, ω ~ in , ω ~ out ) fs ( x, ω ~ in , ω ~ out ) ft ( x, ω ~ in , ω ~ out ) p(~ ω in ) a(x,ω ~ in ) ρd , ρs kd , ks (X)+

Table 1.2:

4.

5

Wavelength dependency.

BRDF notation and terms

For most materials the BRDF will be a spectral term, i.e.

light of dierent wavelengths will be reected dierently, giving the material a colored appearance. Often, this wavelength dependence is taking into account by separation of BRDF into the RGB color channels.

x, the underlying material is called spatially called homogeneous and therefore we can simplify

In the case the BRDF depends on the position

varying

or

shift-variant,

the notation varying.

otherwise, it is

fr (x, ω ~ in , ω ~ out )



to

fr (~ ωin , ω ~ out ).

Almost all real-world materials are spatially

1.3.2 BRDF functionality More interesting than the dierential radiance leaving a surface due to reection of dierential irradiance from a particular direction is the exitant radiance due to irradiance from all directions. Here an important feature of light/surface interaction has to be mentioned: light coming from one incident direction has no inuence on the amount of reected/refracted light coming from other incident directions. Therefore, reection behaves linearly, and hence the total amount of light reected by a surface in a specic direction is given by a hemispherical integral over all possible incident directions described by the as

local reectance integral

[4]:

reectance equation, also known

CHAPTER 1. INTRODUCTION

6

Z Lout (~ ωout ) = Ωi

fr (x, ω ~ in , ω ~ out ) Lin (~ ωin ) cos θin dωin .



(1.9)

In other words, the reected radiance in a particular direction is due to the radiance arriving from all directions weighted by the BRDF relating the incoming and reected directions and by the projected solid angle. The distribution of light in a scene is completely captured by the radiance equation which implicitly describes the radiance distribution distribution

L

L [13].

The problem is that the radiance

is described implicitly. The outgoing vacuum, time-invariant, gray radiance

equation is shown below:

Lout (x, ω ~ out ) = L (~ ωout ) +



e

Z Ωi

fr (x, ω ~ in , ω ~ out ) Lin (~ ωin ) cos θin dωin .



(1.10)

All the realistic image synthesis algorithms are based on solving the Eq. 1.10 by evaluating point samples of unknown radiance distribution function [13].

1.3.3 BRDF generalization The concept of the BRDF can easily be generalized to cover not only reection, but also transmission, and even re-emission of light at another position (subsurface-scattering). Although we meanwhile dealt only with BRDFs, it is usually useful to know more about the context and terminology. Transparent objects show, that light is not only reected at an interface between two media, but also passes (refracts) through it. This is called transmission and is represented by the bidirectional transmission distribution function (BTDF,

ft (ωin , ω ~ out )).

All the basic

properties of BRDF, like energy conservation or reciprocity, applies also on BTDF. Transmission is also known as refraction. Usually one or more BRDFs and BTDFs are combined into the bidirectional scattering distribution function (BSDF,

fs (~ ωin , ω ~ out )))

of a material (see Fig. 1.3). The BSDF is used

to characterize the complete scattering process at a single point of the surface, where part of light is absorbed by the material, part is reected and another part is transmitted into it.

Figure 1.3: Bidirectional scattering distribution function as a sum of BRDF and BTDF.

1.3. DESCRIPTION OF SURFACE REFLECTANCE WITH BRDF

7

If the material features a signicant amount of subsurface light transport, the bidirectional scattering surface reectance distribution function (BSSRDF) has to be used, since the assumption that light leaves the surface where it entered is no longer true. Snow and human skin are examples for such materials. Modeling subsurface scattering is an interesting topic and has been an very active area of research recently.

partially taken from

The text for this paragraph was

[47, page 8].

1.3.4 Importance sampling (Monte Carlo integration) Suppose that we want to calculate the radiance of a point in direction

ω ~ out

due to illumina-

tion of the scene. Since the integration of contributions from all possible directions would be prohibitively computationally expensive, in practice only several samples of incoming directions are chosen and the correct value is estimated from them. It is known as Monte Carlo integration. In mathematics, Monte Carlo integration is numerical integration using random numbers.

That is, Monte Carlo integration methods are algorithms for the approximate

evaluation of denite integrals, usually multidimensional ones. Disadvantage of this method is its variance, when only few random samples are used.

Importance Sampling: from given probability density function p(x) generate samples. Figure 1.4: Importance sampling.

Importance sampling (described e.g. in[35]) is an eective technique to reduce the variance of Monte-Carlo algorithms. It requires the generation of random samples according to a probability density, which is at least approximately proportional to the original integrand (see Fig. 1.4). In order to generate the output radiance

Lin

Lout

from the incident illumination

in Monte-Carlo ray-tracing, integral of Eq. 1.9 should be evaluated. If

ability density and directions

ω ~ in,1 , ω ~ in,2 ,

... ,

ω ~ in,M

p(~ ωin )

is a prob-

are sampled following this probability

distribution, then the Monte-Carlo estimate of this integral is:

CHAPTER 1. INTRODUCTION

8

M fr (x, ω ~ in,m , ω ~ out ) cos θin,m 1 X Lout (x, ω ~ out ) ≈ Lin (~ ωin,m ) . M p(~ ω in,m )

(1.11)

m=1

According to the concept of importance sampling,

p(~ ωin )

should be approximately propor-

tional to the integrand to minimize the variance of the solution. If no a-priori information is

Lin , then it is assumed to be proportional to Lin fr (x, ω ~ in , ω ~ out ) cos θin .

available about be

constant, thus the probability density should



1.3.5 Integral characteristics of BRDF The basic integral characteristic of BRDF - its evaluation was mentioned in previous sections and was generally described by Eq. 1.9. Beside that, there is several another integral properties, that is important to mention. Energy conservation condition, described by Eq. 1.6, is equivalent with the condition for the ratio between outgoing and incoming radiance

∀~ ωin Ω : The

fr .

a(x, ω ~ in )



a(x, ω ~ in ) =



Z Ω

Lo , Li

:

fr (x, ω ~ in , ω ~ out ) cos θout d~ ωout ≤ 1 .

(1.12)



is quantity, called directional-hemispherical reectivity or shortly

albedo

of

Albedo is the wavelength-dependent reectivity or reecting power of a surface. Being a

dimensionless fraction, it may also be expressed as a percentage, and is measured on a scale from zero for no reecting power of a perfectly black surface, to 1 for perfect reection of a white surface. In general, the albedo depends on the directional distribution of incoming radiation.

Exceptions are Lambertian surfaces, which scatter radiation in all directions

according to a cosine function, so their albedo does not depend on the incident distribution. In practice, a BRDF may be required to characterize the scattering properties of a surface accurately, although the albedo is a very useful rst approximation. In addition to direction-dependent albedo dened by Eq. 1.12, we can also introduce the notion of

mean albedo

[37]. This direction-independent and dimensionless value is equal to

reectivity for diuse materials. For non-diuse materials it can be dened as weighted mean value of direction-dependent albedos :

a(x)mean =



1 π

Z Ω

a(x, ω ~ in ) cos θin d~ ωin =



where weighting factor is

cos θin .

1 π

Z Z Ω



fr (x, ω ~ in , ω ~ out ) cos θout d~ ωout d~ ωin ,



(1.13)

In the case of uniform illumination on the half-space,

the value of the mean albedo is equal to the ratio of the reected and the incident power. The BRDF and the albedo characterize a material from two dierent aspects. The BRDF is used to describe the reected radiance and it is a scalar, which depends on both

ω ~ out .

The albedo depending only on direction

ω ~ in ,

power. The mean albedo (which does not depend on reectivity of the BRDF.

ω ~ in

and

serves for the description of the reected

ω ~ in

and

ω ~ out ) characterizes the average

1.3. DESCRIPTION OF SURFACE REFLECTANCE WITH BRDF

9

1.3.6 Reectance and transmittance via Fresnel Equations The amount of light reected and refracted at an interface is a function of the wavelength of the incident light, the geometry of the surface and light, and the angle of incidence. The Fresnel equations (or Fresnel conditions or formula), deduced by Augustin-Jean Fresnel, describe the behavior of light when moving between media of diering refractive indices. The reection of light that the equations predict is known as Fresnel reection [13].

1.3.6.1 Fresnel Equations Fresnel formula are dierent for conductors and dielectrics. Conductors have complex index of refraction given by

N = η + jκ.

Fresnel equation (two polarized components of light

wave) for metals (conductors) is as following:

a2 + b2 − 2a cos θin + cos2 θin , a2 + b2 + 2a cos θin + cos2 θin a2 + b2 − 2a sin θin tan θin + sin2 θin tan2 θin = Fs 2 , a + b2 + 2a sin θin tan θin + sin2 θin tan2 θin

Fs = F⊥ = Fp = Fk where

a

and

b

(1.14)

are given by

p (η 2 − κ2 − sin2 θin )2 + 4η 2 κ2 + (η 2 − κ2 − sin2 θin ), p = (η 2 − κ2 − sin2 θin )2 + 4η 2 κ2 − (η 2 − κ2 − sin2 θin ) ,

2a2 = 2b2 and

η

is

relative

complex index of refraction given by the ratio of two complex indices of

refraction

N =

N1 η1 + jκ1 η1 + jκ1 η2 − jκ2 η1 η2 + κ1 κ2 η1 η2 − κ1 κ2 = = = +j = η + jκ . 2 2 N2 η2 + jκ2 η2 + jκ2 η2 − jκ2 η2 + κ2 η22 + κ22

For dielectrics index of refraction is a real number, therefore relative index of refraction for two interface media is simply

η = η2 /η1 .

Fresnel equation (two polarized components of

light wave) for dielectrics is as following:

 cos θout / cos θin − 1/η 2 sin2 (θin − θout ) = , cos θout / cos θin + 1/η sin2 (θin + θout )   cos θin / cos θout − 1/η 2 tan2 (θin − θout ) = = . cos θin / cos θout + 1/η tan2 (θin + θout ) 

Fs = F⊥ = Fp = Fk The reectance

F

(1.15)

for both conductors and dielectrics for unpolarized light is given by a

F = (Fs +Fp )/2. The transmittance is simply Tf = 1−F . 0 Note that when θ = 90 , then Fs = Fp = 1, regardless of the constants η and κ. For 0 normal incidence (θ = 0 ) Fresnel coecient F0 simplies to: half-sum of polarized components:

 F0 =

η − 1 η + 1

2 ,

for dielectrics

,

F0 =

(η − 1)2 + κ2 , (η + 1)2 + κ2

for conductors

,

(1.16)

CHAPTER 1. INTRODUCTION

10

Figure 1.5: Reection coecient given by Fresnel equations as a function of incident angle.

The reectance at grazing angles achieves its maximum and correspondingly transmittance achieves its minimum and vice versa (see Fig. 1.1). At one particular angle for a given

η1

and

η2 ,

the value of

This angle is known as air or vacuum.

Fp

goes to zero and a p-polarised incident ray is purely refracted.

Brewster's angle,

and is around 56 degrees for a glass medium in

Note that this statement is only true when the refractive indices of both

materials are real numbers, as is the case for materials like air and glass. For materials that absorb light, like metals and semiconductors,

η

is complex, and

Fp

does not generally go to

zero. When moving from a denser medium into a less dense one (i.e.,

η1 > η2 ), there is an Fs = Fp = 1.

incidence angle known as the critical angle, where all light is reected and This phenomenon is known as

total internal reection.

The critical angle is approximately

41 degrees for glass in the air.

1.3.6.2 Schlick Approximation Fresnel equations are rather complex and for amount of rendering applications a simple approximation could be enough.

Schlick developed such an accurate approximation for

dielectrics [45]:

F (θ) ≈ F0 + (1 − F0 )(1 − cos θin )5 , where

F0

(1.17)

is described by Eq. 1.16.

1.4 BRDF models classication There are several points of view by which BRDF models can be classied. Some of them we have already encountered in previous sections. Let us briey recall their principles, together with new classication criterias:

1.4. BRDF MODELS CLASSIFICATION • Anisotropy.

11

Is the property of being directionally dependent, as opposed to

isotropy,

which implies identical properties in all directions. An anisotropic surface will change in appearance as it is rotated about its geometric normal, as is the case with velvet, wood or metal. In a same way we can classify BRDF models to isotropic and anisotropic ones, based on the fact that they do or do not include this direction dependency in their description.

• Model principle.

We can classify BRDF models by the principles, which they are

based on. From this point of view, BRDF models can either be theoretical or empirical. Both empirical and physically-based analytical BRDF models are only approximations of the reectance properties of real materials.

Some of these models are based on

material parameters that in principle could be measured, but in practice are dicult to acquire.

 Empirical models.

An empirical model is a function with adjustable parameters

that is designed to t measured reectance data for a certain class of materials. This sort of models is based just on the observation of results. A good example of such a BRDF is Ward reectance model [54].

Most empirical BRDF mod-

els enforce reciprocity at the cost of energy conservation (e.g., Lafortune [28] or Ashikhmin-Shirley[1]).

 Theoretical models.

They attempt to model the physics of light and materials

in order to reproduce the observed reectance properties. As it was suggested, they are physically based, and so they have a stronger theoretical basis than empirical models. Note, that does not implies that it is necessarily easier to t their parameters to measured BRDF data.

∗ Based on the geometrical optics.

,

As it is stated in [44] most of the currently

popular theoretical models start with the assumption that the large-scale BRDF is the result of ne-scale roughness of the surface.

This roughness

is described by a collection of microfacets with random sizes and orientations.

The statistical distribution of sizes has traditionally been taken to

be Gaussian, because this distribution is easy to work with and has many mathematically-desirable properties. Each facet is taken to be a perfect reector, obeying the physical laws of reection for dielectrics. It is assumed that light can interreect o of several facets before leaving the surface, and that the facets, due to their orientations, can occlude each other (= selfshadowing).

∗ Based on the propagation of electromagnetic waves.

This sort of BRDFs is

based on the fact, that light is a form of electromagnetic wave and its evaluation is then based on solving the electromagnetic wave equation. Although this approach is much more physically plausible than, for example, empirical models, propagation of electromagnetic waves through an environment is very complex phenomena, and therefore is very computationally expensive.

• Surface composition.

Another point of view for BRDF classication is the surface

description of the model. consists of single material.

Most of models deals with the assumption, that surface In that case, whole light scattering is performed on the

CHAPTER 1. INTRODUCTION

12

interface between the environment and material of the object. As an opposite for this case, there are BRDF models, assuming that surface is composed of several layers of non-negligible thickness.

An example of such a surface is lacquered wood.

Light

scattering for these multi-layered surfaces is usually much more complex approach, dealing with sub-surface scattering phenomena.

1.5 Forms of BRDF representation As was mentioned in the previous section, BRDFs for computer graphics can be generated from theoretical models or measured. However, they shares one important common property; they need suitable representations to store and compute them eciently. This is the summary of the basic techniques [44]:

1.5.1 Storage and interpolation of BRDF samples The simplest method of BRDF representation would be to sample the BRDF on some regular (or irregular) grid, and interpolate among the samples when needed. Despite its simplicity, it has a number of drawbacks for use in computer graphics. First, raw data obtained from measurement is likely to be noisy, as has already been seen by Ward [54, 31]. This leads to noisy surfaces in the images produced using these BRDFs. Because of the four degrees of freedom necessary for BRDF measurement, BRDF scans can take a very long time. For this reason, it is common to measure only a relatively small number of 2-D slices through the four-dimensional space [31].

As a result, interpolation

between these slices is not likely to yield a satisfactory value for the BRDF of intermediate points. Even if the sampled data were correct and complete (e.g. obtained from a theoretical model or Monte Carlo simulation), the storage of samples is very inecient because of the size of the BRDF. Storing a complete BRDF suciently densely for computer graphics needs is likely to require millions of points, and accessing this data during rendering would signicantly slow down a render. Again, it is the domain of computer graphics that places specic needs on the denseness at which BRDFs need to be stored.

1.5.2 Explicit parametric function A common tactic in graphics is to t measured BRDFs to analytic models. These models are typically described by a function approximating the course of BRDF, with a very small number of free parameters, and so the t can cope rather easily with noise and missing data. In addition, since only these best-t parameters need to be known to reconstruct a BRDF, their storage is very ecient. Nevertheless, using these theoretical models is problematic, because of computational complexity and the comparative lack of exibility. One of the most serious drawbacks of theoretical models is just their lack of exibility. Each model, to be mathematically feasible, must make certain restrictive assumptions on the class of surfaces it can model. One consequence of this has been the emergence of a large class of ad-hoc empirical models. One of the rst ad-hoc models was the Minnaert BRDF

1.5. FORMS OF BRDF REPRESENTATION

13

[33], developed to characterize the reectance of the moon. Models like these are often useful, but they cannot be seen as a good general solution in the domain of photorealistic rendering. Aside from issues of physical correctness, these models are applicable for only narrow classes of surfaces. It is very dicult, if such a solution exists, to nd a suciently exible model for representing arbitrary BRDFs, while maintaining a low number of parameters and therefore low storage, as well as computational simplicity. However, analytic models are still the most widely used method of BRDF representation.

1.5.3 More complex mathematical models In searching for the suciently exible representation of BRDF, there are another several approaches, how to do that eciently :

• Factored representation.

This technique is based on reparametrization of the ana-

lytical model of BRDF, followed by a compact and accurate decomposition into factors [30].

Four-dimensional BRDF is expressed as a sum of (a small number of ) terms,

each of which is the product of a two-dimensional function that depends only on view direction, and two one-dimensional functions. This representation allows ecient importance sampling by numerical inversion of the Cumulative Distribution Functions of the 1D factors.

• Splines.

One simple extension of interpolating raw data samples is to use spline

patches to represent the BRDF. In this way, a much sparser grid can be used, and the resulting BRDF is smoother.

In addition, noisy and missing data are not as

problematic, since they are handled by the spline tting algorithm. A further advantage is that the splines are relatively easy to compute. Nevertheless, a spline representation of a complete BRDF can still require a large amount of storage.

• Spherical harmonics.

A currently very common method of storing BRDFs is by

projecting them onto spherical harmonics. These are the spherical analogues of sines and cosines, in that they form a smooth orthonormal basis for functions on the sphere, and are localized in the frequency domain. These properties are useful, since it is easy to project a BRDF onto the basis of spherical harmonics, and since smooth, simple BRDFs will have fewer nonzero coecients than complex ones. The spherical harmonic representation is an attractive one for describing BRDFs, because of the mathematical and conceptual simplicity of the model.

Nevertheless, the number of coecients re-

quired to represent even moderately complex BRDFs is large. Very specular surfaces can be expected to require impractically large numbers of coecients to represent the sharp reective peaks accurately.

• Spherical wavelets.

One may summarize the problems with the spherical harmonic

representation by pointing out that though the basis functions are well-localized in the frequency domain, they are not at all localized in the spatial domain. Therefore, sharp features in the BRDFs will cause ringing in other areas unless a large number of coecients is used. On the other hand, representations that are localized in space, such as splines, require many coecients even when the surfaces are smooth. Therefore, what is really necessary are functions localized in both the spatial and frequency

CHAPTER 1. INTRODUCTION

14

domains. The research conducted into wavelets has shown that it is possible to nd such functions, group them into orthonormal bases, and develop ecient algorithms for computing them.

1.6 Existing BRDF models overview Many analytical BRDF models have been introduced over the past 40 years.

They dier

mainly in the exibility in which they can be used for dierent types of surfaces, but also in the complexity and the principles, which they are based on.

Here is a chronologically

ordered list of the most important / famous / popular ones, along with the brief description of their basic principles:

• Lambertian

 

(1760)

Isotropic, empirical. It is the simplest BRDF. Lambertian model [29] is often used as a model for diuse reection, where light, impacting the surface, is reected equally in all directions above the surface.

• Kubelka-Munk

 

Isotropic, physically based. Model, based on the optics of painted coatings [25].

• Minnaert

 

(1931)

(1941)

Isotropic, empirical. Model describing reciprocity, based on the lunar photometry [33].

• Hapke-Lommel-Seeliger

 

(1966)

Isotropic, empirical. This is the lunar surface BRDF, as calculated by Hapke [15].

It is based on

Lommel-Seeliger scattering and Hapke's retrodirective function.

• Torrance-Sparrow

 

(1967)

Isotropic, physically based. A rst general model representing surfaces as distributions of perfectly specular microfacets [52].

• Beard-Maxwell



(1972)

Isotropic, physically based.

1.6. EXISTING BRDF MODELS OVERVIEW



15

This model [56] is built on the assumption that the material surface is a three dimensional terrain of microfacets of varying orientation. In this model, reected light is the result of only two physical occurrences. Light is reected o one of the micro-facets (rst surface reectance) and light is scattered out of the surface after having rst entered the sub-surface medium (volumetric reectance) as it was described in.

• Phong

 

(1975)

Isotropic, empirical. The Phong model introduced in [42] is a phenomenological light reection model, that is very popular, because it models glossy specular reection and is still very cheap and easy to use. In an original form, this model fullls neither the condition of reciprocity nor that of energy balance, but it visualizes well the direct reect of point sources. A version of the Phong model fullling the reciprocity condition is possibly the simplest model for depicting light peaks and dim mirroring. Because of its simplicity the model is still widely used even in its original form.

• Blinn-Phong

 

(1977)

Isotropic, empirical. BlinnPhong model [3], is a modication to the Phong reection model, in a way, that it allows certain quantities to be interpolated, reducing computational overhead. BlinnPhong is the default shading model used in OpenGL and Direct3D graphics libraries.

• Cook-Torrance

 

(1981)

Isotropic, physically based. Cook-Torrance BRDF [7] is a computer graphic adaptation of the TorranceSparrow [52] microfacets model. Even though this model is imprecise at grazing angles, because it violates the energy conservation principle, it is still one of the most useful, and perhaps the best known model for visualizing metals.

• Kajiya

 

Anisotropic, physically based. This is generalized Cook-Torrance BRDF model for anisotropic surfaces [21].

• Strauss

 

(1985)

(1990)

Isotropic, empirical. Strauss proposed a phenomenological shading model in [50]. The goal was to reach a quality comparable to the Cook-Torrance model at lower computational costs and with an intuitive set of parameters. It is based on the Phong illumination model, hence is not physically correct.

The biggest plus of the Strauss model

is its nice parametrization. Despite of simplications, it is still computationally expensive and therefore not suitable for real-time rendering.

CHAPTER 1. INTRODUCTION

16

• He-Torrance

(1991)



Isotropic, physically based.



This is the most important and complex physically based model [18], which has been developed for the description of metals.

Despite it agrees well with most

of measured BRDFs, it is extremely complex and therefore very computationally expensive (its running time is 75 times higher that of the Ward model).

• Ward

(1992)



Isotropic, empirical.



The Ward model [54] is an anisotropic, simplied version of the Cook-Torrance model, preserving its metallic properties. Note that this model violates the principle of energy conservation at grazing angles.

Despite simplications this is,

nevertheless, a highly usable and popular model.

• Lafortune-Phong

(1994)



Isotropic, empirical.



This is physically plausible correction of the Phong reectance model, as was described in [27]. It fullls energy conservation as well as Helmholtz reciprocity principle, preserving the computational eciency of the original Phong model.

• Oren-Nayar

(1994)



Isotropic, physically based.



This model [41], developed by Michael Oren and Shree K. Nayar, is a reectance model for diuse reection from rough surfaces. It has been shown to accurately predict the appearance of a wide range of natural surfaces, such as concrete, plaster, sand, etc. In Oren-Nayar model the surface is modeled as a collection of Lambertian facets.

• Schlick

(1994)



Anisotropic, empirical.



Schlick [46] simplied the Cook-Torrance model by incorporating easily computable functions but also developed his own empirical/speculative model. This anisotropic, physically plausible model uses Schlick's technique of rational fraction approximation to reduce computational expense of the Cook-Torrance model.

• Shirley-Hu-Smits-Lafortune



Isotropic, empirical.

(1997)

1.6. EXISTING BRDF MODELS OVERVIEW



17

This empirical model [48] is very suitable for modeling surfaces, composed of matte base layer, and the top shiny layer. Because the base layer can reect only the energy not reected by the upper layer, whose ability to reect varies with the outgoing angle, both layer reections need to be connected - coupled. Therefore this model is also known as Coupled model.

• Lafortune

 

(1997)

Isotropic, empirical. The Lafortune model [28] is another empirical model designed to t measured BRDF data with a set of easy to calculate basis functions.

This model uses a

Lambertian diuse term together with a specular term that is a sum of cosine lobes.

• Tobler

 

(1998)

Isotropic, empirical. This model is based on specic

base

BRDF construction [51]. This base BRDF

denition has come from a new analogue for deriving form factors and a projection transformation.

• Jensen

 

(1999)

Isotropic, empirical. This model describes the reectivity of wet materials [20].

• Neumann-Neumann-Kalos

 

(1999)

Anisotropic, empirical. This model [38] represents simple, physically plausible, but not physically based reectance models for metals and other specular materials. As authors noticed, there was no metallic BRDF model that is easy to compute, suitable for fast importance sampling and is physically plausible. This gap was lled by appropriate albedo pumping modications of the Phong, Blinn (that are known not to have metallic characteristics) and the Ward models.

• Neumann

 

(1999)

Anisotropic, empirical. This is a physically plausible mathematical model [37] for a large class of BRDFs. Model is as simple as the well-known Phong model, but eliminates its disadvantages. It gives a good visual approximation for a lot of practical materials: coated metals, plastics, ceramics, retro-reective paints, anisotropic materials, etc. As limiting cases this model also includes the ideal diuse model and ideal mirror. The model is based on a special basic BRDF denition, which meets the requirements of reciprocity and of energy conservation.

CHAPTER 1. INTRODUCTION

18

• Stam

 

(1999)

Isotropic, physically based. This physically based model [49] is able to model non-linear wavelength-eects like diraction, typical for materials like, for example, crystals. Unfortunately, this model requires a ne-grained representation of the spectrum of the light involved and thus seems not very well suited for real-time rendering, where RGB is the dominant spectrum representation.

• Ashikhmin-Shirley

 

(2000)

Anisotropic, empirical. Ashikhmin-Shirley [1] is an anisotropic shading model, that has several desirable properties for real-time rendering.

It has intuitive parameters, is anisotropic,

conserves energy, is reciprocal, has a non-Lambertian diuse term, and - most important - is quite ecient to compute. The model is based on the facet slope distribution function introduced in the Cook-Torrance model.

• Hast

 

(2001)

Isotropic, empirical. This reectance model is based on the Phong BRDF, approximated by the Euler method [16].

• Kelemen-Kalos

 

(2001)

Isotropic, physically based. Kelemen-Kalos [23] is simplied version of Cook-Torrance BRDF and is based on the analysis of the photon collisions with the microfacets of the surface. This model is not only physically plausible, i.e., symmetric and energy conserving, but provides other important features of real materials, including the o-specular peak and the mirroring limit case.

• Granier-Heidrich

 

(2003)

Isotropic, physically based. This model [14] is based on a simple layered shading model that attempts to capture some wavelength-dependent eects with a common RGB spectrum representation.

• Ward-Dür

 

(2006)

Anisotropic, empirical. Ward-Dür BRDF [8] represents physically plausible corrected version of Ward anisotropic reectance model.

1.6. EXISTING BRDF MODELS OVERVIEW • Ashikhmin-Premoze

 

19

(2007)

Anisotropic, physically based. This is a distribution (microfacet theory) - based reection model, described in [43]. Its a simple and exible model, which satises many of practical properties requirements and provides a good approximation for many real world materials. It also obeys basic physical restrictions, allows straightforward hardware implementation and provides for ecient sampling in a Monte-Carlo rendering system.

• Weidlich-Wilkie

 

(2007)

Arbitrary layered model. This BRDF model [55] is based on a method, how to combine several micro-facet based surface layers into a single unied, expressive BRDF model, that is easy to use.

It can be used to re-create the appearance of a wide range of dierent

materials, and yield good results without having to perform explicit subsurface scattering computations. This is achieved through suitable approximations and simplications of the scattering within the simulated layered surface, while still taking absorption and total internal reection into account.

• Moroder-Dür

 

(2010)

Anisotropic, empirical. Incorporating the criticism that the Ward and the Ward-Dür model do not meet energy balance at grazing angles, this model [12] is modication of Ward BRDF, that is energy conserving and preserves Helmholtz reciprocity.

This BRDF is

computationally cheap to evaluate, admits ecient importance sampling, and thus sustains the main benets of the Ward model. It also shows better results in tting measured reectance data than the Ward and the Ward-Dür model.

• Kurt-Kalos-Krivanek

 

(2010)

Anisotropic, empirical. As it is described in [26], this is physically plausible, anisotropic BRDF designed for tting and ecient importance sampling. It also has eective real-time rendering performance, which, together with very good tting results makes this model one of the most eective and exible BRDF models up to date.

20

CHAPTER 1. INTRODUCTION

Chapter 2

Reectance models library BRDFLib BRDFLib is the OS-independent library written in the C++ programming language.

It

provides a developer of rendering applications with a number of dierent bidirectional reectance distribution function (BRDF) models via clearly arranged interface. The library can be used for both path tracing and classical ray tracing applications. Before we proceed further, there is few terms used through a rest of this thesis, which have to be dened to avoid any possible ambiguities:

• BRDFLib developer.

Stands for the person, who implements BRDF models and

enriches BRDFLib library with them. In order to proper BRDF model implementation, he/she must know the BRDFLib principles in detail.

• BRDFLib user.

Is the one who uses BRDFLib library in his own rendering applica-

tion, which usually includes raytracer/pathtracer part used for realistic image synthesis. BRDFLib user does not have to have such a comprehensive knowledge of the library internal structures, but still there are some basics, that he needs to understand.

• User of the rendering application.

Usually he/she is not a software developer, but

just only uses the rendering application for various purposes. A good example of this role is e.g. an architect, designing a room.

2.1 Motivation The basic idea of the whole BRDFLib library is based on the property being universal (therefore is not restricted only to a subset of solutions within BRDF modeling) and through this property give freedom of usage to both developers and users of this library. The main goal was to create a platform, oering easy implementation of arbitrary BSDF, regardless of the number or type of its parameters, representation, or the principles, which it is based on. To separate library users from the internal implementation of BSDF models and provide them only with the necessary, but clear and intuitive interface for using these models in a rendering application.

21

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

22

The strength of the proposed library concept should be also the versatility of individual models. Despite the title of the library, derived from the most popular form of BSDF, the library is not only restricted to work with BRDF models, but generally with any model that is based on the BSDF theory.

In other words, the library does not provide only models

for reection (BRDF), but also for transmission (BTDF) and in generally their combination (BSDF). Layered models where the surface consists of individual BSDF layers, are supported as well.

This general solution allows using the same interface for implementing class of

database BRDF models (measured), which are not described by an explicit function.

2.2 Library design and its properties Basically, library itself consists of several components, each dealing with dierent part of the overall BRDF issue, like vectors manipulation, random number generation, texture mapping, etc.. These components can be used independently with dierent purposes in other libraries/applications, even in these, that are not BRDF-based.

These core components

are then interconnected with a set of auxiliary functions/methods and together forms entire BRDF framework. All the components are fully described in the section 2.4. BRDFLib library design proceeds from an idea of texturing, therefore the basic element of the BRDF model is a texture. Because BRDFLib is made universally, it supports both the constant (homogeneous, non-spatially varying) and spatially varying (heterogeneous) surfaces (1.3.1). Texturing approach gives the whole library great eciency, when used e.g. in applications that are intended to render realistic images indistinguishable from photos (which, in most cases, will never be achieved using homogeneous materials). BRDFLib design was developed in order to satisfy the condition of versatility and such as can be specied by following set of properties :

• Simple extendability.

BRDFLib developer, willing to implement and insert new

BSDF model, should only implement the general BSDF interface, which suciently denes the model behavior and does not need to intervent the library itself. Whole general BSDF interface is prepared for arbitrary BSDF model, including arbitrary representation and/or principle of the model. Even when user wants to extend the existing functionality of the library, its design should allow it without major intervention within the entire library.

• Simple employment and usage.

Developer of the rendering application (BRDFLib

user), willing to use this library, needs to know only its necessary basics, to use it properly.

This applies in particular to the basic interface for working with BSDF

models and the way, how manipulation with individual parameters works.

Know-

how about the concrete BSDF itself is only a certain advantage, not a must, because BRDFLib design provides general interface for BSDF parameters manipulation and description. That means parameters are already suciently described in the particular BSDF model and therefore user's responsibility is only to create adequate UI elements for these parameters, based on their properties, provided by a model itself.

• Transparent and unifying interface.

Knowing the basics about the BRDF theory

is sucient requirement for simple usage of arbitrary BRDF model in an application.

2.3. LIBRARY INTERFACE

23

BRDF interface must be clear, and should not evoke any ambiguity or doubts about the particular parameters of its methods. And this should be supported by appropriate choice of method names as well as by sucient documentation.

• BRDF parameters exibility.

BRDF parameter does not have to be only a num-

ber or RGB color, as is it usually presented in particular BRDF model papers.

In

BRDFLib, BRDF models parameters have much higher potential than being only a simple number/color, allowing them to pass over the mentioned (1.3.1) four dimensions. BSDF parameters in this library have universal representation based on texturing of an arbitrary-dimensionality. 6-dimensional family of

BTF

This allows BSDF models to be upgraded up to the (Bidirectional texturing function)[10]. Even the color-

based parameters are not restricted to have any specic representation, but are allowed to use an arbitrary color spectrum. These exibility features then allow extendability of the library beyond the border of BSDF models easily.

• Enough of support functions.

For both BRDFLib developer and user there are

many support functions allowing simple use of all the library own structures. BRDFLib provides even the entire framework dealing with 2D and 3D space, dierent types of mapping, texture manipulating, exible sampling, random numbers generating etc.

2.3 Library interface As it has been mentioned several times in the previous chapter, BSDFs are dierent in their nature. However, all of them are described by Eq. 1.5. Therefore, the common interface can be constructed to describe some common features for all the BSDFs. such an interface through the abstract class

BRDFLib provides

CSurface (see header ), which is at

the top of the BSDF classes hierarchy. Because in this section we focus only on absolutely necessary subset of this basic class methods, we can call this essential subset as

interface.

BSDF basic

This basic interface can be split into two groups, based on the purpose of their

usage: 1.

BSDF evaluation methods. As title prompts, this group (we can call it core surface interface ) deals with BSDF evaluation from dierent aspects and is covered by a following set of methods (note, that concrete form of these methods with all of their parameters is described in detail within the next section (2.4)): (a)

BSDF evaluation (EvaluateBSDF). This method is the most important method within BSDF interface and is intended to be used for obtaining a value of BSDF for given hitpoint and incoming and outgoing directions.

(b)

Stochastic rays generation

(SpawnStochasticsRays). This is the second most

important method which deals with random rays generation, used in pathtracing applications. Upon light impacts the surface, it bounces and secondary rays have to be spawned to trace the light further in the environment. This must be done according to probability density of BSDF, therefore importance sampling (section 1.3.4) is applied here.

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

24

(c)

Albedo evaluation

(GetAlbedo). Albedo (1.12) of the surface describes, as a

complement to the ability to reect light, its ability to absorb the light.

Part

of the energy that is not reected/refracted by a material is absorbed by it and therefore the value of albedo, respectively its complement to 1, can be used in pathtracing application as a probability, that energy of light ray was entirely absorbed by a material (and tracing of this light ray should be terminated). This method evaluates the albedo for a given incoming direction. (d)

Maximal albedo evaluation (GetAlbedoMax).

This method serves for evalua-

tion of albedo for normal incidence, therefore returns the maximal value of albedo for concrete BSDF. 2.

BSDF parameters handling methods.

This group of methods is useful for partic-

ular BSDF parameters control as well as for providing their description to the user of the rendering application. (a)

Parameter/BSDF model description methods (GetParameterTitle, GetParameterDescription, GetHelp).

Library is designed in a way, that its user does

not have to know the meaning of the particular parameters of the BSDF model. Parameters are fully self-describing, so that user can just provide this description to the user of the nal rendering application. Of course, user still needs to know a type/representation of the particular parameter for creation corresponding (G)UI for it. For this purpose, there is a parameter UI support methods group (2b). (b)

Parameter UI support methods

(GetParametersContraints, GetParameter-

Syntax, GetNumParameters). This set of methods serves especially for the correct identication of parameters appearance and behavior within a rendering application (G)UI. (c)

Parameter manipulation methods (SetParameter, GetParameter).

The most

important methods within BSDF parameters interface, serving for the passing of parameters values between the application and the BRDF library (in a both ways).

2.4 Library components In this section, concrete form of BRDFLib, its split into individual components and all of its classes are described in detail.

2.4.1 Components overview BRDFLib library can be partitioned into several individual components, based on the purpose they deal with. This partition is clearly shown in Fig. 2.1.

2.4.2 Detailed description of BRDFLib classes In order to implement any BSDF model there should be created some auxiliary classes, such as 3D-vector, ray, etc. BRDFLib provides such classes. Some of them contain enough

2.4. LIBRARY COMPONENTS

25

Figure 2.1: BRDFLib functionality overview.

functionality to be used in rendering applications, some others supposed to be lled out by the user, according to his/her needs and contain only the basic functionality. BRDFLib is open-source library, therefore every class can be changed to fulll the user's requirements. Here is the detailed description of the most of the BRDFLib classes within components, they are part of (whole BRDFLib manual can be found in the

manual

directory of the

application).

Basic denitions Header: , , , •

Denition of some commonly used constants, such as



Short but useful template functions such as Max(a,b) - maximum of some numbers, EatWhitespace( istream &inpf) - skip all the whitespaces in the input stream, etc...

π

number.

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

26



Specic BRDFLib declarations.



Redenition of several types of variables.

Debugging Header: •

Class

CMsgStreams

one is for denition of a messages stream in dierent contexts of

the program.



Class

CDebug

is for debugging purposes of strange errors.

2D/3D space Header: , •

Classes

CVector2D, CVector3D, which can be treated

as 2D, 3D Cartesian coordinates

correspondingly.



All the needed functionality to work with 2D, 3D coordinates.

Header: , •

Classes

CMatrix3, CMatrix4 which can be used as transformation matrices for 2D- and

3D- space.

Random source Header: , • •

Abstract class

CMultDimRNDGen

Inherited classes,

- base class for multidimensional random generators

CMultDimRND_ANSIC, CMultRNDGen_Halton for generation of random

numbers using corresponding specic method.

Header: RND



Class



Useful functions for generation of random numbers on disks, triangles, hemisphere, etc

for generation of uniformly distributed random numbers.

with specied probability density.

Header: •

Classes

CHalton, CHalton2, CHalton3, CHalton5, CHalton7

for generation of Halton

sequences [57] with specied base. These classes should be extended by the user.

2.4. LIBRARY COMPONENTS

27

Sampling Header: •

Class

CSamplingInfo describes the distribution, random generator to be used, starting

dimension and seed for the random generator, and other input parameters for stochastic sampling.

Mapping Header: •

General class

CMappingBase

for mapping material (it could be the texture, or BSDF,

1D,

etc.) onto the surface. Describes the types of mapping based on dimensionality (

3D,

etc.), and list of parameters which could be mapped (diuse, specular, etc.).

Header: •

Class

CMapPointInfo

which contains mapping information for some particular point

on the surface. It can be used to get the material properties at this particular point. Should be extended by the user for proper use.

Color Header: •

Class

CValues which represents a vector of N values and provides some useful functions N values can be treated as color, unnormalized weight

to work with it. This vector of or just scalar variable.

Three dimensional vector corresponds to the ordinary RGB

color.

Header: •

Denitions of some well-known colors, such as in

CValues

Black, White, ForestGreen,

and others

class representation.

Header: •

Class which represents a color spectrum.

Each spectrum is represented by a set of

wavelengths (bands) with corresponding energy specied by the class

Texturing Header:

CValues.

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

28



Abstract class

CTexture

which can be used for constructing arbitrary texture.

most of BRDFLib parameters, such as albedo (for specular of BSDF), index of refraction

η,

shininess

n,

ρs , diuse ρd

The

and etc. parts

can be considered as textures, that may

have dierent values for dierent points on the surface, or may change in response to other parameters changing. The main methods of this class are:

GetValue(CValues &value, const CMapPointInfo mapInfo), GetValue(CValues &value, const CMapPointInfo mapInfo[], int number), which return value of the texture at the pixel, corresponding to the particular point on the surface, according to given mapping information.



Class

CConstantTexture

which represents one-pixel texture, used for constant map-

ping (value is same everywhere on the surface and therefore independent of mapping information).



Class

CFresnelTexture

which represents Fresnel coecient (see Fresnel reection in

section 1.3.6.1) and returns the value of

dielectric

of material (

θr ,

or

metal ).

reectance or transmittance regarding the type

As Fresnel function is dependent on angles

texture has dierent values for dierent pixels.

θi

and

θr

θi

and

are treated as mapping

information. This le should be extended by the user if he/she would like to use image textures of some commonly used formats such as JPEG, PPM, etc.!

Auxiliary functions Header: •

This header le contains various auxiliary functions used across the whole library, like:

     

Creation of local coordinate system for a given input vectors. Transformation from one type of coordinates to another (Cartesian



Polars).

Approximated calculation of some integrals (see [9]). Specic generation of random points. Read data and construct specic data structures from some particular databases. Binary search in specied input array.

Raytracing Header: •

Class

CRay

denes basic element of raytracing-based applications - ray, and provides

the basic functionality connected with it.

Header:

2.4. LIBRARY COMPONENTS •

Class

CHitPointInfo

29

denes structure used to store various information/parameters

of the hitpoint on a surface, typically obtained from ray tracing routine, together with all of its functionality for manipulating with these parameters.

Header: •

Class

CContributionItem describes the contribution of the generated reected/refracted

ray (bounce) to the nal surface color at particular point (ray origin). This class contains the components used in stochastic rays generation, like generated ray itself, its probability and weight, type of the bounce etc. The class might be used for shooting and gathering as well.



Class

CContributionArray

which contains a vector of

CContributionItems

corre-

sponding to a particular hit point. (It can be used when more than one sample with dierent or the same types of interaction are produced for one hit point).

BSDF Header: •

Abstract class

CSurface

which serves as base class for any BSDF model. Each BSDF

model must inherit this class (or any class inheriting this one) in order to provide basic BSDF interface, whose purpose is described in section 2.3. This class is the most important class across the whole library and therefore we look at its methods in detail:



The value of BSDF can be computed, if the following information is known: hit point information, direction of the incoming ray, and direction of the outgoing ray.

CSurface

contains the following method to support this feature:

virtual bool EvaluateBSDF

(CValues &bsdf, const CHitPointInfo &hitInfo, const CVector3D &out, EDistributionType distType) const;

where:

∗ CHitPointInfo &hitInfo

contains all the needed information about the hit

point (incoming ray direction, normal, axis of anisotropy and mapping information).

∗ CVector3D &out is an outgoing ray direction. ∗ EDistributionType distType is a container of bit ags, which describes the type of interaction typical for a given BSDF. By this parameter, it is possible to specify allowed interaction types for BSDF evaluation (like e.g.

"only

diuse reection", "diuse reection and specular transmission", etc.) The computed value of the BSDF is written into

CValues bsdf variable. If any false, otherwise true. Due

error occurs during evaluation, this function returns

to the fact that recursive integral part of the radiance equation is computed for projected solid angle, variable

bsdf contains value of BSDF weighted by the cosθi :

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

30

weightdirect The Function

~ illum = fr (x, ω~in ,ωout ) · cos θin .

EvaluateBSDF(...)

(2.1)



can be used to compute the ray contribution

in classical ray tracing applications. Moreover, it can be used to calculate direct illumination for stochastic ray tracing applications, such as path tracer, distributed ray tracer, etc.



To reach stochastic solution for the rendering equation (Eq. 1.10) as precise as possible, the

importance sampling scheme

should be used for BSDF sampling. In

other words, PDF should resemble BSDF function as close as it possible. There is following function in BRDFLib which provides the stochastic generation of outgoing rays:

virtual int SpawnStochasticRays

(CContributionArray &carray, const CHitPointInfo &hitInfo, CSamplingInfo &samplingInfo, EDistributionType distType) const;

where:

∗ CContributionArray &carray

is storage for results, where contributions of

all the generated rays are saved.

Each item (CContributionItem) of this

array contains enough information about the spawned ray for tracing this ray further through the scene independently. It also includes weight (see Eq. 2.2) of the contribution of such a spawned ray, so that evaluation of the color at the particular hitpoint can be done properly.

weight

=

fr (x, ω ~ in , ω ~ out ) cos θin . P DF (~ω ) in

∗ CSamplingInfo &samplingInfo

(2.2)

is sampling info for a particular hit point

(type of random generator, number of rays to spawn etc.).

∗ CHitPointInfo &hitInfo and EDistributionType distType meaning as in EvaluateBSDF method.

has the same

In the case stochastic samples were successfully generated, function returns the number of generated samples.



In ray tracing applications albedo dened by Eq. 1.12 is used to perform selection of the light/surface interaction model, to interrupt the recursion (decide to absorb the sample or shoot it into some direction). BRDFLib supposes the function for computation of albedo for a given incoming direction at a given point on the surface:

virtual bool GetAlbedo where:

(const CHitPointInfo &hitInfo, EDistributionType distType) const;

2.4. LIBRARY COMPONENTS

31

∗ CHitPointInfo &hitInfo and EDistributionType distType meaning as in EvaluateBSDF method. This method returns



true,

if albedo was evaluated successfully,

has the same

false

otherwise.

For some selection schemes, it is not necessary to know the albedo for particular incoming direction, and albedo at normal incidence (incoming direction coincides with the surface normal) is enough. Actually, albedo at normal incidence achieves its maximum. In this way, BRDFLib provides the following function, which denes the maximum albedo at a given point on the surface:

virtual bool GetAlbedoMax

(const CHitPointInfo &hitInfo, EDistributionType distType) const;

where:

∗ CHitPointInfo &hitInfo and EDistributionType distType meaning as in EvaluateBSDF method. This method returns

true,

has the same

if maximal albedo was evaluated successfully,

false

otherwise.

Header: •

Class

CSlopeMicrofacets

is wrapper class for any number of slope

1

parameters, pro-

viding both isotropic and/or anisotropic variants.



Abstract class

CSurfaceMicrofacet

BSDF models (like

Cook-Torrance ).

which serves as base class for microfacet-based It inherits

CSurface

and in addition it provides

an interface for handling any number of slope parameters via

CSlopeMicrofacets

member.

Header: •

Class

CSurfaceLayer

denes single layer of the multi-layered surface. Layer owns an

instance of any BSDF model, but also provides some other parameters, like thickness or wavelength-dependent absorption coecient.



Abstract class

CSurfaceLayered

represents base for multi-layered BSDF models.

It

provides interface for manipulation with single layers of the surface, represented as vector of

CSurfaceLayers

. Concrete form of relation/interaction between layers has

to be dened in a particular implementation of this class through basic BSDF interface methods.

Slope, also known as standard deviation of the surface slope of the material, is a measure of the roughness of a surface. The assumption is that a surface is made up of tiny microfacets that reect in a specular fashion. Its value, usually given in radians, serves as angular deviation of the microfacet normal from the surface normal. For a mirror-like surface, all the microfacets line up with the surface. For a rougher surface, some random orientation of these microfacets causes the specular highlight to spread out more. For isotropic BSDF models, standard slope deviation of the microfacets in both X and Y directions is the same. 1

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

32

2.5 Implemented BRDF models 2.5.1 Implemented models overview In total, there are 28 dierent BSDF models implemented in BRDFLib. At rst, list of these models is introduced in alphabetical order (models marked with * are newly implemented within this thesis, models marked with ** were reimplemented within this thesis):

• • • • • • • • • • • • • • • • • • • • • • • • • • • •

Beard-Maxwell (2002) Blinn-Phong (1994) Cook-Torrance (1981) Cook-Torrance simplied (Kelemen-Kalos) (2001) Coupled model (Shirley-Hu-Smits-Lafortune) (1997) Ideal dielectric Ideal diuse refractor Ideal metal Ideal mirror reector Ideal refractor Kurt-Kalos-Krivanek (2010)* Lafortune (1997) Lambertian (1760) Layer mixture * Minnaert (1941)* Moroder-Dür (2010)* Neumann-Neumann-Kalos (1999) Neumann (1999)* Oren-Nayar (1994)* Phong (1975)* Phong anisotropic (Ashikhmin-Shirley) (2000) Phong grazing mirror Phong physical (1994) Phong physical with deterministic reection Schlick (Survey) (1994) Specular reector Ward (1992)** Ward-Dür (2006)*

Note, that some of them are implemented within other models as a modication parameter (usually these, having the same basis and diering only in some detail like, for example, Blinn-Phong and Phong models). Some of the listed models share the common basis or principles and therefore we can sort them into specic groups/hierarchy. This partition can be seen in Fig. 2.2, which visually represents relations between particular models and partially corresponds with class hierarchy in BRDFLib.

2.5. IMPLEMENTED BRDF MODELS

33

Figure 2.2: Implemented BSDF models hierarchy.

2.5.2 Description of implemented models Implemented models are sorted into several groups (see Fig. 2.2), based on their nature. Ordering within the group is then chronological, which also corresponds to the model development.

Diuse BRDFs Models of this group present matte surfaces, which reect light diusely. Practical example of such a material is paper or unnished wood. Implementation of these models are rather simple, because they miss usually computationally expensive specular component.

2.5.2.1 Lambertian, 1760 Proposed in 1760 [29], this is the simplest BRDF, modeling perfect diuse reection.

It

describes surfaces that scatter incident light uniformly in all directions. Such surfaces obey Lambert's cosine law, which states that the exitant radiance observed from all directions

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

34

of the hemisphere is directly proportional to

cos(θin )

(and not dependent on the outgoing

direction). The constant of proportionality in this relationship is called diuse reectance

ρd (also

called surface albedo) and is generally dependent on wavelength. Thus, the BRDF

is constant at a surface point x:

fr (x, ω ~ in , ω ~ out ) =



ρd . π

(2.3)

Lambertian model is often used as a model for diuse reection in many of BSDF models.

2.5.2.2 Minnaert, 1941 This BRDF [33] was invented to explain the curious fact that the full moon appears almost uniformly bright from the center to the edge of the lunar disk.

If the lunar dust were a

Lambertian reector, the full moon would appear bright at the center and darker at the edge. However, the Minnaert BRDF agrees with observation over only a limited range of angles. The Minnaert BRDF is given by:

fr (x, ω ~ in , ω ~ out ) =



where

k

ρd cosk (θin ) cosk−1 (θout ) , π

(2.4)

is limb darkening parameter, controlling extra lightening towards the horizons.

2.5.2.3 Oren-Nayar, 1994 The Oren-Nayar diuse model presented in [41] is the physically-based analytical reection model. Oren & Nayar found that Lambertian model does not capture the scattering behavior of very rough surfaces very accurately. As stated earlier, at a Lambertian surface light is scattered uniformly in all directions.

But for rough surfaces like clay, plaster, sand, and

cloth an increase in reected radiance is observed when the viewing direction approaches the direction of incidence. The Oren-Nayar model belongs to the family of microfacet models, that treat surfaces as a collection of microscopic facets (see Fig. 2.4). Eq. 2.5 presents a form in which the Oren-Nayar model is usually implemented.

fr (x, ω ~ in , ω ~ out ) =



~ ·ω ~ ·ω ρd ((~ ωin · ω ~ out ) + (N ~ in ) · (N ~ out )) (A + B · ), ~ ~ π max((N · ω ~ in ), (N · ω ~ out ))

(2.5)

where

A = 1−

B =

0.5 · σ 2 , 0.33 + σ 2

0.45 · σ 2 , 0.09 + σ 2

(2.6)

(2.7)

2.5. IMPLEMENTED BRDF MODELS

35

Group of simple ideal BSDFs Models of this group represent various types of ideal surfaces. They are based on the very basic principles of BSDF theory and therefore their implementation is usually very simple. Because these ideal surfaces are rare in real world, they serve rather as a demonstration of basic BSDF properties like, for example, mirror reection or can be used for creation of composite/multi-layered BSDF models.

Simple ideal BRDFs 2.5.2.4 Ideal mirror reector This provides ideal mirror BRDF model, which contains only one input parameter, independent of incoming/outgoing direction : albedo

ρm .

Ideal mirror surface deterministically

shoot the ray in a single (mirror) direction. Weight of such spawned ray is then simply:

=

weight

where

~ δ(T~ − R)

~m − ω ρm δ(R ~ out ) · cos θin = ρm , cos θin

(2.8)

is Dirac-Delta function with respect to the canonical measure on the

sphere. Albedo of such surface is driven only by the position on this surface:

Z albedo

ρm ·

= Ω+

~m − ω δ(R ~ out ) · cos θout dω = ρs . cos θin

2.5.2.5 Ideal metallic reector This model is very similar in functionality to ideal mirror: contains only one input parameter (albedo

ρm )

and reected ray is deterministically shot in a single (mirror) direction.

However, the albedo for this depends on incoming direction and is computed according to Fresnel equations (see section 1.3.6.1).

Hence, the weights of the generated samples also

depend on incoming direction.

2.5.2.6 Specular reector This simple BRDF represents specular part of Phong physically plausible model, described in Eq. 2.11. Thus it can be rewritten as :

fr (x, ω ~ in , ω ~ out ) =



ρs (n + 2) (cos(~ ωout , R~m )+ )n , 2π

(2.9)

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

36

Simple ideal BTDFs 2.5.2.7 Ideal dielectric All the real-life transparent objects have the property to reect small amount of incoming light from its surface. In the theory of stochastic processes this phenomenon can be captured by the probabilistic shooting of reected and refracted rays, based on Fresnel equations (see section 1.3.6.1). This BTDF is then actually BSDF and its behavior is fully described by these equations.

2.5.2.8 Ideal diuse refractor This ideal reectance function is created by the analogy with diuse reection ( However, unlike

Lambertian

2.5.2.1).

model, this BTDF is a ction in some sense (in a rough approx-

imation translucent objects can be considered as diuse refractors). This model contains only one internal parameter: albedo

ρd ,

which simply represents fraction of light, that is

refracted through the material, where rest of it is absorbed. No index of refraction should be specied for this model, because generated refracted rays are spread equally in all directions, not depending on any direction or other parameters, like in

Lambertian

model.

2.5.2.9 Ideal refractor This surface is analogy with ideal mirror BRDF, but direction of generated samples is computed according to the other law: Snell's law (see Fig. 2.3). Therefore, this class requires besides the albedo parameter

ρt ,

representing fraction of energy that is transmitted through

the material, while the rest is absorbed, also an index of refraction

η , used for determination

of the generated ray direction.

ηi sin(θi ) = ηt sin(θt ) T~

ηi ~ =- ω ηt ~ i +N

ηi ηt

r cos θin −

Figure 2.3:

1−

 2 ηi ηt

Snell's law.

! (1 − cos2 θin )

2.5. IMPLEMENTED BRDF MODELS

37

Phong-based group of BSDFs This group of BSDFs is based on the Phong model with some corrections for particular BSDF model.

2.5.2.10 Phong, 1975 This model represents original form of classical Phong [42] shadowing model from 1975. The Phong BRDF was the rst model proposed for specular materials. Specular surfaces reect most of the incoming light around the ideal reection direction, thus the BRDF should be maximum at this direction and should decrease sharply (see Eq. 2.10). Note, that as was later pointed out, this is not physically plausible model, since it is not symmetric. Nevertheless it is still usable model even in this form, because of its performance. Although in most cases its physically plausible version is used for rendering.

fr (x, ω ~ in , ω ~ out ) = kd + ks



~m · ω (R ~ out )n , ~ ·ω (N ~ in )

(2.10)

2.5.2.11 Phong physical, 1994 As was mentioned in section 2.5.2.10, original form of Phong shading model fullls neither the condition of reciprocity nor that of energy balance, but it visualizes well the direct eect of point sources.

A version of the Phong model from Lewis [32] fullling the reciprocity

condition is possibly the simplest model for depicting light peaks and dim mirroring. Because of its simplicity the model is still widely used even in its original form.

The physically

plausible version of the Phong BRDF is:

ρd ρs (n + 2) ~m · ω fr (x, ω ~ in , ω ~ out ) = kd + ks ((R ~ out )+ )n = + (cos(~ ωout , R~m )+ )n . π 2π

(2.11)

As it is shown, BRDF of Phong type can be split into the two components: diuse and specular. Classical Phong model does not support transparency. We extended it with the deterministic refraction, which is driven according to Snell's law (see Fig. 2.3). An equation corresponding to extended Phong model is shown below:

fr (x, ω ~ in , ω ~ out ) =



where

ρt

ρs (n + 2) ρd ρt δ(T~ − ω ~ out ) + (cos(~ ωout , R~m )+ )n + , π 2π cos θin

(2.12)

is albedo for transmittance part or, in other words, the fraction of light which

should be transmitted by the surface,

δ(T~ − ω ~ out )

is Dirac delta function with respect to the

canonical measure on the sphere. In order to build up physically plausible BSDF model, the sum of albedos of all BSDF components should be less than one:

ρd

+

ρs

+

ρt ≤

1.

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

38

This model with all of its modications described below is base for the all the derived models (see models hierarchy 2.2).

Modications Blinn[3] and Neumann[38] have proposed some slight modications of the Phong BRDF model. These modications dier from the original form only in details and therefore were added directly to the implementation of this model as optional modicators. And because this is base class for all the other Phong-based models, these modicators are included and can be used in all derived models.

• Blinn-Phong, 1994 Using Blinn modication, angle between

~ N ~) (H,

(~ ωout , R~m )

is replaced by the angle between

resulting in better appearance, when original angle exceeds 90 degrees.

See

Blinn-Phong model (2.5.2.14) for more info.

• Albedo pumping, 1998 This modication refers to the albedo pumping correction proposed by Neumann [36] resulting in ability to provide metallic appearance for, among others, Phong BRDF model. For more info, see Neumann-Neumann-Kalos model [38].

• Retroreection, 1999 Retro-reective BRDF described in [38] has the maximum at the direction of the incident illumination. For retro-reective materials, mirror direction vector be replaced by the illumination direction

ω ~ in .

R~m

should

Retro-reection occurs when the incident

energy is reected in direction close to the incident direction, over a wide range of incident directions. Practical examples of retro-reective objects are a projection screen or a trac sign.

2.5.2.12 Phong grazing mirror The specularity of the most real-world polished surfaces increases at grazing angle.

This

eect is not taken into account by classical Phong model and specularity at grazing angles fades to zero. Fortunately, Phong model can be extended by an additional

mirror term

[28]

which can be made to reect a fraction of the power that is not reected by the specular lobe. In other words, all the samples rejected during the importance sampling procedure

Ratiom

are sent into the mirror direction. The corresponding formula for this modied Phong model is as following:

fr (x, ω ~ in , ω ~ out ) =



where sphere.

ρd n+2 ~ m −~ + ρs ((cos(~ ωout , R~m )+ )n + (ρs −ρs (~ ωin )) Ratiom δ(R ωout ) , π 2π (2.13)

~m − ω δ(R ~ out )

is Dirac delta function with respect to the canonical measure on the

2.5. IMPLEMENTED BRDF MODELS

39

2.5.2.13 Phong physical with deterministic reection This model is a combination of dierent BRDF models: Lambertian (ideal diuse), ideal mirror, and ideal refraction. It just uses parameters of Phong BRDF, but in its own way. Only diuse rays are spawned stochastically, all the others rays (mirror and refracted) are shot deterministically. This model can be useful for creation of color semi-transparent glass objects.

2.5.2.14 Blinn-Phong, 1994 When the angle between

(~ ωout , R~m ) is greater than 90 degrees, it is not modeled correctly by

Phong shading model (its cosine falls to negative value). The Blinn, also called Blinn-Phong model [3] uses a dierent set of vectors for computations, one that are less than 90 degrees in all valid cases and it requires computing the half-angle vector direction halfway between the view direction

ω ~ out

~. H

The half-angle vector is the

and the light direction

ω ~ in .

A physically

plausible version of Blinn-Phong model is:

fr (x, ω ~ in , ω ~ out ) =



ρd ρs (n + 2) ~ N ~) . + cosn (H, π 2π

(2.14)

This model is implemented within physically plausible Phong model as its optional modicator.

2.5.2.15 Lafortune, 1997 Lafortune BRDF model [28] presented in 1997 can be regarded as a generalization of the original cosine lobe:

fr (x, l, e) = ρs (Cx lx ex + Cy ly ey + Cz lz ez )n ,



where

~l and ~e

(2.15)

are incoming and outgoing vectors considered in a local coordinate system

which axes are aligned to the normal and to the principal directions of anisotropy. In the

Cx = Cy . The original p n −Cx = −Cy = Cz = (n + 2)/(2π). In order

case of isotropic reection,

cosine lobe model is obtained by choosing to represent complex real-life reectance

functions, the sum of several primitive functions of the form of Eq. 2.15 can be used:

fr (x, l, e) =



N X

ρs (Cxi lx ex + Cyi ly ey + Czi lz ez )ni .

(2.16)

i

2.5.2.16 Neumann-Neumann-Kalos, 1998 Phong and Blinn-Phong models are physically plausible, but are not physically based. The main disadvantage of these models is that they become "dark" at greater incident angles, which is not realistic when rendering metals.

This disadvantage was successfully handled

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

40

by the

albedo pumping

[36] correction.

The nal, pumped-up BRDF is described by the

following formula:

fr (x, ω ~ in , ω ~ out ) =



ρd ωout , R~m )+ )n ρs (n + 2) ((cos(~ + . π 2π max((cos θin ), (cos θout ))

(2.17)

albedo pumping is achieved by an employment of max((cos θin ), (cos θout )) Phong model, therefore this model is also called Max-Phong. This correction is

As can be seen, term in the

implemented within physically plausible Phong model as its optional modicator.

2.5.2.17 Coupled Model (Shirley-Hu-Smits-Lafortune), 1997 This model represents coupled matte-specular reection model[48] proposed in 1997. The model is meant to capture angle-dependent behavior changes by allowing the matte and specular coecients to co-vary. The model is empirical approximation for polished surfaces in the way the Lambertian model is useful for approximating matte surfaces.

fr (x, ω ~ in , ω ~ out ) =



The

21(1 − R0 ) ρd (1−(1−cosθin )5 )(1−(1−cosθout )5 ) + (R0 + (1−cosθin )5 )ρs . 20π (2.18)

R0

coecient from Eq. 2.18 has precise physical meaning. It is the normal-incidence

reectance for the refractive index of the polish

R0 =

n:

(n − 1)2 . (n + 1)2

For reasonable values of refractive indices, the

R0

(2.19)

is limited to approximately the range

0.03 to 0.06. Other input parameters (ρs , ρd ) has the same meaning as in traditional Phong model. For Monte Carlo sampling the model oers following probability density function proportional to the cosine-weighted BRDF for the given incident

φout we can ξ : φout = 2πξ .

depend on number

choose

φout

θin .

Because PDF 2.20 does not

uniformly given a canonical (uniform on [0,1]) random

pdf (~ ωout ) = (1 − (1 − cosθout )5 )cosθout .

(2.20)

2.5.2.18 Phong anisotropic (Ashikhmin-Shirley), 2000 This model presented in 2000 is a reectance model for polished surfaces [1]. It is based on classical sum of "diuse" and "specular" term 2.21.

fr (x, ω ~ in , ω ~ out ) = ρd (~ ωin , ω ~ out ) + ρs (~ ωin , ω ~ out ) .



Model has desirable properties:

(2.21)

2.5. IMPLEMENTED BRDF MODELS • • • • •

41

Obeys energy conservation and reciprocity laws. Allows anisotropic reection. Giving the streaky appearance seen on brushed metals. Is controlled by intuitive parameters. Accounts for Fresnel behavior, where specularity increases as the incident angle goes down.



Has a non-constant diuse term, so the diuse component decreases as the incident angle goes down.



Is well-suited to Monte Carlo methods.

More precisely, anisotropic Phong model is:

p ~ · H) ~ nu cos2 φ+nv sin2 φ (nu + 1)(nv + 1) (N ~ ω ρs (~ ωin , ω ~ out ) = F (H, ~) , ~ ·ω ~ ·ω ~ ·ω 8π H ~ max(N ~ in , N ~ out )

 ρd (~ ωin , ω ~ out ) =

28ρd (1 − ρs ) 1 − 23π

~ ·ω N ~ in 1− 2

!5    1 −

~ ·ω N ~ out 1− 2

(2.22)

!5   .

(2.23)

These terms have only several input parameters: two scales of roughness (nu and

nv )

and classical diuse and specular colors.

Microfacet Based Group of BSDFs The BSDFs of this group represents glossy reection from rough surfaces which is typically

Figure 2.4: Microfacet geometry. Upper left: Surface composed of microfacets. Upper right: single V-cavity with normal A. Bottom row: Interaction between microfacets, form left to right: interreection, masking, shadowing.

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

42

modeled by the

microfacet theory.

This theory assumes the surface is made of little reective

facets (see Fig. 2.4), each behaving as a small mirror. This model predicts that the amount of light reected from a light source towards the eye is equal to the relative number of microfacets whose normal is oriented halfway between the eye and the light source [4]. This model has been enhanced by many researchers and it consists of the following terms:

fr = where

D

DF G . 4 cos θin cos θout

(2.24)

is the microfacet distribution (it gives the number of microfacets oriented in a

particular direction);

G is a geometric attenuation term accounting for self-shadowing and/or

masking (this arises because a rough surface is actually a height eld, and facets in the valleys are less visible at glancing angles as facets at the peaks);

F

is the Fresnel reection.

2.5.2.19 Beard-Maxwell, 2002 The Beard-Maxwell model [56],[35] is an empirically based model developed to characterize the BRDF of painted coatings. It is a six parameter model assuming that the primary surface scattering can be modeled by Fresnel reection from randomly oriented facets and the diuse scattering can be modeled by the sum of Lambertian and isotropic Hapke-Lommel-Seeliger BRDF[15]:

fr (x, ω ~ in , ω ~ out ) = ff s (x, ω ~ in , ω ~ out ) + fvol (x, ω ~ in , ω ~ out ) , where

ff s , fvol





(2.25)



are the rst surface and volumetric reectance functions respectively. Ac-

cording to Beard-Maxwell model described in [56], these two components are:

−2β

1 + Ωδ e τ F (δ) cos2 δ ff s (x, ω ~ in , ω ~ out ) = ff irst (x, ω ~ in , ω ~ out ) F (0) cos θin cos θout 1 + Ωδ fvol (x, ω ~ in , ω ~ out ) =



ρd 2 ρv + , π cos θin + cos θout

,

(2.26)

(2.27)

where

• • • • •

ff irst is rst surface BRDF. ρd is the albedo or reectivity of diuse component of the BRDF. ρv is volumetric component of the BRDF. Ω and τ are two shadowing and obscuration function parameters. β is bistatic angle (i.e., the angle between either the incident or reected direction and ~ ). the half angle vector H ~ and the normal N ~. • δ is the angle between the half-vector H ~ • F (0) and F (δ) are Fresnel reection computed for normal incident direction and H incident direction respectively.

2.5. IMPLEMENTED BRDF MODELS

43

2.5.2.20 Cook-Torrance, 1982 This model presents a reectance model for rough surfaces [7]. It is based on geometrical optics and is applicable to a broad range of materials, surface conditions, and lighting situations. Even though this model is imprecise at grazing angles, because it violates the energy conservation principle, it is still one of the most useful, and perhaps the best known model for visualizing metals.

As for other microfacet based models, the specular component of

Cook-Torrance model is commonly described by Eq. 2.24.

More precisely, Cook-Torrance

model is:

fr (x, ω ~ in , ω ~ out ) =



where

G,

ρd G F D · , + ρs · · π 4π cos θin cos θout

(2.28)

the geometrical attenuation factor, is dened as:

( G = min

~ · H)( ~ N ~ ·ω ~ · H)( ~ N ~ ·ω 2(N ~ out ) 2(N ~ in ) 1, , ~ ~ (~ ωout · H) (~ ωout · H)

) ,

(2.29)

where "·" means dot product for two vectors. Cook and Torrance supposed to use Beckmann [2] distribution for their model:

  tan2 δ 1 · exp − 2 . D= 2 α cos4 δ α

(2.30)

Some surfaces have two or more scales of roughness and can be modeled by using two or more distribution functions [7]. In this way

D

can be expressed as a weighted sum of these

distribution functions:

D=

X

wαj D(αj ) ,

(2.31)

j where

j -th

αj

is the standard slope deviation of the

j -th

distribution,

distribution. The sum of the weights must be equal to

1.

wαj

is the weight of the

2.5.2.21 Schlick (Survey), 1994 As was described in [35], Schlick simplied the Cook-Torrance model by incorporating easily computable functions but also developed his own empirical/speculative model [46].

This

model can be made physically plausible. It uses technique of rational fraction approximation to reduce computational expense, described by Schlick. It is also interesting for the fact that it explicitly models surfaces consisting of two or more dierent types of layers. Usually a transparent, specularly reecting layer is assumed to lie over an opaque, diusely reecting one.

The model also lacks the typical separation in diuse and specular part, using only

a unied expression for the individual layers.

Furthermore, the model is designed to be

tailored towards a specic usage, usually by treating accuracy for speed and vice versa. BRDF formula for Schlick model is:

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

44

fr (x, ω ~ in , ω ~ out ) =



where

l

k=1

is number of surface layers,

k,

is reectance of the layer 1.3.6.1) and

Dk

wk

k

k

(2.32)

Pl

(

k=1 wk

= 1), Fk (~ ωin )

k

:

1 , mk · nk · (pk + cos2 (δ)(1 − pk )) 1 1 (1 − cos2 (φH )) − ) + , m2k n2k n2k

(2.33)

(2.34)

are standard deviations of the microfacets slope in the principal directions of

anisotropy of the layer of the layer

is weight of the layer

is microfacet distribution function of layer

pk = cos2 (φH )( mk , nk

wk Dk Gk Fk (~ ωin ) , ~ ·~ ~ ·~ 4π(N ωin )(N ωout )

computed according to simplied Fresnel equation (see section

Dk =

where

l X

k . Gk

in the Eq. 2.32 is approximated geometric attenuation factor

:

Gk =

cos(δ) , cos(δ) − t · cos(δ) + t r t =

2·m·n . π

(2.35)

(2.36)

2.5.2.22 Cook-Torrance simplied (Kelemen-Kalos), 2001 This represents a microfacet based coupled specular-matte BRDF model published in [23]. It is physically plausible simplication of Cook-Torrance model (2.5.2.20). The specular part is physically based and is derived by the simplication of the microfacet reection model. The main advantage is its simpler computation and nearly the same result as the Cook-Torrance model. It exhibits o-specular peak and becomes mirror-like towards grazing angles. Whole BRDF can be expressed as a sum of matte and specular component:

fr (x, ω ~ in , ω ~ out ) = ρd (~ ωin , ω ~ out ) + ρs (~ ωin , ω ~ out ) .



(2.37)

Specular component is the same as in Cook-Torrance model, except the geometric term (2.38). After this approximation, the specular term is simplied to formula 2.39.

G =

ρs =

1 , 1 + ω~in · ω~out

(2.38)

DF . 2(1 + ω~in · ω~out )

(2.39)

Matte component presents empirical approximation approach:

ρd = s (1 − aspec (θin ))(1 − aspec (θout )) ,

(2.40)

2.5. IMPLEMENTED BRDF MODELS where

aspec

are specular albedos 2.41 and

45

s

is a normalization constant 2.42.

aspec (θin ) ≈

s = The

aave spec

F cosθin , cosβ

(2.41)

1 . π (1 − aave spec )

(2.42)

is average albedo and can be computed according to:

aave spec

1 = π

Z aspec (θout )cos(θout )dω .

(2.43)



2.5.2.23 Kurt-Kalos-Krivanek, 2010 In 2010, new physically plausible analytical BSDF model with the aim of accurate data tting, ecient importance sampling and eective real-time rendering was proposed [26]. This model is based on halfway vector representation and use the standard Beckmann distribution as a normalized microfacet distribution.

It was demonstrated, that this BSDF represents

both isotropic and anisotropic materials more eectively than other existing models. Based on the observation that the diuse reection is due to non-direct photon collisions, the diuse and specular parts can be coupled using the Fresnel function describing ideal mirror reections. Using this coupled model, nal BRDF with single specular lobe is :

fr (x, ω ~ in , ω ~ out ) =



where

β

~ ~ D(H) ~ ρd (1 − F (~ ωout · H)) ρs F (~ ωout · H) + , ~ ((~ ~ )(~ ~ ))β π 4 (~ ωout · H) ωin · N ωout · N

is shadowing/masking term optimization parameter

2

and

~ D(H)

(2.44)

is normalized

microfacet distribution function which is physically plausible. For isotropic materials it is equal to:

2 2 ~ = exp(− tan δ/α ) , Diso (H) π α2 cos4 θH

(2.45)

  exp − tan2 δ(cos2 φH /αx2 + sin2 φH /αy2 ) ~ = , Daniso (H) π αx αy cos4 θH

(2.46)

and for anisotropic materials:

where

δ ,α

orαx , αy respectively are the same parameters, described in Ward model (section

2.5.2.24). 1 1 Ashikhmin-Shirley [1], Cook-Torrance [7], and Ward [54] models have M ax(cos θin , ·cos θout ) cos θin ·cos θout 1 and √cos θ ·cos θ terms, respectively, and they act as shadowing/ masking terms. However, they are not out in optimized for one material and do not vary from material to material. Kurt-Kalos-Krivanek BRDF model optimizes this shadowing/masking term with an additional β parameter. In this way, it more closely matches the measured BRDF data than existing BRDF models. 2

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

46

Ward based BSDFs Following group of models share the common basis, described by Ward[54].

2.5.2.24 Ward, 1992 The Ward model [54] is a simplied version of the Cook-Torrance model, preserving its metallic properties. Ward assumes the Gaussian distribution of microfacets and proposed following isotropic model:

fr (x, ω ~ in , ω ~ out ) =



exp(− tan2 δ/α2 ) ρd 1 · . + ρs · √ π 4 π α2 cos θin · cos θout

(2.47)

In our implementation, Ward BRDF can be optionally modied in same way as in Phong BRDF by

albedo pumping

fr (x, ω ~ in , ω ~ out ) =



δ

where angle

correction. The modied BRDF is then :

ρd 1 exp(− tan2 δ/α2 ) + ρs · · , π M ax(cos θin , cos θout ) 4 π α2

is the angle between the half-vector

at a given point (see Fig. 1.2),

α

~ H

and the normal

~ N

(2.48)

to the surface

is the standard deviation of the microfacets slope.

The

geometrical attenuation factor is not taken into account for Ward model. Anisotropic version of Ward model assumes, that Gaussian distribution is not symmetric and this provides an anisotropy for BRDF model:

  exp − tan2 δ(cos2 φH /αx2 + sin2 φH /αy2 ) ρd 1 fr (x, ω ~ in , ω ~ out ) = + ρs · √ · , π 4 π αx αy cos θin · cos θout

(2.49)

where

αx , αy

are standard deviations of the microfacets slope in the principal directions of

anisotropy. Other parameters remain the same. Because of higher complexity of anisotropic variant of this model, both versions were implemented separately to preserve computational simplicity of the isotropic one.

2.5.2.25 Ward-Dür, 2006 In 2006, Arne Dür has pointed out ([8]), that original Ward model suers with the loss of energy at at angles and for this reason, improved normalization of Ward BRDF was proposed:

fr (x, ω ~ in , ω ~ out ) =



ρd 1 exp(− tan2 δ/α2 ) + ρs · · . π cos θin · cos θout 4 π α2

(2.50)

2.5. IMPLEMENTED BRDF MODELS

47

As it can be seen, this normalization consists in the elimination of the root from √

1 cos θi ·cos θr

term, or, from another perspective, multiplication of the specular part by this term. In analogy, anisotropic Ward-Dür BRDF is then:

  exp − tan2 δ(cos2 φH /αx2 + sin2 φH /αy2 ) ρd 1 fr (x, ω ~ in , ω ~ out ) = · . + ρs · π cos θin · cos θout 4 π αx αy

(2.51)

For the same reason as in Ward BRDF, isotropic and anisotropic variants were implemented separately.

2.5.2.26 Moroder-Dür, 2010 Neumann ([38]) criticized that the albedo of the Ward BRDF is unbounded at grazing angles, what is also valid for the Ward-Dür BRDF. In 2010, David Geisler-Moroder and Arne Dür [12] proposed a modication of the Ward-Dür BRDF, where albedo is bounded by 1.0 for all possible incident directions:

fr (x, ω ~ in , ω ~ out ) =



ρd 1 exp(− tan2 δ/α2 ) + ρs · · . ~ 2 (H ~ ·N ~ )4 π 4 π α2 (ω~in · H)

(2.52)

As it can be seen, albedo bounding has been carried out by correction of the normalization factor of specular part. In analogy, anisotropic Moroder-Dür BRDF is then:

  exp − tan2 δ(cos2 φH /αx2 + sin2 φH /αy2 ) ρd 1 fr (x, ω ~ in , ω ~ out ) = + ρs · . · ~ 2 (H ~ ·N ~ )4 π 4 π αx αy (ω~in · H) (2.53) For the same reason as in Ward and Ward-Dür BRDF models, isotropic and anisotropic variants were implemented separately.

Other BSDFs 2.5.2.27 Neumann, 1999 The BRDFs of metals increase towards innity for grazing angles. This is due to the fact that for smooth metals the product of the BRDF and the cosine term is approximately constant, thus the incident and the outgoing radiance is approximately equal.

In 1999, Neumann

proposed model [37] for metals, that does not follow this behavior since the maximum of the BRDF values is constant for any incident angle. This model has special form of BRDF representation, which is based on the so-called

basic BRDF. Final BRDF is then generalization of this basic BRDF. As author proposed, in

comparison with conventional methods, this form oers computationally cheap method for

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

48

L0 = mirror direction (Rm ), Lp = 0 0 projection of L onto base plane, Lp = projection of L onto base plane, Vp = projection of V onto base plane, R = distance between L0p and Vp = radius of the highlighted circle.

L

= light direction (ωi ),

V

= outgoing direction (ωo ),

Figure 2.5: Geometry of the BRDF denition by Neumann.

importance sampling. All the stochastic rays generation and albedo computation are based on the geometry, taken from the original paper and shown in Fig. 2.5.

In this geometry,

projection of particular direction vectors onto the base plane, forming highlighted circle (with center

BRDF

L0p

and radius

R)

is essential for all the computations.

Whole idea of

basic

and derivation of nal BRDF can be found in the original paper [37].

This model seems to be appropriate for representing coated metals, metallic paints and plastics as well and has form:

fr (x, ω ~ in , ω ~ out ) =



ρd + (1 − ρd ) · Cmax · ξ(m) · F (θ0 ) . π

Note, that this is general form of this BRDF usable for plastics as well. diuse component is almost negligible, thus

ρd = 0.

(2.54) For metals,

As can be seen from the formula 2.54,

diuse and specular terms are coupled (to meet the energy requirements that

ρd + ρs ≤ 1).

Particular parameters of the BRDF are:

Cmax = where

s

s2 , 2π(1 − (1 + s)e−s )

is shininess of the material. Note, that for

parameter is

s > 10, Cmax

(2.55)

simplies to

s2 2π . Another

ξ(m): ξ(m) = e−s·m ,

(2.56)

~ · ~h)N ~| . m = |~h − (N

(2.57)

where

F (θ0 )

is Fresnel reection computed for the angle

θ0 :

~ · ~g )N ~ |/2) , θ0 = arcsin(|~g − (N

(2.58)

2.5. IMPLEMENTED BRDF MODELS

49

where

~g = ω ~ in − ω ~ out . Assuming that for metallic surfaces diuse albedo is negligible and shininess

(2.59)

s

of such ma-

terials is at least 10, BRDF for metal is:

fr (x, ω ~ in , ω ~ out ) =



s2 −s·|~h−(N~ ·~h)N~ | ·e · F (θ0 ) . 2π

(2.60)

Layered surfaces This group includes special sort of BSDF models. These models usually consists of arbitrary layered basic BSDFs and through this layering, desired properties of the nal material can be reached. In this case, basic model stands for the any other BSDF like this mentioned in this thesis, like Lambertian, Phong, Ward, Cook-Torrance, and others. Each layered model of this group has its own requirements on BRDFs used as its layers and also diers from each other by the principles, how the layering itself works (interactions between adjacent layers, layering constraints etc..). Practical example of such layering is lacquered varnish or lacquered wood, where diuse base layer is covered by glossy transparent layer.

2.5.2.28 Layered mixture Layered mixture BSDF was developed within this thesis, having only one purpose: to demonstrate an usage of layered surfaces. Its idea is based on the Weidlich-Wilkie BRDF model [55], but with several simplications. There can be any number of layers, arbitrarily layered,

Figure 2.6: Principle of layered mixture BRDF.

CHAPTER 2. REFLECTANCE MODELS LIBRARY - BRDFLIB

50

without any assumptions on their type/functionality. Final BRDF is evaluated as sum of rst layer BRDF and recursively attenuated BRDFs of layers under it (see Fig. 3.14). Same set of vectors (incoming and outgoing direction) is used for all BRDFs in the layers. tenuated factors are thickness and absorption coecients of the layer.

At-

Despite this "sum

principle" does not fulll energy conservation, results are quite good and such a mixture is fairly exible model. Sum principle can be analytically expressed as:

~ in , ω ~ out ) · al . ~ in , ω ~ out ) + frl+1,f inal (x, ω ~ in , ω ~ out ) = frl (x, ω frl,f inal (x, ω







(2.61)

~ in , ω ~ out ) is nal BSDF of the layer l (accounting with underlying layers), frl,f inal (x, ω ~ in , ω ~ out ) is BSDF of the layer l (basic one) and al is attenuation factor of the layer frl (x, ω l: where

−αd( θ 1 + θ 1 )

a = e where

d

is layer thickness and

α

in

out

,

(2.62)

is wavelength-dependent absorption coecient of the layer.

Unlike in Weidlich-Wilkie model each BSDF of particular layer uses the same set of input directions

ω ~ in , ω ~ out .

Final BSDF of the layered surface is then obtained as an evaluation of

the BSDF for the topmost layer, which starts the recursive process.

Chapter 3

BRDF visualization application BRDFVis BRDFVis is graphically oriented, multifunctional application for visualization and testing of BRDF models.

It is based on the Qt application and UI framework and therefore is

cross-platform. BRDFVis uses BRDFLib library and maintain its principles and versatility design.

Among its main advantages belongs universal interface for working with BRDF

models implemented within BRDFLib library, which makes the deployment of an arbitrary new model a matter of only few necessary adjustments. In addition to BRDF visualization utility and many other features, a Pathtracer module is included, allowing user to investigate the behavior of the tested model in practice within integrated test scene.

3.1 Basic requirements Original idea of an user-oriented BRDFLib-based application, serving as a framework for BRDF models testing, came together with several basic assumptions and requirements on its appearance, behavior and/or functionality respectively.

These requirements strongly

inuenced and later resulted in nal application design, hence for better understanding of its basic principles, some summarization of these requirements should be made:

• Ecient performance

- Execution of computationally expensive operations should

be as fast as possible. Due to expected involvement of raytracing-based renderer, which is usually very computationally expensive part of such an application, fast execution is a must.

This is a requirement on programming equipment as well as on eective

coding approach. Not only this is the reason, why C++ programming language was picked for the implementation. Because it is fast and eective, and, of course, agrees with an idea of deployment of in C++ written BRDFLib.

• Windows-UNIX portability - Application must be executable and compilable both on Windows and Unix. Due to this portability requirement, attention had to be paid during both implementation and potential selection of external resources to preserve OS-independence (within Windows-Unix OSs) at each level. In this case, Qt framework

51

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

52

[40] is a perfect choice for developing OS-independent applications, because its crossplatform itself and therefore all the portability issues are already handled internally. Since OS-independence requirement was also applied to BRDFLib development, its deployment is non-problematic as well.

• Platform independence

- There should not be any specic constraints about the

hardware, which application needs to fulll to run properly. In the last decade, hardware acceleration of computationally expensive operations, typical for rendering applications, is used widely. It leads to signicant increase of performance, but usually also brings a disadvantage of connection to specic type of hardware (as in case of CUDA technology of nVidia graphics cards(GPU)). We do not want such a platform restriction within this application, thus we avoid the usage of these platform-dependent acceleration techniques.

• Sustainability - Source code must be persistent.

It means, that all of its components,

including especially those external ones, should be compatible together as long as possible. If we do not take into account BRDFLib, where no additional core interventions are expected, focus of this sustainability requirement has to be concentrated on the right choice of external resources. Again, Qt from Nokia [40] was ideal option in this case, because it is backward-compatible, open-source framework and has huge base of users/developers, thus we can expect, that it will be supported for some time.

• User-oriented graphic interface - Application must provide intuitive graphical user interface (GUI) for simple and comfortable control. There were several options of OSindependent frameworks for GUI application development, like

Gtk(+),

or

Qt.

OpenMotif, wxWidgets,

Last two belong to the most popular cross-platform toolkits and both

of them can be considered as a good nal solution for development of this application, although I did not have any practical experiences with any of them. However, Qt framework seems to have better support for MS Windows development (like e.g. integration of the widget designer directly into MS Visual Studio) and, generally, wider developers/users community, therefore nal choice fell on it.

• Maintain BRDFLib principles

- Application should be adjusted to BRDFLib and

not vice-versa. This means, that application should be designed to only use this library, being above it in some kind of hierarchy, and not at the same level, where many adjustments of the library would be performed to work properly.

In other words,

library should stay universally usable for other applications, not only adjusted for this specic application.

3.2 Application design Incorporating requirements from previous section 3.1, basic idea of BRDFVis application design came into being.

Taking some of the advantages and disadvantages of the most

recent application of this type [11] into account, a new innovative approach was proposed as an addition to already existing solutions. The main goal was to create a graphically oriented, comprehensive application for testing of BRDF models, implemented in the BRDFLib library and with the help of this application

3.3. APPLICATION STRUCTURE AND HIERARCHY

53

verify the behavior of each model both practically and theoretically.

Application should

meet the conditions mentioned in previous section. BRDFVis is application designed for BRDF models testing. This label obviously condemns it to provision of sucient amount of visualization and testing tools for their analysis. And, of course, BRDFVis provides such tools. Beside BSDF function visualization using the unit hemisphere, there are tools for testing this BSDF on the test scene using direct illumination or environmental mapping, as well as tools for path tracing (including path tracer itself ). The design characteristics of these visualization tools are based on practical needs for adequate analysis and testing of BRDF models. One of the fundamental desired functionality deals with the opportunity to compare BRDF models to each other or themselves in various visualization and rendering modes. But it is not only the examination of a particular model in dierent types of visualization modes, but also the opportunity to see the same model simultaneously from two dierent point of view. Assuming this idea,

Total commander -inspired

([5]) design with two views

was chosen as a base for application user interface (UI). Moreover, there can be any number of BRDFs in each view, organized through tabbed pane design, which is used especially by web browsers. Because of these two views, in which user can freely add, organize or delete any BRDF model, this adjusted design has suitable properties for model comparison and thus is probably the most appropriate for our purposes. BRDFLib deployment itself brings certain issues to design of this application. In respect with BRDFLib versatility, which we wanted to follow, one of the most important issues to solve was, how to cope with BRDF model parameters in an universal way.

In other

words, how to create enough suitable UI for an arbitrary BRDF model, without need to have it predened for each particular BRDF and consequently how to represent various parameters types. Final solution was quite complex and required certain interventions even in the BRDFLib. However, result can be considered as sucient, having fully dynamic UI creation. Concrete form of it is described in section 3.5. Another important issue is congurability in both global(application) and local(BRDF model) scope. Application is adjustable through the settings, where its basic behavior can be congured. Commonplace is then persistence of this conguration in subsequent executions of BRDFVis, hence settings is stored in an external conguration le. From the local scope, user can setup visualization/rendering properties of BRDF widget or predene parameters for particular BRDF models. Congurations les are present as well for these settings. Important property of each complex application is centralized, transparent, and ecient management of resources.

For this purpose there is the Resource Manager component in

BRDFVis, which handles all the resources I/O operations, as well as it organizes loaded scenes and environment maps and provides them to application.

3.3 Application structure and hierarchy Workspace of the application (content area) is divided into two

views,

each behaving like

containers for any number of BRDF widgets. Besides the title, view consists of tabbed pane, where BRDF widgets are placed.

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

54

BRDF widget

is basic element of the UI of BRDFVis application. All the necessary

functionality connected with BRDF model analyzing/testing is placed there.

The main

purpose of the application is then only to organize these widgets within mentioned views. Besides views, application contains component for resource management -

ager,

Resource man-

BRDF models help provider - Help manager and various settings. Application struc-

ture overview can be seen in Fig. 3.1.

Figure 3.1: BRDFVis structure overview.

3.4 Detailed description of application components In this section, all the components of the application (including application itself as a main component) and their functionality, will be described one by one in detail.

3.4.1 BRDFVis application - main component Header:

3.4. DETAILED DESCRIPTION OF APPLICATION COMPONENTS

55

Figure 3.2: BRDFVis application UI.

As it was already discussed in this chapter, application can be split into several components, based on the functionality they deal with. Actually, application itself can be considered as one of them. Its main purpose is organization of BRDF widgets and providing resources to all of them through the resource manager. Fig. 3.2 shows BRDFVis application and its visual decomposition into particular views, which consists of individual BRDF widgets.

3.4.1.1 Views As can be seen in Fig. 3.2, main window of the application is split into two separated views. Second view is optional, and user can hide if he wants to. In this case, application is resized automatically to show only the rst one. View is represented as tabbed pane, which acts similarly to web browsers, where each website has its own tab(subwindow). In analogy, each BRDF widget has its own tab in the view, in which it is placed. User can then add new BRDF widgets or remove existing ones at will. As an addition, preserving the idea of BRDF models comparison, application oers a possibility to create copy of arbitrary BRDF widget in any view. This feature is described in detail within next section 3.4.2.

3.4.1.2 Resource provider Another purpose of this main component is providing resources to BRDF widgets.

For

handling resources, there is a Resource manager component, but BRDF widgets have no idea about its existence, because only application has the access to it. In other words, from

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

56

the point of view of BRDF widget, resource provider is the application itself and all the resource requests are send to it. Thus, in fact, application serves only as mediator in this case.

3.4.1.3 Help provider Besides providing resources like scenes or images, there is a special type of resource - BRDF help, handled directly by the application. BRDF help is detailed description of the concrete BRDF model, composed as HTML page with CSS formating, displayable in web browsers. Therefore, not being a plain text, particular BRDF help, requested by the BRDF widget, is displayed in separate

Help viewer.

This

Help viewer

is a dialog window provided by the

application, deploying Qt web view widget, which is, in some sense, simple web browser. Particular BRDF description can be then displayed to user very easily in a well-arranged form. Moreover, because original papers of BRDFs are usually available for free, data folder of the application contains these available ones and oers user an opportunity to open them directly from the BRDF widget in default PDF reader of the system.

3.4.1.4 Settings Header: Being comprehensive application, BRDFVis has its own congurability.

This can be

performed through application settings dialog, where basic behavior, common for the whole application, can be adjusted. Besides that, user can congure his own settings of the BRDF widget environment, which can be then arbitrarily imported and/or exported from/to conguration les. Congurability is also contained in BRDF models itself. Specic setup of particular BRDF can be dened and also exported/imported for future use.

3.4.1.5 Error collector Due to the nature of BRDFLib library, which can be used by arbitrary application (with or without GUI), error messages produced within the library are sent to standard output (cout, cerr). This cannot be, however, processed directly by the GUI-based application, where no command line is present. For this purpose, additional approach was used, redirecting these standard output streams to debug input stream of Qt, where error messages are recomposed and nally processed by the application.

In this case, application serves as a collector of

these error messages and based on the currently active BRDF model (one, that currently renders an image and thus probably created the message), it forwards received error message to the BRDF widget, that manages this BRDF model.

There is nally processed on its

own. Obviously, this process cannot be done directly without adjustment of BRDFLib to this application (see section 3.1). Error messages collecting in the form of processing even tens of thousands error messages per second during rendering is quite computationally expensive business, which slows the rendering itself. Hence, it can be disabled in the main application settings.

3.4. DETAILED DESCRIPTION OF APPLICATION COMPONENTS

57

3.4.2 BRDF widget Header: BRDF widget consists of several principal parts, which can be described separately. First two (GL widget, Path tracer) can be considered as essential ones and thus necessary for the desired functionality of the application, while the rest is rather features. On Fig. 3.3 BRDF widget, as the basic element of the UI, is described with all of its main parts.

Figure 3.3: BRDF widget and its parts.

3.4.2.1 GL widget Header: This component is the most important part of the whole BRDF widget. It uses crossplatform Open Graphics Library (OpenGL) for drawing the results of both BRDF visualization and rendering.

Because rendering is the essential part of this application and the

resolution of rendered image corresponds with the size of this widget, it is dock widgetbased, and therefore can be arbitrarily removed (undocked) from the UI of BRDF widget

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

58

and treated as individual window. User can resize this undocked window at will, fullling his concrete needs. Of course, it can be docked back to its original position at any time. To preserve standard, user friendly behavior, double-buering is used for both visualization and rendering, avoiding unintended image artifacts.

3.4.2.2 Path tracer Header: Path tracer component serves as a main rendering executor.

All the image synthesis,

based on local or global illumination methods, is performed here. Resulting rendered image is then given to GL widget to be drawn. Pathtracer disposes of 3 main rendering methods direct illumination, environmental mapping, and path tracing itself. These are described in detail within the section 3.6. All these rendering methods are very computationally expensive operations and therefore several performance issues need to be solve within it. As a base, all the rendering threads need to be executed asynchronously and independently so that it will not overload main application thread, which cares about all the UI requests coming from the whole application. This is quite classical issue, need to be solved within these types of applications. Besides that, there should be some performance enhancement to accelerate these expensive computations. Path tracer of this application oers several solutions of this kind:



It supports

parallelization

through multi-threading approach.

Image area is divided

into several equal segments and these segments are then processed by rendering worker threads asynchronously. This rises performance of the renderer especially on multi-core processors.

• Hitpoint caching.

In some situations, where positions of objects in the scene (rendered

object, light and camera) are xed, one does not have to evaluate all the ray-scene hits every time, when new render is evoked. Instead of it, it is sucient to evaluate them only once for such static context and save the particular results for the future use. This signicantly accelerates the rendering, but at the cost of some memory. Moreover, this approach, obviously, cannot be applicated in the situations, where image is antialiased through pixel subsampling (see Section 3.6.4) (which cause dierent ray-scene hits results all the time).

• Acceleration data structure.

An auxiliary hierarchical data structure is constructed

for the scene, eliminating most of redundant ray-scene hits tests.

This approach is,

without any doubts, the most eective way, how to accelerate computations in path tracing-based rendering. In our case, KD-tree ([53]) acceleration structure is built for the scene.

3.4.2.3 BRDF model GUI Headers: , , Headers: ,

3.4. DETAILED DESCRIPTION OF APPLICATION COMPONENTS

59

This is GUI representation of BRDF model, or its parameters, respectively. Upon BRDF creation (evoked by selection of one of the BRDFs from the list), for each of its parameters, corresponding UI must be created. There is no predened UI for the concrete BRDF, all the creation is performed dynamically, based on the particular parameters. Concrete form of connection between BRDFVis and BRDFLib is described within the next section 3.5. Basically there are 4 types of GUI elements for BRDF parameters implemented in BRDFLib (see Fig. 3.4): 1. Checkbox for boolean parameters, 2. Texture editor for texture-based parameters (majority). At this time, only constant textures are supported, 3. Fresnel editor for Fresnel terms, 4. Layer editor for layers of multi-layered BRDFs.

Figure 3.4: Examples of UI elements for BRDF a) boolean parameter, b) texture parameter, c) Fresnel term, d) layer

3.4.2.4 Settings Header: This part of BRDF widget deals with the GUI for particular visualization modes. Each visualization mode has many properties, that can user set and change the the way, how visualization/rendering behaves. It is not necessary to describe each such a property here, but generally, most of them are based on practical needs for BRDF model inspection. All the user changes within these settings are applied immediately on the visualized entity, except of Path tracer mode, where this behavior can be set explicitly. There is one important feature within these settings - the possibility to import and export them from/to a le. All the settings I/O operations are handled by the main application component, therefore it is described more in detail within its section (3.4.1), but generally, user can arbitrarily save any settings he/she has set up, and then load it later for another BRDF widget, or even dene it as a default one for the whole application.

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

60

3.4.2.5 Animation manager Header: Animation manager is a GUI for the animation feature settings. That, briey said, deals with the creation of sequence of rendered images, each with dierent settings of the scene, automatically performed by the animation manager. For example, user can set properties of automatic rotation (like overall rotation and/or rotation step) of the light in the scene around the center of the scene. Animation is then executed and sequence of images is rendered and saved to specied location in specied format.

This sequence can be then used in some

external video software utility, like Virtual Dub ([6]), for assembling into movie. More about the animation feature can be found in the Additional functionality section (3.7.4).

3.4.2.6 Error organizer Headers: , As was already mentioned in the main application component section 3.4.1, warning/error messages originated in the BRDFLib must be redirected to the application. These messages cannot be send directly to BRDF widget, whose BRDF model caused them, but through the main application component, that subsequently forwards them to the corresponding BRDF widget. Error organizer is a component, that receives these forwarded messages and organizes them into corresponding groups. Generally, there is only a limited number of errors/warnings that can be thrown from the specic BRDF model. However, taking into account the nature of the ray/pathtracing, where BRDF is evaluated many times for each aected pixel of the rendered image, they can be thrown many times during rendering. This component gathers all these messages and based on their content (message text itself ) it collects these of the same type and only counts their number of occurrences. Finally, these messages can be displayed to user in well-arranged tabular form, containing only message-occurrences couples.

3.4.2.7 Performance tester Header: For the purpose of BRDF models eciency comparison, there is Performance tester component. Testing itself is described later in section 3.7.5. At this time, we only outline the basic functionality of this feature. BRDF models can be compared to each other in several ways, including visual comparison of their results, obtained from the practical usage in rendering applications such as path tracing. However, they also diers in their computational eciency. For example, HeTorrance BRDF model is very credible, but it is also extremely computationally expensive for evaluation. On the other hand, Phong BRDF is cheap to use at the cost of less exibility. Performance tester is actually very simple tool for BRDF eciency testing in terms of performance. It simply runs all the core evaluation methods of the particular BRDF model multiple times with randomly generated inputs and measures times of their execution. Models can be then compared numerically to each other, based on the results of performance

3.4. DETAILED DESCRIPTION OF APPLICATION COMPONENTS

61

Figure 3.5: BRDF Performance tester.

testing. UI of the Performance tester is shown in Fig. 3.5.

3.4.3 Resource manager Header: Comprehensive applications needs centralized management of resources. ings/savings of images, scenes, settings, etc. transparency of the application.

All the load-

should be handled at one place to maintain

For this purpose, Resource manager was designed as an

important part of the application's base. Resource manager takes care about the loading of requested resources.

For example,

when user choose another scene for rendering in BRDF widget, application is asked for this scene. Application, serving only as mediator between BRDF widgets and Resource manager then forwards this request to the Resource manager, which holds all the resources. In the case, that scene is not already loaded, it uses one of its internal parsing tools for its loading. Scene is then given through the application to the BRDF widget, that asked it for. For the purpose of resource loadings, there is few auxiliary tools contained in the Resource manager:

• OBJ loader,

which cares about the scenes creation, based on the parsing of scene les

in .obj format.

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

62

Figure 3.6: Resource manager UI.

• HDR loader,

which cares about the environment maps creation, based on the parsing

of .hdr image les.

• Image loader.

This is actually internal Qt tool for importing images of various formats

and used by the Resource manager for image loading. Besides resource loading, Resource manager is also useful for exporting. Basic functionality connected with visualization and/or rendering is to save resulting image to a le. This kind of request is also processed through the application in the Resource manager. There is many basic image formats, supported by the application for exporting. Even the Resource manager has its own GUI. Whenever any resource is being loaded, application oers well-arranged form of its progress to the user. One can there see e.g. name of the loaded resource, its full path and, of course, progress of the loading itself in textual and graphics form (see Fig. 3.6).

3.5 Connection to BRDFLib BRDFVis deploys BRDFLib library with all of its BRDF models.

For the proper use of

this library, some of its structures like vectors, parameters values, etc. had to be used in the application as well.

However, this is rather advantage, because these structures are

implemented eciently in the BRDFLib, thus there was no need to implement them at our own. Application tries to maintain principles of the library, following its universal approach. As a result of this, smart and versatile system of BRDF parameters handling had to be proposed. Major deployment issue to solve was how to cope with the dierent parameters of BRDF models in GUI-oriented application. Each model has an arbitrary number of parameters of any type, so a unied interface for all types of BRDF models would be very complicated and confusing, or in another words - unusable. BRDFLib was adjusted within this thesis, that each BRDF parameter can be described universally by an array of oating point values

3.6. CORE FUNCTIONALITY

63

(CValues), beside its concrete representation (usually texture -

CTexture).

That is, from the

user's point of view, quite universal and good solution, because parameters are not connected with heterogeneous structures. Based on that a naive, but stable solutions are coming into mind.

First - for each BRDF model implemented in the library, create a concrete UI in

the application and bind parameters to it, or second - for each model dynamically create universal UI, which will consist of M·N oat values, corresponds to M parameters each with maximal N values. However, these are not exible solutions and as for rst, would require completely new UI for each new model added to BRDFLib, while the second is excessively universal, confusing the user. When looking at individual parameters of BRDF models, we can nd that there is actually only several types of parameters representation (color, vector, scalar, etc.).

As in

BRDFLib library, there is an approach to follow its universal design, but concurrently we want to avoid any ambiguities in the UI. As a result of this issue, solution for this purpose was proposed. Within this solution, BRDF model interface implemented in BRDFLib was enriched by a set of methods (see previous chapter 2) for sucient parameters handling. This leads to an ability to construct specic BRDF UI dynamically, based on the description of particular BRDF parameters.

At the same time, concreteness of the UI is preserved -

BRDFVis user knows the meaning of each parameter and what he/she is setting through it. In others words, each parameter of BRDF model has ability to suciently describe itself to application, whose task is only to present this description to the user through UI. Because interface of the application is adapted for any known parameter automatically, deployment of newly implemented BRDF model is then very easy thanks to this approach.

3.6 Core functionality Core functionality of the application deals with the BRDF models investigation. Basically, there are 4 dierent tools in the BRDFVis application for this purpose: 1. Visualization of BRDF, 2. Point light mode - direct illumination, 3. Environmental mapping, 4. Path tracing.

3.6.1 BRDF visualization mode In this mode, BRDF is visualized on triangulated hemisphere. Half-space unit hemisphere is triangulated with chosen smoothness and for each vertex on it, directional vector is obtained as incoming direction. Outgoing direction is xed by the user through

θ, φ parameters.

Both

these directions are then passed to BSDF evaluation method of the current BRDF model (

EvaluateBSDF())

and color of the particular vertex is computed. According to set visual-

ization properties, this vertex color is then used for following types of BRDF visualization modes:

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

64

• Shape.

Each vertex on the hemisphere is shifted in the direction from the center, ac-

cording to luminance of the color, obtained as BSDF result. Distance of the particular vertex from the center of the hemisphere then corresponds with the value of luminance in this direction. Hemisphere deformed in this way, simulates the distribution of the energy of reected light in the half-space. Note, that this mode can be combined with others.

• True color.

Color of each vertex on the hemisphere corresponds to BRDF in partic-

ular direction. This mode can be applied on both unit hemisphere and/or deformed hemisphere, described in the item

• Pseudo-color. color.

Shape.

Color of the vertex on the hemisphere corresponds to mapped pseudo-

At rst, BRDF is evaluated for each vertex on the hemisphere and maximal

and minimal luminance across these values are stored. Then the maximal luminance is mapped onto maximum of pseudo-color range, while minimal to its minimum. All the luminance values for the BRDF across the whole hemisphere are then mapped into this color range and assigned to the vertices colors. In our case, pseudo-color range is predened as from blue, through green, to red, where minimal luminance across the hemisphere corresponds to pure blue color, mean luminance to pure green and maximal to pure red color. All other values are linearly interpolated within this range. Examples of these modes are situated in the Fig. 3.7. Note, that user can switch incoming and outgoing directions arbitrarily, having the opportunity to test the reciprocity of the investigated model. Besides the BRDF hemisphere, user can display arbitrarily transparent unit hemisphere in the visualization at the same time. In the case of BRDF

shape, this allows visual compar-

ison between luminance values of BRDF in particular directions against the unit luminance, which should, in physically plausible models, stands for upper bound (energy conservation principle). Properties of triangulation, along with many other parameters are congurable. Since this mode uses OpenGL rasterization for rendering, it is very fast.

3.6.2 Point light mode (direct illumination) This mode is provided by the Path tracer component and its purpose is very simple : test BRDF model directly on the test scene in computationally cheap way. This is the rst mode in BRDFVis, that uses ray tracing technique of rendering. Only direct illumination is evaluated in this mode, therefore only primary and optionally shadow rays are cast. Evaluation of BSDF uses the function

EvaluateBSDF

from BRDFLib.

Moreover, rendered object is

illuminated by the point light, as the most simple form of illumination, that can be used. Preserving the performance of Point light mode, resulting image is neither antialiased, nor tone mapped. Example of the usage of this mode can be seen on Fig. 3.8.

3.6.3 Environmental mapping mode This mode is more comprehensive and computationally expensive than Point light. It uses high-dynamic range image (HDR) as an innitely distant environment, by which rendered

3.6. CORE FUNCTIONALITY

Figure 3.7:

65

BRDF visualization examples a) visualization by shape, b) visualization by

pseudocolor on unit hemisphere, c) visualization by shape using pseudocolor, d) visualization by direct BRDF value on unit hemisphere, e) visualization with auxiliary unit hemisphere, f ) triangulation of the visualization shape.

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

66

Figure 3.8: Point light mode

object is completely surrounded and illuminated.

Principally, there are two possible ap-

proaches in this application, by which the environmental mapping can be performed:

• Direct illumination.

For each environment map, there is a set of pregenerated direc-

tional lights samples, which corresponds to the illumination of this map. computed by importance sampling [17].

They are

For each hitpoint on the rendered object,

BSDF for all these directional lights is evaluated and then nal color of this point is obtained as an average of these BSDF values.

Since some discretization is used in

this approach (there is usually about 100-1000 such pregenerated directional lights), this mode is more suitable for diuse(matte) materials (theoretically, perfect mirror material need innite of these lights to evaluate correctly, thus it is not intended to use this approach for mirror-like surfaces).

• Importance sampling.

nation.

This is almost completely opposite approach then

direct illumi-

Here, for each hitpoint on the rendered object, some user-dened number (usu-

ally 500 is enough) of importance sampling driven stochastic rays are spawned (reected

3.6. CORE FUNCTIONALITY

67

Figure 3.9: Environmental mapping mode performed by a) Importance sampling b) Direct illumination method.

from the material) into the environment, using the function from BRDFLib.

SpawnStochasticRays

Then for each such a spawned ray, color of the environment in its

direction is obtained from the HDR image and weighted by the probability of the ray. Final color of the point on the rendered image is then computed as an average of these particular colors. This approach is more suitable for highly specular (mirror-like) materials, where the most of the spawned rays coincide with the mirror direction. From this point of view, diuse materials evince too much diversity of stochastically spawned rays, resulting in the noise in the image. Examples of both methods are situated in the Fig. 3.9. As an addition, user can arbitrarily adjust brightness of the environment map as well as the luminance of pregenerated directional lights. Not only because of usage of high-dynamic range images, tone mapping is the part of this mode, serving as a way to adjust tones in the nal image. Following tone mapping modes are supported within environmental mapping:

• Automatic tone mapping.

Automatic tone mapping is based on log-average luminance

used as key value. It uses the method described in [24]. This way of mapping cause that luminance values in the range 0.0-1.0 will stay almost untouched, whilst values higher than 1.0 (pure white color on the PCs screen) will be logarithmically mapped into the displayable range, so that they will not inuence the values already in this range (unlike linear mapping, which does).

Colors in the result image will be more

balanced than in the linear case, where usually occurs, that when HDR map is linearily mapped into the displayable range, there is several very bright places and the rest of the image is contrarily very dark.

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

68

Figure 3.10: Path tracing mode. a) Scene preview with direct lighting only using OpenGL b) path tracing.

• Linear tone mapping.

Linear mapping just computes the ratio between the maximal

luminance in the image and 1.0 and then multiplies all the colors in the image by this ratio. Moreover, this ratio can be adjusted (multiplied) by the user-chosen multiplier.

• Key-value based tone mapping.

This mapping is based on the same idea as automatic

mapping, but in this case with user-adjustable key value. User can then choose, how luminance values will be weighted in the nal image by positioning key value in the range 0.0-1.0 (which has the highest impact on the whole log-average based mapping). Besides that, gamma correction can be also applied to the nal image as another image correction approach. Standard gamma value is set to 2.2.

3.6.4 Path tracing mode This is the most computationally expensive rendering mode in the application. Nevertheless, it gives the most realistic image results. In addition to the local illumination, presented in the

Point light

mode, it oers more comprehensive way of image synthesis - path tracing

[22]. There are many denitions of path tracing, that can be found in various books, papers or in online sources. Briey said, path tracing is a rendering technique, that attempts to simulate the physical behavior of light as closely as possible. It is a generalization of conventional ray tracing. The image quality provided by path tracing is usually superior to that of images produced using conventional rendering methods. computation requirements.

This is however achieved, at the cost of much greater

3.6. CORE FUNCTIONALITY

69

Path tracer used in this application belongs to the basic ones in its class. In order to get high quality images from path tracing, a large number of rays must be traced through the scene to avoid visible artifacts in the form of noise. That is why many ray samples are generated and cast through each pixel of the image and their results are, based on the integration nature of path tracing, averaged into nal color. These rays are traced from the camera until they strike a light, too many bounces ("depth") have occurred or ray energy has been completely absorbed by the material.

All these attributes, like maximal

tracing depth or ray samples per pixel can be adjusted through the UI of the path tracer for the concrete user's needs. Path tracing naturally simulates many global illumination eects that have to be specifically added to other methods (conventional ray tracing or scanline rendering), such as soft shadows, depth of eld, motion blur, caustics, ambient occlusion, and indirect lighting. To make these eects possible, scene has to consist of more than one rendered object. Follow-

1

ing this approach, rendered object is placed inside the adjustable Cornell box

in this mode.

Walls of this box have assigned physically plausible Phong material, whose parameters, along with the size of the box itself, can be set in the main application settings. Any changes made to this Cornell box settings can be applied directly on the already existing ones as well. As a light source for the scene, area light can be optionally used instead of point one, hence eects like soft shadows can be observable as well. Another classical issue, that renderers must deal with, is aliasing. composed from particular pixels of non-negligible square size.

Briey, image is

These atomic elements of

the image can have assigned only one specic color. In this sense, image is just a form of discretization of the 2-D projection of the original 3-D scene. This fact has several possible negative impacts on the image synthesis, that can and usually do occur during rendering. One of these artifacts is aliasing, usually visible in the form of blocky appearance of objects boundaries, caused by pixel undersampling. There have been proposed many ways how to avoid aliasing, called antialiasing. One of these techniques is also used in our path tracer and that is pixel subsampling. Incorporating mentioned reason of why aliasing occurs (undersampling), subsampling technique attempts to eliminate its issue. In this approach, primary ray from the camera is not cast just through the center of the pixel, but randomly within its whole square area. With sucient amount of such samples, their uniform-like distribution is achieved. Simply said, a pixel of a rendered image is split into much smaller subpixels, thus the mentioned discretization is much lower, resulting in smooth boundaries of the rendered objects. By the way, this is one of the reasons, why hitpoint caching can not be used in this rendering mode. Due to the huge computational complexity of path tracing, which cannot be therefore used in real-time mode.

2

applications, there is one more important approach applied within this

To preserve immediate response of the rendering in the case, that user move with

objects in the scene, or with the camera itself, scene preview is displayed at rst.

This

is performed through openGL rasterization (therefore it is very fast) and means that scene (rendered object + light + Cornell box) is completely rendered using some fast basic openGL shading. Path tracing itself is then executed either manually through UI or automatically 1 The Cornell Box is a classical test aimed environment for determining the accuracy of rendering software by comparing the accuracy of rendered scene with an actual photograph of the same scene. 2 Real time in this context means, that renderer is able to produce at least 25 images(frames) per second.

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

70

after some dened timeout from the last change expires. Scene preview is then replaced by the rst pathtracer-rendered image. Without this approach, user would have to wait up to several seconds, until rst image is rendered to see changes applied on the objects in the scene, which can be perceived as laggy behavior. As in the case of environmental mapping, for the purpose of best-looking results, both tone mapping and gamma correction can be applied to the nal image in this mode as well.

3.7 Additional functionality 3.7.1 Manipulation with BRDF models As an addition to various visualization modes, there is one more feature, demonstrating usability of this application for BRDF investigation/testing.

Besides the comparison of

behavior/results between two chosen models, having them opened side by side in particular views, application oers a way, how to investigate one model from two dierent points of view. As an option of BRDF model, there is an item Create reference. This option makes a

shallow copy of the current BRDF model and insert it in a chosen view. In this sense, shallow copy and/or Reference are terms for the BRDF widget, whose BRDF model is copy of the source one (called Master model, or Master widget respectively) and their BRDF parameters UI is interconnected. From this time, BRDF parameters can be adjusted in the Master only, because Reference has its own disabled and all the adjustments of BRDF parameters in Master are automatically applied to Reference as well. Important is, that other settings stay unconnected, thus can be set independently. This is very useful for mentioned looking at the chosen BRDF from two dierent points of view at the same time. Using this feature, user can open arbitrary BRDF model, create its reference in the second view and then observe, for example, its theoretical properties in the form of visualization

Master widget, while its practical appearance is tested in any rendering mode within Reference widget simultaneously. Example of such doubleview is situated in Fig. 3.11. As a user-friendly application, there is also possibility to disconnect shallow copy from its Master at any time, so that each of them will behave independently since then. in the

Besides the creation of shallow copy, a user can choose to create a duplicate of the BRDF model. This just simply creates a new BRDF widget in a chosen view and sets its BRDF according to the source one. This serves for the fast BRDF copying, without having to set its parameters manually.

3.7.2 Conguration Both BRDFVis application and BRDF widgets have many attributes that can be congured through various settings.

This includes settings of visualization/rendering modes within

BRDF widgets, Cornell box settings, application resource paths and many others across the whole application.

Moreover, in most cases, there is a possibility to export/import these

settings to/from conguration le. Basically there are 3 types of settings in BRDFVis, each having its own conguration le:

3.7. ADDITIONAL FUNCTIONALITY

71

Figure 3.11: BRDF referencing feature.

• BRDFVis application settings

(le extension .BAS). This includes settings of applica-

tion paths, some fundamental behavior connected with BRDF widgets creation and also Cornell box settings, common for the whole workspace. This settings is loaded automatically, when application starts and saved, when settings dialog is conrmed by the user.

• BRDF widget settings

(le extension .BMS). This includes all the BRDF widget vi-

sualization/rendering modes settings.

Conguration le with default BRDF widget

settings is specied within application settings and each newly created BRDF widget UI is set according to it. Moreover, this settings can be manually saved = exported at any time through BRDF widget Options menu and then imported wherever else (or also used as a mentioned default one).

• BRDF parameters settings

(le extension .BPS). This includes settings of each param-

eter of all available BRDF models. Parameters of particular BRDF model cannot be saved separately, only within the whole available set. As in the case of BRDF widget settings, it can be exported/imported at any time from BRDF widget Options menu. Chosen .BPS conguration le can be also specied within application settings as default one for BRDF models initial settings.

Note, that these les are manipulated through the application automatically during exporting. Moreover, they are manually editable as well. Concrete syntax of these conguration les can be found in Appendix D.

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

72

3.7.3 Export of rendered image Basic functionality connected with visualization and/or rendering is to save resulting image to a le. This can be performed through quick-save button in the left-upper corner of the GL widget. Application supports following image le formats:

BMP, ICO, JPEG, JPG, PNG,

PPM, TIF, TIFF, TGA, XBM, XPM, HDR. Most of these formats are provided directly by Qt framework. Note, that concrete list of supported formats may vary depending on the concrete platform.

3.7.4 Animation Besides the single image export feature, there is also tool for creating image sequence. This can be then used to prepare a video. This sequence is made through Animation manager (see Fig. 3.12), which can be executed by the camera button, located under the image export button in the left-upper corner of the GL widget. Animation is available for all the rendering modes (thus not available for BRDF visualization) and works in this way:

Figure 3.12: Animation manager.

3.7. ADDITIONAL FUNCTIONALITY

73

1. User sets up the scene, image resolution, etc. within current rendering mode by his/her own needs. 2. User opens animation manager and chooses properties of image sequence export, like target image le extension, directory, where sequence of images will be saved to and prex for the images names.

During animation, images will be then saved with the

name [prex][4-cipher number of the frame] - for example, if .BMP image extension was chosen, prex is specied as anim and 23th frame is being exported, than its name is anim0023.bmp. 3. Then animation properties are specied.

There are two possible targets for anima-

tion - light and camera. Animation itself is then driven by rotation of these objects around the center of the scene. Hence, rotation parameters can be specied for both of these objects - start rotation, rotation step and overall rotation, all expressed in angle units. Note, that only vertical (around the axis Y) rotation can be specied, all other parameters remain the same, according to scene setup in the step 1. 4. Then animation process is started by the user.

Number of frames in a sequence is

precomputed from the settings and animation objects are placed into their specied initial location (according to initial rotation). rendered and saved in target directory.

Then rst image for this context is

In each subsequent step of the animation,

automatic rotation by the specied step around the axis Y is performed and new image is rendered and saved. 5. Final sequence of images can be then assembled into short movie in some external tool (e.g. Virtual Dub [6]).

3.7.5 BRDF performance testing BRDF models can be examined in several ways.

Various visualization/rendering modes,

already presented within previous sections, deal with the visual investigation of the model correctness. But there is also another important property within BRDF model to test - its computational eciency, or, in other words, its performance. BRDFVis application oers a sucient tool for this purpose - Performance tester. Principle of Performance tester is actually very simple - test the performance of the particular BRDF model by the evaluation of its core methods (1) repeatedly, measuring time of the overall execution. User can specify, which of these methods should be tested. Each such a method is then evaluated many times, using randomly generated inputs and time of the execution (including only the evaluation itself, not generation of inputs or another actions) is measured. Thanks to this feature, BRDF models can be compared numerically to each other in a simple, but eective and transparent way.

3.7.6 BRDF help For the better understanding of BRDF models principles and behavior, their sucient description is needed. Since BRDFVis application takes this issue into account, help support is included. Basically there are three help features for this purpose in the application:

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

74

• BRDF model description.

For each BRDF model implemented in BRDFLib, cor-

responding help le was created in the well-arranged, CSS-formatted HTML form. BRDF model help is then web page, that can be smoothly opened in conventional web browsers. Because its rich-text-based formatted form, including images, principles of the particular BRDF are more understandable for the user, than the common plaintext description. This web page form is also supported by the application itself, using simple web browser widget provided by Qt, sucient for displaying of information of this type. If requested, BRDF model description is displayed to the user in its own window, that can be manipulated individually so that user can manage its position/size according to his/her needs.

• BRDF model original paper.

Most of the papers, where particular BRDF models were

presented, are publicly available.

Therefore we decided to facilitate user the search

for them if needed and these public papers for implemented BRDFs are collected and placed inside the help directory of the application.

Moreover, they can be opened

directly from the application, using default PDF reader.

• BRDF parameters description.

Besides the general description of the BRDF model,

there is also interactive description of its particular parameters directly within the UI of the BRDF widget (see Fig. 3.13).

Area under the GL widget is reserved for

this purpose. Moreover, this area is actually dockable widget, similar to GL widget, and therefore can be arbitrarily undocked and treated as individual window. This is useful especially in the case, when description of the parameter is too long, thus it can be displayed only partially in the docked form.

In such case, user can undock

and resize it according to his/her needs and place somewhere at desktop to see its whole content properly, without obstructing the application itself. Help widget always contains description of the BRDF parameter, whose UI element was hovered by the mouse at last (that is why it is called interactive). Particular descriptions are obtained directly from the implemented BRDF model, through one of its BRDF parameters methods.

3.7.7 Multi-layered models support There is special type of BRDF model, implemented within BRDFLib, requiring completely dierent approach from the UI side.

That is arbitrarily layered model (concretely Layer

mixture). Because it does not contain any ordinary BRDF parameter, but BRDF models itself as its layers, special solution had to be used.

For this purpose, layer UI has been

created and prepared for the connection with the application. As a result, universal UI for the arbitrary layer exists (see Fig. 3.14). Moreover, BRDF widget is partially adjusted for this special type of BRDF in the way, that layers can be organized within this BRDF arbitrarily (user can change their order or freely add/remove them at will).

Each layer is then represented as individual BRDF widget, where all the

actions like rendering, visualization, etc.

can be performed independently, but contained

BRDF is used for the computations in the layered BRDF as well. There can be used any available model as a layer for the layered BRDF.

3.7. ADDITIONAL FUNCTIONALITY

Figure 3.13: BRDF parameter description area.

Figure 3.14: UI for arbitrary layered BRDF models.

75

76

CHAPTER 3. BRDF VISUALIZATION APPLICATION - BRDFVIS

Chapter 4

Results 4.1 BRDF models verication Implemented BRDF models were veried either theoretically or practically, based on their available resources and/or references.

Basically, there are several options, how to verify

implemented BRDF model:



Get rendered images from existing sources (e.g.

original paper of BRDF model or

other papers, technical reports, etc.), where concrete BRDF parameters used for the particular image are stated and use same set of parameters for own render.

Then

compare resulting images with reference ones. However, if reference image was rendered using specic scene objects or settings, it is usually hard to obtain same result.



Compare results of implemented BRDF (rendered images) with reference images obtained for the same set of parameters from the similar application (e.g. BRDFLab[11]).



Compare practical behavior of implemented BRDF model with theory, based on experiments.

Practical verication is not 100% accurate, because it also depends on many other aspects like e.g.

camera settings, environment map image quality, scene settings, tone mapping

settings, etc. Hence even the partial agreement with reference images can be considered as successful result.

Ward-Dür Implemented Ward-Dür BRDF model was veried practically.

Model was used for envi-

ronmental mapping with parameters used in experimental analysis from Ngan et al. [39]. Resulting images were then compared to corresponding ones in mentioned analysis (see Fig. 4.1). Camera for environmental mapping was set experimentally to match the view in reference images as close as possible. However, dierences between rendered and reference images are still noticeable.

77

CHAPTER 4. RESULTS

78

Left column - reference images from Ngan experimental analysis: a) page 47, b) page 89, c) page 111. Right column - images obtained from environmental mapping using implemented Ward-Dür BRDF. Figure 4.1: Comparison of Ward-Dür BRDF model results with reference images.

4.1. BRDF MODELS VERIFICATION

79

Note, that because of very low RGB color values, used as tted parameters in Ngan analysis and the fact, that accuracy of value of RGB color component in BRDFVis application is maximally 0.001, these problematic parameters were adjusted to better t into correct range (0.001-1.000), maintaining the same results.

Moroder-Dür Being relatively young model, there are no reference images of practical usage of MoroderDür BRDF in available resources. Therefore this analysis is based on the illustrated behavior of model for high incident angles, described in the original paper [12].

According to this

paper, we tested similar situation, where sphere is illuminated from behind and rendered images using Moroder-Dür and reference Ward-Dür BRDF was visually compared. Interesting parts of images for high incident angles were then analyzed in detail. Results can be seen in Fig. 4.2. Results shows similar behavior as in the original paper. Moroder-Dür BRDF provides more illumination (gray places on the dierence image e) at higher incident angles (but maintains energy conservation at grazing angles) than Ward-Dür, while for less incident angles the results are same.

Kurt-Kalos-Krivanek This model was veried practically. Model was used for environmental mapping with parameters used in original paper [26]. Resulting images were then compared to each other with corresponding ones in the paper. Both isotropic and anisotropic model were tested. See Figs. 4.3 and 4.4 for results. Isotropic variant matches the reference image well, therefore mirror-like rays spawning works ne.

On the other hand, anisotropic model shows signicant dierences, compared

with images from the original paper. However, these dierences can be explained by dierent choice of axis of anisotropy. Moreover, implemented Kurt-Kalos-Krivanek BRDF model uses approximation for Fresnel term optionally, therefore

f0

parameter can not be set explicitly as

in the case of reference implementation in the original paper. This can cause some inaccuracy as well.

Phong Original form of Phong BRDF model was veried according to the example of BRDF normalization from [19]. Here a normalized Phong BRDF is compared with unnormalized(original) form. In our case, normalized form is physically plausible Phong model, already implemented within BRDFLib. Same parameters for both models were set and then only shininess of the material were changed, which led to noticeable dierences between normalized and unnormalized form (see Fig. 4.5, taken from [19]). This behavior was veried in our application and can be seen on Fig. 4.6.

CHAPTER 4. RESULTS

80

a) Rendered reference image using Ward-Dür BRDF. b) Rendered image for Moroder-Dür BRDF. c) Detail of sphere illumination at higher incident angles for Ward-Dür BRDF. d) Detail of sphere illumination at higher incident angles for Moroder-Dür BRDF. e) Color dierence between both details (Moroder-Dür - Ward-Dür). Figure 4.2: Moroder-Dür BRDF analysis for high incident angles.

4.1. BRDF MODELS VERIFICATION

81

a) Image rendered in BRDFVis application via environmental mapping mode. b) Reference image in the original paper of the model. Figure 4.3: Comparison of isotropic Kurt-Kalos-Krivanek BRDF model with reference image.

Moreover, violation of physical plausibility of original Phong model was also conrmed in our application when incoming and outgoing direction of BRDF was switched. In that case, as a consequence of non-reciprocity of this model, dierent results of model visualization could be seen, especially for low values of shininess parameter (see Fig. 4.7).

Oren-Nayar Because of lack of reference images using Oren-Nayar BRDF across the available resources, model was veried theoretically. This means that it was tested against its theoretical base, using experimental analysis in BRDFVis application. Point light is placed right in front of the rendered sphere and behavior of the model with the increasing

σ parameter

with respect of amount of reected light is examined (see

Fig. 4.8). As can be seen, model behaves according to expectations - with the increasing

σ

param-

eter (standard deviation of the surface slope) it rises its retroreective ability and more light is reected at higher incident angles. Contrary, if surface slope stays zero, it behaves exactly like Lambertian surface.

Minnaert For Minnaert BRDF we deal with the same issue as with Oren-Nayar - lack of reference images.

Thus, same procedure of experimental analysis is applied to this model as well.

Point light is placed right in front of the rendered sphere and behavior of the model, based

CHAPTER 4. RESULTS

82

Environmental mapping on the sphere using anisotropic Kurt-Kalos-Krivanek BRDF model.

kd = [0.15, 0.15, 0.15], ks = [0.85, 0.85, 0.85], mx = 0.05, my = 0.1 . b) Reference image for a) from image for mx = 0.1, my = 0.05 . d) Reference image for

For all scenes, following parameters are used:

α = 0.2

a) Our rendered image for

the original paper. c) Our rendered c) from the original paper. Figure 4.4: images.

Comparison of anisotropic Kurt-Kalos-Krivanek BRDF model with reference

4.1. BRDF MODELS VERIFICATION

83

Figure 4.5: Reference image of comparison between original Phong and its normalized form.

Figure 4.6: Comparison of original Phong model with its physically plausible version (normalized form) in our implementation.

CHAPTER 4. RESULTS

84

Figure 4.7: Physical implausibility of original Phong BRDF model.

on the adjustment of limb darkening parameter

k,

with respect of amount of reected light

is examined (see Fig. 4.9). Experiments showed, that Minnaert BRDF model behaves according to its description. For

k = 1.0

it is Lambertian surface, with the increase of

k

above 1.0, amount of reected

light towards the horizon decreases and vice versa - decrease of

k

below the value 1.0 leads

to extra lightening towards the horizon.

Neumann Once again, usable reference images are missing in the available resources for this model. Thus the verication of the Neumann model was performed according to behavior of exponential BRDF described in the original paper [37]. In this case, reference images taken from this paper are illustrations of BRDF using exponential weight function, where shape of BRDF for various values of shininess (s) parameter and various incident angles (0,40,80) is situated. In this test, we tried to set parameters of the implemented model in a way, that its visualization for concrete shininess value will match with reference image for all three tested incident angles. Visualization was made using unit hemisphere. Results of experiments are shown in Figs. 4.10, 4.11 and 4.12 respectively . Results show, that behavior of the implemented Neumann BRDF according to its exponential base, is correct.

4.1. BRDF MODELS VERIFICATION

For all scenes

85

kd = [1.0, 1.0, 1.0]. a) Reference image with Lambertian surface, b) Orenσ = 0.0, c) Oren-Nayar BRDF with σ = 0.2, d) Oren-Nayar BRDF with

Nayar BRDF with

σ = 0.5. Figure 4.8: Oren-Nayar BRDF model experimental analysis.

CHAPTER 4. RESULTS

86

kd = [1.0, 1.0, 1.0]. a) Reference image with Lambertian surface, b) Minnaert k = 0.0, c) Minnaert BRDF with k = 1.5, d) Minnaert BRDF with k = 0.5.

For all scenes BRDF with

Figure 4.9: Minnaert BRDF model experimental analysis.

4.1. BRDF MODELS VERIFICATION

87

a) Reference image of exponential BRDF at 0,40 and 80 incident degrees. b) Visualization of implemented Neumann BRDF at 0 incident degrees.

c) Visualization of implemented

Neumann BRDF at 40 incident degrees. d) Visualization of implemented Neumann BRDF at 80 incident degrees. Figure 4.10: Neumann BRDF verication for s = 2.

CHAPTER 4. RESULTS

88

a) Reference image of exponential BRDF at 0,40 and 80 incident degrees. b) Visualization of implemented Neumann BRDF at 0 incident degrees.

c) Visualization of implemented

Neumann BRDF at 40 incident degrees. d) Visualization of implemented Neumann BRDF at 80 incident degrees. Figure 4.11: Neumann BRDF verication for s = 5.

4.1. BRDF MODELS VERIFICATION

89

a) Reference image of exponential BRDF at 0,40 and 80 incident degrees. b) Visualization of implemented Neumann BRDF at 0 incident degrees.

c) Visualization of implemented

Neumann BRDF at 40 incident degrees. d) Visualization of implemented Neumann BRDF at 80 incident degrees. Figure 4.12: Neumann BRDF verication for s = 20.

CHAPTER 4. RESULTS

90

Layered mixture This model cannot be correctly veried, because it is experimental model, implemented within this thesis and therefore any reference images do not exist.

At least, we provide

an example of its practical behavior. In this example, layered surface is constructed from two layers:

Oren-Nayar BRDF (kd

Dür BRDF (kd

= [0.976, 0.282, 0.282], σ = 0.5) and isotropic Ward= [0.220, 0.808, 0.290], ks = [0.031, 0.192, 0.078], slope = 0.2). Thickness of

top layer was set to 1.0, while wavelength-dependent absorption coecient was chosen as [0.3,0.3,0.3]. Results of rendered images, where both BRDFs was used in the scene independently and then together with various layers ordering, can be seen in Fig. 4.13. Visualization of both BRDFs separately and arbitrary layered is shown in Fig. 4.14. Rendered images show, that top layer of the layered mixture attenuates layer below it. In both ordering (c,d), both BRDFs forming the whole surface participate in the nal appearance.

According to our BRDF settings, visualization shows, that top layer of the

layered mixture has higher inuence on the nal appearance (nal BRDF shape is driven especially by the top layer).

4.1. BRDF MODELS VERIFICATION

91

a) Rendered scene using Oren-Nayar BRDF . b) Rendered scene using isotropic Ward-Dür BRDF. c) Rendered scene using layered mixture BRDF - Ward-Dür as a top layer. Rendered scene using layered mixture BRDF - Oren-Nayar as a top layer. Figure 4.13: Example of usage of layered mixture BRDF.

d)

CHAPTER 4. RESULTS

92

a) Visualization of Oren-Nayar BRDF. b) Visualization of Ward-Dür BRDF. c) Visualization of layered mixture BRDF - Ward-Dür as top layer. d) Visualization of layered mixture BRDF - Oren-Nayar as top layer. Figure 4.14:

Visualization of layered mixture BRDF.

4.2. BRDF PERFORMANCE MEASUREMENT

93

4.2 BRDF performance measurement Methodology of testing Methodology of testing was specied by following set of rules:



One test = 5 000 000 evaluations of each of the four BRDF core methods (see BRDFLib chapter, section 1).



For each 10 evaluations, random correct inputs to the particular method were generated.



Particular result = execution time computed for 1 000 000 evaluations of the concrete method (random inputs generation is not included in the measurement, only the evaluation of the method itself ).



Final result = execution time obtained as median from 11 particular results (test was performed 11 times per BRDF).

For all the measurements default BRDF parameters of the particular tested BRDF were used (hard-coded defaults in BRDFLib for each particular parameter). Except of shininess of Phong-based BRDF models, that was set set to 100. For all multi-slope and/or multi-lobes BRDFs, only one lobe/slope was used. All the measurements were performed through Performance tester feature in BRDFVis. Conguration of the testing machine is shown in Table 4.1

Results of measurement Results of the measurement are shown in Table 4.2. Note, that albedo and max albedo evaluation results are rather incomparable to each other, because the computationally cheap method, how to evaluate included integrals analytically is known only for the Phong models and some models in the simple ideal group.

In others, some easy-to-calculate rough ap-

proximation is returned as a value at the cost of inaccurate results. As for rays spawning test, SpawnStochasticRays() method was used for evaluation, but note, that in some implementations deterministic rays are actually spawned through this method (these who have not deterministic scattering, like ideal reector, etc.). BSDF evaluation and rays spawning results are shown in graphs in Fig. 4.15 or Fig. 4.16 respectively. Most of the results for BSDF evaluation and Rays spawning corresponds to their assumptions, especially the performance of Kurt-Kalos-Krivanek model, which excels in the eective stochastic rays spawning, as authors proposed in the original paper. Dierence between performance of anisotropic and isotropic implementations of the Ward-based models is quite noticeable, especially in BSDF evaluation method. On the other hand, Cook-Torrance BRDF model surprised with its unexpected stochastic rays spawning performance comparable to mentioned in Kurt-Kalos-Krivanek. Phong model conrmed its cheap BRDF evaluation, although Lafortune model with one specular lobe (which should be similar to Phong) is more expensive in both BSDF evaluation and stochastic rays spawning.

As can be clearly seen in proposed graphs of

CHAPTER 4. RESULTS

94

Processor Clock frequency RAM Cache

Intel Core 2 Duo 2

2.66 GHz

4096 MB 2 2

OS OS type IDE Compilator Command line options

×

1

× × ×

L1 D-Cache 32 KB L1 I-Cache 32 KB L2 Cache 3072 KB

MS Windows 7 32-bit MS Visual Studio 2010 Visual C++

/I"C:\boost_1_44" /I".\obj" /I".\GL" /I"..\..\..\BRDFLib\BRDFLib" /I".\GeneratedFiles" /I"C:\Qt\4.7.0\include" /I".\GeneratedFiles\Release" /I"C:\Qt\4.7.0\include\qtmain" /I"C:\Qt\4.7.0\include\QtCore" /I"C:\Qt\4.7.0\include\QtGui" /I"C:\Qt\4.7.0\include\QtOpenGL" /I".\" /I"C:\Qt\4.7.0\include\QtWebKit" /nologo /W1 /WX- /O2 /Oy- /GL /D "UNICODE" /D "WIN32" /D "QT_LARGEFILE_SUPPORT" /D "QT_NO_DEBUG" /D "NDEBUG" /D "QT_CORE_LIB" /D "QT_GUI_LIB" /D "QT_OPENGL_LIB" /D "QT_WEBKIT_LIB" /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t/Zc:forScope /Fp"Release\BRDFVis.pch" /Fa"Release\" /Fo"Release\" /Fd"Release\vc100.pdb" /Gd /analyze- /errorReport:queue Table 4.1: Test machine conguration

results, performance of implemented Schlick's model is, similarly to Lafortune one, rather inecient as well. Note, that in principle, models can not be compared to each other just on the basis of this execution time measurement, because this is only one of many aspects of BRDF model eciency.

4.3 Application usability BRDFVis application is intended to be used especially for BRDF models testing. Existing deployed models can be tested both theoretically in the visualization modes and practically in rendering modes.

Moreover, their computational eciency can be examined through

integrated Performance tester very easily.

In this moment, there is no database driven

BRDF model deployed in BRDFLib, therefore BRDF tting can be performed only in a form of comparison with the existing image of already tted model. BRDFVis is strong in BRDF models comparison through its double-view UI design. Moreover, because of continuous feedback, application was adjusted to the concrete user's needs during implementation and therefore we consider its UI as very user friendly. Hence it serves as a comprehensive tool for BRDF testing/investigation. In the comparison with concurrent BRDFLab ([11]) project, from our point of view BRDFVis application is more user-friendly and oers more testing tools and modes, that its user can miss in BRDFLab. Moreover, in contrast with BRDFLab, our application preserves its platform independence.

4.3. APPLICATION USABILITY

BRDF model Ashikhmin-Shirley, 2000 Beard-Maxwell, 2002 Blinn-Phong, 1994 Cook-Torrance, 1981 Ideal dielectric Ideal diuse refractor Ideal metal Ideal mirror reector Ideal refractor Kelemen-Kalos, 2001 Kurt-Kalos-Krivanek anisotropic, 2010 Kurt-Kalos-Krivanek isotropic, 2010

Lafortune, 1997 Lambertian, 1760 Minnaert, 1941 Moroder-Dür anisotropic, 2010 Moroder-Dür isotropic, 2010 Neumann, 1999 Neumann-Neumann-Kalos, 1999 Oren-Nayar, 1994 Phong, 1975 Phong grazing mirror Phong physical, 1994 Phong physical DR Shirley-Hu-Smits-Lafortune, 1997 Schlick, 1994 Specular reector Ward anisotropic, 1992 Ward isotropic, 1992 Ward-Dür anisotropic, 2006 Ward-Dür isotropic, 2006

- : cannot be evaluated

95

BSDF evaluation [s]

Rays spawning [s]

0.671 1.015 0.425 0.999 0.106 0.228 1.104 0.983 1.174 0.132 0.300 0.524 0.331 0.645 0.362 0.152 0.340 0.332 0.321 0.130 0.932 1.139 0.355 0.533 0.334 0.481 0.324

3.526 4.444 3.608 1.626 1.390 0.597 0.705 0.369 0.452 3.502 1.679 1.561 4.191 0.592 0.658 3.700 3.438 1.354 3.591 0.617 3.332 3.176 3.549 3.029 1.628 4.415 0.905 3.639 3.441 3.714 3.552

test

Albedo evaluation [s]

Max albedo eval. [s]

0.698 0.128 0.733 0.171 0.124 0.088 0.374 0.065 0.061 0.284 0.165 0.165 1.371 0.075 0.077 0.109 0.105 0.176 0.728 0.087 0.698 0.111 0.786 0.109 4.174 0.100 0.726 0.099 0.100 0.098 0.098

0.105 0.124 0.113 0.159 0.124 0.084 0.121 0.065 0.061 0.103 0.162 0.162 0.975 0.075 0.077 0.109 0.103 0.124 0.115 0.087 0.099 0.111 0.102 0.109 0.159 0.100 0.084 0.099 0.100 0.098 0.098

Table 4.2: BRDFs performance tests results.

CHAPTER 4. RESULTS

96

Figure 4.15: Execution times for 1 000 000 evaluations of BSDF.

Figure 4.16: Execution times for 1 000 000 evaluation of method for stochastic rays spawning.

On the other hand, it lacks real-time rendering performance and BRDF models tting feature, although the second one is on the future work list. Both BRDFLib library and BRDFVis application are prepared for the usage of texturing, therefore a deployment of bidirectional texture functions (BTFs) is expected soon as well. Adjustment of the behavior of the application through conguration les of various purposes is also signicant advantage and useful feature, usually appreciated by many users of any software.

4.4. APPLICATION TESTING

97

Since the stability of the application has been improved many times during its development and testing, current release is quite freeze/crash durable. Nevertheless, some crashes still occasionally happens, therefore it must be still massively user-tested to discover all the remaining nested bugs.

Application was checked several times by memory leak detector,

thus should not contain any of them (memory leaks). Performance of the UI itself is satisfactory, there were no problems with long response in any place during the testing, except the Performance tester feature, where all the performance of the machine is intentionally concentrated into the tests execution, which causes temporary UI freeze. Moreover, user can adjust the performance of the application through particular suitable settings. As for memory consumption of the application, it depends especially on amount of loaded scenes and/or environment maps.

4.4 Application testing Application was continuously tested during its development. Besides the concrete part being currently developed, that was veried immediately after its completion, following set of manual tests in the form of validation were performed once a month :



Editing, resetting, importing, and exporting of settings les.



Export of rendered image to a les of various formats, including HDR one.



BRDF widget tests.

  

Creation of the BRDF widget, with random BRDF model. Deep copy of the chosen BRDF widget. Shallow copy (referencing) of the chosen BRDF widget.



Validation of correct UI connection between models through manipulation with random BRDF parameters of various types.

∗ ∗

 •

Validation of correct dereferencing of the model. Connected model focusing.

BRDF parameters minimalizing.

Rendering tests.

 

Manipulation with the rendered object in the point light mode. Testing of double buering and tone mapping within environmental mapping mode.



Path tracing.

∗ ∗ ∗ •

Quality of rendered image for 300 samples per pixel and recursion depth 3. Rendered object resizing/moving within Cornell box. Performance of the rendering.

Stress tests.

CHAPTER 4. RESULTS

98

  

BRDF widget closing during rendering. Simultaneous path tracing in both views. Fast changes of various settings and BRDF parameters during rendering.



Switching between single/double view of the application.



Adding of the slope/lobe in the BRDF models, where it is supported.



Log enabling/disabling.



Error summary checking.



Workspace reset.



Cornell box editing and refreshing.



BRDF help and original paper accessibility.

Chapter 5

Conclusion and future work In this work, reectance models library (BRDFLib) was enriched by eight new BRDF models - Kurt-Kalos-Krivanek(2010), Minnaert(1941), Moroder-Dür(2010), Neumann(1999), OrenNayar(1994), original Phong(1975), Ward-Dür(2006) and Layer mixture(own).

Moreover,

library has been adjusted and prepared for easy usage by GUI-based application through the universal system of parameters handling. As the second part of this work, Qt-based, cross-platform application (BRDFVis) was designed and implemented to deploy mentioned library in the purpose of BRDF models verication and validation. Application is intended to use for complex BSDF models testing, therefore it oers a rich environment with various testing modes, including path tracer for rendering.

Newly implemented BRDF models were veried in this application both

quantitatively (computational eciency) and qualitatively (rendering results) and testing results were summarized in the form of graphs and images. Based on these results, most of the implemented models fulll its expectations, described in the original papers. Application meets all the initial requirements dealing with its design and versatile usability, thus it serves as an comprehensive tool for BRDF models investigation and can be easily extended by additional features. Thanks to the approach of versatility used in both BRDFLib and BRDFVis, deployment of the new BRDF model is very easy as well.

5.1 Future work Both library and application are prepared for texturing, hence usage of BTF models is planned as one of the next steps in the future. As was mentioned before, BRDFVis library contains many useful tools for BRDF testing, but it still lacks of real-time rendering performance. Preserving its platform-independence, Open Computing Library (OpenCL) could be used in the future as computations accelerator. As a completion of application's testing framework, data-driven BRDF models and corresponding tting tools in the application could be considered as a good subject of future work as well. As for additional BRDF models, most of the well-known ones are already implemented in the library, but there are still those, which miss and could be added.

From the newer

ones, we can mention Ashikhmin-Premoze [43]. Application's UI is prepared for arbitrary

99

CHAPTER 5. CONCLUSION AND FUTURE WORK

100

layered BRDF models, therefore e.g. Weidlich-Wilkie [55] model is also suitable choice for one of the next BRDF implementations. However, note, that for realistic image synthesis, BRDF models are in most cases still not sucient and more complex phenomena, like BTF, should be modeled for realistic feel of the resulting image.

Bibliography [1] ASHIKHMIN, M.  SHIRLEY, P. An anisotropic phong light reection model.

of Graphics Tools.

Journal

Accessible from: . [2] BECKMANN, P.  SPIZZICHINO, A.

rough surfaces.

[3] BLINN, J. F.

The scattering of electromagnetic waves from

Pergamon Press, 1963. Models of light reection for computer synthesized pictures.

SIGGRAPH Computer Graphics.

1977, 11, 2, p. 192198.

Accessible from:

//portal.acm.org/citation.cfm?id=563858.563893>. [4] COHEN, M.  WALLACE, J.

Radiosity and Realistic Image Synthesis.

ACM

.

Accessible from: . [9] DUTRE, P.

Global Illumination Compendium.

2003.

ACM

Journal of Graph-

.

.

.

The Astro-

.

Accessible from: .

.

. [47] SCHWENK, K.

Computer

Computer Graphics Forum.

.

1999, 33, Annual Confer-

.

1967,

57,

9,