0% found this document useful (0 votes)
30 views54 pages

05+ +surfaces

Uploaded by

Benoni Tang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views54 pages

05+ +surfaces

Uploaded by

Benoni Tang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Surfaces

Christoph Garth
Scientific Visualization Lab
Motivation and Overview
In the previous chapter, we considered the rendering equation as the basis for PBR1 :
Z
Lo (x, ω) = Le (x, ω) + f (x, ω, ωi ) Li (x, ωi ) cos θi dωi

outgoing emitted BRDF incident incident


radiance radiance radiance direction

Remember:
• We identified radiance is the correct physically quantity to model a “light field”; giving a
directional flux density at each point surface x.

• Li and Lo are coupled by rays between points that can see each other (vacuum assumption).
This turns the 5-dimensional rendering equation into a four-dimensional problem.

This chapter: BRDFs for modeling surface appearance and materials.


1
physically-based rendering
Computer Graphics – Surfaces– Motivation and Overview 5–1
Much of Computer Graphics considers object boundaries, so two-dimensional
surfaces in three-dimensional space.

Neglecting participating media, light intensity and direction are only modified at
such boundaries; this allows for phenomena such as reflection, refraction, and
absorption.

In the following, we will consider some typical surface interactions of light,


leading to a first heuristic surface illumination model.

Computer Graphics – Surfaces– Motivation and Overview 5–2


Geometric Optics: Perfect Reflection

• incident ray, reflected ray and surface normal lie in the same plane
• incident angle to normal θi = reflected angle to normal θr

N
ωr
ωi ωr
θi θr ωi

Computer Graphics – Surfaces– Motivation and Overview 5–3


Geometric Optics: Refraction

normal
The index or refraction (IOR) describes how fast light travels
in a material: θ1
c ωi
n=
v
where v is the speed of light in the material and c is the interface n1 v1
speed of light in vacuum. For example, n2 v2

nair ≈ 1.0, nwater ≈ 1.333, nglass ≈ 1.5, ndiamond ≈ 2.4

θ2
Snell’s Law: if n1 , n2 are the refraction indices of two media, ωo
a light ray is refracted at the transition such that

n1 sin θ1 = n2 sin θ2

Computer Graphics – Surfaces– Motivation and Overview 5–4


Geometric Optics: Refraction (cont’d.)

When light transitions a material interface to a lower index of refraction, some it is


reflected. If the angle of incidence is greater than the critical angle,

n1
 
θcrit = arcsin
n2

total internal reflection occurs: all of the light is reflected.

n2 θ2
90 o
total reflection

θcrit
n1 θ1

Computer Graphics – Surfaces– Motivation and Overview 5–5


Two Types of Reflection

Diffuse reflection [refraction] occurs in the case of rough


surfaces; the incoming light is distributed in nearly all
directions. (It is, so to speak, diffused.)

diffuse
Specular reflection [refraction] denotes the case when
incoming light is reflected into (mostly) a single direction.

Perfect specular is often understood as mirror reflection, rough


specular distributes light around the direction of mirror
reflection.

Glossy reflection is often used to denote rough specular


specular / glossy
reflection (in graphics).

Computer Graphics – Surfaces– Motivation and Overview 5–6


Illustration: Types of Reflection

Computer Graphics – Surfaces– Motivation and Overview 5–7


Notes:

• Even for diffuse and rough specular reflection, the law of reflection still holds;
however, the surface is not flat, but “rough”, and so photons hitting at slightly
different positions are reflected into completely different directions.

from https://google.github.io/filament/Filament.html

• A single photon can of course not be reflected into multiple directions at once.
Macroscopically, we can interpret a BRDF as a probabilty density function that gives
the probability that a single photon is reflected into a particular direction, and
describes the surface microstructure statistically.

Computer Graphics – Surfaces– Motivation and Overview 5–8


Diffuse Reflection and Lambertian BRDF
Diffuse Reflection

A Lambertian surface distributes/reflects incident radiance equally in all


directions.
kd
Z
Lr (x, ωr ) = Li (x, ωi ) cos θi dωi
Ω π

In other words: the Lambertian / diffuse BRDF is constant, f (ωi , ωr ) = kπd , where kd
is a material constant that describes the total fraction of reflected light.

Normalization: Since
kd k kd
Z Z
cos θi dωi = d cos θi dωi = · π,
Ω+ π π Ω+ π

the BRDF fulfills Helmholtz reciprocity and conservation of energy, if 0 ≤ kd ≤ 1.

Computer Graphics – Surfaces– Diffuse Reflection and Lambertian BRDF 5–9


Illustration: Diffuse (Lambertian) reflection of a “rough” or “matte” material

Some Lambertian materials: unfinished wood, fresh snow, Spectralon2

2
highest diffuse reflectance of any known material
Computer Graphics – Surfaces– Diffuse Reflection and Lambertian BRDF 5–10
How can we visualize BRDFs to understand them better?

Polar plot visualization:

• fix a direction of incident light ωi :


• choose radius r = fr (ωi , ωr ) for all directions ωr ,
i.e. for all angles θr between normal N
and ωi and all angles φr around N (in 3D).

ωi N ωi N

Computer Graphics – Surfaces– Diffuse Reflection and Lambertian BRDF 5–11


Specular Reflection and Local Lighting Models
Specular or Glossy Reflection

Simulation of “shiny” or “glossy” materials.

• Intensity is propagated predominantly in direction of mirror reflection R

ωi N
R

• Perfect specular reflection ' mirror reflection.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–12
How can we model specular reflection in terms of a BRDF?

Let’s take a short history detour to approach this from a simpler perspective.

Long before global illumination was computationally feasible, so-called local


lighting models were considered:

• Consider a surface point illuminated by a single point light. Light arrives from
a single direction L, and the incoming intensity is distributed.
• Let’s further limit to direct illumination: the intensity at the sensor is the
intensity reflected into the sensor direction V (“viewer”).

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–13
Phong Reflection Model (Bui Tuong Phong, 1975)

Consider a surface point illuminated by a point light in direction L (normalized).

Heuristical specular reflection model:


• Maximum reflection is achieved when N
the viewer aligns with the direction of
V
mirror reflection R (i.e. if V = R).
θr
L θi R
• Reflection is reduced as the angle α α
between V and R increases.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–14
Phong Reflection Model (Bui Tuong Phong, 1975)

Phong’s idea: reduce reflected intensity with cosn α = hV, Rin , giving

Ir (x, V) = ks · hV, Rin · Ii (x, L).

Here, N
• ks ∈ [0, 1] (“amount of reflection”) and
V
• n > 1 (specular exponent) θr
L θi α R
are material constants that can be used to
influence the appearance of the material.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–15
Illustration: Polar plot of Phong reflected relative intensity (n = 30)

L
R
L R

This characteristic shape of the reflection is often called specular lobe.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–16
Illustration: Specular highlights become “sharper” as n grows (perfect mirror for n → ∞).

0.8

0.6

0.4

0.2

−π/2 −π/4 0 π/4 π/2

n = 1, 10, 100, 500

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–17
How to calculate the reflection vector R for light vector L (= ωi )?
(Without using trigonometric functions, that is.)

If N and L are unit vectors, we can


L hN, LiN
use the simple formula

R = 2hN, LiN − L

−L

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–18
Blinn-Phong Reflection (Jim Blinn 1977)

Modification of Phong’s model with (slightly) improved physical interpretation


and less computational overhead.

Idea: Instead of computing the reflection


vector R, consider the vector H bisecting the
angle between V and L. H N
V
• Maximum reflection for V = R ⇔ N = H.
β
• Reduce reflection as the angle β between L
N and H increases.
• H is easily calculated as (V + L)/||V + L||.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–19
Blinn-Phong Lighting Model (Jim Blinn 1977)

This yields, again with material parameters ks and n0 ,

Ir (x, V) = ks · Ii (x, L) · (H · N)n = ks · Ii (x, L) · cosn β


0 0

1 5 10 25 50 100 250 500 1000


Phong
Blinn-Phong

4 20 40 100 200 400 1000 2000 4000

For n0 ≈ 4n, Blinn-Phong and Phong give similar highlights except near grazing angles.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–20
Phong Lighting Model

Observing that most materials have both diffuse and specular reflection, Phong
formulated a local lighting model to allow the simulation of diverse materials.

In addition to Lambertian diffuse reflection and Phong specular reflection, this


model introduces an ambient (constant) term to simulate (uhm, fake, really)
global illumination:

• isotropically incident light, constant throughout the scene


• indirect reflection from other objects
• not realistic (and definitely not physically motivated)
• originally motivated by avoiding too dark regions

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–21
The resulting combination of diffuse, specular and ambient reflection,

Ir (x, V) = kd · Ii (x, L) · hN, Li


+ ks · Ii (x, L) · hV, Rin
+ ka

allows approximating a large variety of materials.

N
L

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–22
Illustration: Contributions in the Phong Lighting Model

ambient diffuse specular Phong

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–23
Illustration: Contributions in the Phong Lighting Model

L L

ambient, diffuse, specular total

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–24
Notes:

• Thus far, we did not consider colors in the lightling models and measures like
I, L, etc; in principle, we would have to write all terms with a wavelength
dependence, e.g. L(. . . , λ . . . ), ks (λ), etc.
• For most practical purposes, wavelength-dependent effects can be
neglegted, and we can fall back to representing colors in the RGB model:
• color coefficients Cd , Cs , Ca
• Cd = (diffuse) surface color
• Cs = color of specular reflection
• Similarly, the color of light sources is specified as an RGB triple.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–25
Why is specular color Cs given separately from diffuse color Cd ?

Simplified answer:

• For dielectric materials (electrically non-conductive) such as glass, plastic, wood,


etc., incoming wavelengths are equally specularly reflected; Cs is white.
• Most metals reflect strongly specularly, but absorb some wavelength while doing so.
Hence, Cs is the metal’s color.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–26
Pseudocode (GLSL, multiple point lights)

vec3 phong( Object object, vec3 x, vec3 normal, vec3 eye )


{
vec3 result = vec3(0,0,0);

for( int i=0; i<numLights; ++i )


{
vec3 L = normalize(light[i].pos - x);

float kd = dot(N, L);


if( kd > 0.0 )
{
vec3 r = reflect(L, N), V = normalize(x - eye);
float ks = pow( max(dot(R, V), 0.0), obj.n );
result += kd*obj.Cd*light[i].color + ks*obj.Cs*light[i].color;
}
}

return result + globalAmbientLight * obj.Cd;


}

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–27
The Phong and Blinn-Phong lighting model are often perceived to look “plasticky”.
Material nuances cannot or can only be badly represented. On the upside, the
model can be evaluated fast.

In the following, we’ll briefly consider the


Cook-Torrance model (1982). It is based on the
observation that a surface’s reflection depends on
modeling microfacets. The microfacets are not
considered individually, but their effects are
modeled statistically.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–28
Cook-Torrance Model (roughly)

Ir = Ii · hN, Li · (ks · Rs + kd )
D·F·G
Rs =
hN, VihN, Li

The specular reflection is computed through three terms D, F, and G; each model
different characteristics of microfacets.

Lambertian reflection is typically used (as above) for the diffuse component.

While not going into detail, the role of the terms in describing the microfacets is
roughly as follows.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–29
D – Microfacet Distribution

Statistical description of microfacet orientation (normal distribution function, NDF).


Several variants are commonly used: Gaussian, Beckmann, GGX distributions.

Illustration: GGX distribution with roughness parameter α ∈ [0, 1]

from codinglabs.com

Lower roughness gives sharper highlights.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–30
G - Geometry Term

Describes attenuation of light due to mutual shadowing of microfacets (again,


statistically) – probability that at a given point the microfacets are occluded or receive
only indirect light.

Depends on the distribution of microfacet orientations used for D.

Illustration: Geometry Term with GGX distribution (again using roughness α ∈ [0, 1])

from codinglabs.com

Specular reflections are dulled with increasing roughness.

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–31
F – Fresnel term

The Fresnel effect (physics) determines the part of incident light that is reflected vs.
transmitted.

It depends on the refraction index of the medium and the incident angle, and increases
specular reflection at grazing angles for most materials.

from scratchapixel.com

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–32
Illustration:
Fresnel effect

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–33
Illustration: Effect of Fresnel Term

The Fresnel effect is largely responsible for the realistic look of the right sphere (with
Fresnel). The left sphere (without Fresnel) looks somewhat metallic.

Computing the Fresnel term is difficult – often the Schlick approximation is used.
Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–34
Illustration: Terms in the Cook-Torrance model

Computer Graphics – Surfaces– Specular Reflection and Local Lighting Models 5–35
Lighting Models and BRDFs
From Local Lighting Models to BRDFs

Thus far, we have formulated local lighting models – how can we get back to BRDFs? In
principle, not much is needed. Let’s briefly consider the Phong reflection model and see
how to turn it into a BRDF3 .

Remember: BRDFs appear in the rendering equation with a factor of cos θi , so directly
writing turning the specular formula into a BRDF, we divide by cos θi to obtain

cosn α
Ir (ωi ) = ks cosn α ⇒ fPhong (ωr , ωi ) = ks
cos θi

The total reflectance is obtained by integrating over ωr :

ks
Z
RPhong (ωi ) = cosn α cos θr dωr
cos θi Ω+

3
following derivation not relevant for exam
Computer Graphics – Surfaces– Lighting Models and BRDFs 5–36
For grazing angles (θi → π/2), cos θi → 0 and the reflectance approaches infinity! The
surface would be too bright or “glow”.

We can improve this by adding back in the cos θi factor the original model, giving the BRDF

fPhong (ωr , ωi ) = ks cosn α (equivalent to Ir (ωi ) = ks hV, Rin hN, Li)

A little thinking reveals that the reflectance becomes maximal when angle of incidence θi
is 0, i.e. when the ωi = N. Evaluate this as

RPhong (0) = max RPhong (ωi ) = ks
ωi n+2

and obtain the final (normalized) Phong BRDF


n+2
fPhong (ωr , ωi ) = · ks · cosn α

Computer Graphics – Surfaces– Lighting Models and BRDFs 5–37


n+2
fPhong (ωr , ωi ) = · ks · cosn α
2π 8

Observe:
6

• fPhong is now normalized, since the maximum 5

directional reflectance is 1, hence, energy is 4


conserved.
3

• fPhong is now Helmholtz-reciprocal. 2

• We have a clean interpretation of the 1

constant ks as the maximal directional


reflectance, RPhong (0). −π/2 −π/4 0 π/4 π/2

n = 1, 5, 10, 50

Computer Graphics – Surfaces– Lighting Models and BRDFs 5–38


This physically more correct BRDF can of course be converted back into a physically more
correct local lighting model, the normalized or modified Phong lighting model,

kd
Ir (x, V) = · I (x, L) · hN, Li
π i
n+2
+ ks · Ii (x, L) · hV, Rin hN, Li,

which is often encountered in physically-based realtime rendering.

One can easily check that this combined BRDF is energy-conservative if kd + ks ≤ 1.

Similar derivation yields the normalized/modified Blinn-Phong model (approximately):

kd
Ir (x, V) = · I (x, L) · hN, Li
π i
n +8
0
ks · Ii (x, L) · hN, Hin hN, Li
0
+

Computer Graphics – Surfaces– Lighting Models and BRDFs 5–39


Further BRDFs:

• Oren-Nayar
• better approximation of diffuse reflection than Lambertian on many materials
• Ward Anisotropic
• surfaces with anisotropic structure, e.g. brushed metal, hair
• Disney BRDF – “universal” BRDF with few parameters
• also Blender’s Principled BSDF)
• specialized models for metals
• models for dielectrics, e.g. glass, certain fluids
• and many more

Computer Graphics – Surfaces– Lighting Models and BRDFs 5–40


Illustration:
Disney BRDF

https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf

Computer Graphics – Surfaces– Lighting Models and BRDFs 5–41


Illustration: Isotropic vs. Anisotropic BRDF

from pbr-book.org

Computer Graphics – Surfaces– Lighting Models and BRDFs 5–42


Illustration: Specialized Metal BRDF

from pbr-book.org

Computer Graphics – Surfaces– Lighting Models and BRDFs 5–43


Illustration: Specialized BRDFs for Glasses and Liquids

from wikipedia.org

Computer Graphics – Surfaces– Lighting Models and BRDFs 5–44


Beyond Reflection
BRDFs are just one form of a class of functions that describe the behavior of light
at media boundaries.

Some further forms are:


• The BSDF (bidirectional scattering distribution BSSRDF
function) is the most general form for local
interactions.
• The BSSRDF (bidirectional scattering-surface
reflectance distribution function) describes the
(non-local) relation between outgoing radiance
and the incident flux, including phenomena like
subsurface scattering (SSS). Thereby, it models
non-local effects.

Computer Graphics – Surfaces– Beyond Reflection 5–45


BSDF = BRDF + BTDF

• The BRDF (bidirectional reflectance


distribution function) describes the
distribution of reflected light; it can be
seen as a simplified BSSRDF, assuming
that light enters and leaves at the same
point.

• The BTDF (bidirectional transmittance


distribution function) describes the
distribution of transmitted light.

• If transmission is also considered, energy


conservation and reciprocity apply to the
BSDF as a whole.

Computer Graphics – Surfaces– Beyond Reflection 5–46


Outlook
Our goal for this part of the course is a tangible rendering algorithm that
produces fairly photo-realistic images, and that we can implement.

What we know at this point:

• the behavior of light in scene (rendering equation)


• light interaction with surfaces (lighting models and BRDFs)
e.g. Phong model

What is missing:

• Which rays are suitable for the computation of light transport?

Answering this question will give us our first rendering algorithm, Ray Tracing.

Computer Graphics – Surfaces– Outlook 5–47

You might also like