π± π, πβ² = π(π, πβ²) π π, πβ² +
π»
π π, πβ², πβ²β² π± πβ², πβ²β² ππβ²β²
INFOMAGR β Advanced Graphics
Jacco Bikker - November 2016 - February 2017
Lecture 13 - BRDFs Welcome! , = (, ) , - - PowerPoint PPT Presentation
INFOMAGR Advanced Graphics Jacco Bikker - November 2016 - February 2017 Lecture 13 - BRDFs Welcome! , = (, ) , + , , ,
π± π, πβ² = π(π, πβ²) π π, πβ² +
π»
π π, πβ², πβ²β² π± πβ², πβ²β² ππβ²β²
Jacco Bikker - November 2016 - February 2017
Advanced Graphics β BRDFs 3
BRDFs, Recap
Recall that a BRDF defines the relation between incoming and outgoing radiance for directions and a surface point: π
π π¦, ππ, ππ =
πππ(π¦, ππ) ππ π¦, ππ cos πππππ
π
ππ ππ
π¦ π π What about materials that are not purely specular, nor diffuse?
Advanced Graphics β BRDFs 4
BRDFs, Recap
We already know how to do materials that are diffuse and shiny. But that gets us good looking marble floors, not glossy reflections.
50% diffuse, 50% specular, 50% diffuse, 50% glossy (or: 100% glossy)
Advanced Graphics β BRDFs 5
Glossy Reflection
Glossy reflections: sending out rays in random directions close to the reflected vector.
Simple solution: π = π ππππππ’(πΉ, π); π = π½ + π + π‘ππππ(π ππππππππππ’π½πππβππ π(), π‘ππππ£πππ ππ’π§) π = πππ πππππ¨π(π β π½); Or: π = π ππππππ’(πΉ, π); π = π½ + π + π‘ππππ(π ππππππΈππ πππ’ππππ½ππΌππππ‘πβππ ππ·ππ‘πππππππβπ’ππ(π), π‘ππππ£πππ ππ’π§) π = πππ πππππ¨π(π β π½);
Advanced Graphics β BRDFs 6
Glossy Reflection
In OpenGL, shading is defined as follows*: π½π¦ = ππππππππ’ππππππππ’ +
πβπππβπ’π‘
ππππππ£π‘π π β ππ + ππ‘ππππ£πππ ππ β π
ππ¦ππππππ’
π½π
*: Bui-Tuong Phong, Illumination for Computer Generated Images, 1975.
ππ ππ π
π¦ where
material properties (typically: rgb);
normal π;
π
π»
cos π = π
π»
πππ‘ππ¦ππ =?
Advanced Graphics β BRDFs 7
Blinn-Phong BRDF (images: Disney BRDF Explorer)
Advanced Graphics β BRDFs 8
Modified Phong BRDF
Advanced Graphics β BRDFs 9
Fixing Phong
Recall the requirements for a proper BRDF:
π ππ, ππ β₯ 0
π ππ, ππ = π π ππ, ππ
π» π π ππ, ππ cosππ πππ β€ 1
BRDFs obeying these rules are called physically plausible. For a path tracer, we have additional requirements:
(for MIS).
The BRDF relates irradiance to
measured per unit area; the reflected energy cannot exceed 1 per unit area, hence the cos: we essentially convert outgoing radiance into irradiance as well. Alternatively, this also follows from the Helmholtz reciprocity principle: we can exchange ππ and ππ.
Advanced Graphics β BRDFs 10
Fixing Phong
Sampling proportional to π β π, according to the G.I.C. : π¦ = cos 2ππ
1
1 β π 2 π§ = sin 2ππ
1
1 β π 2 π¨ = π 2
π β π 1 π β π 2 π β π 10 π β π 50
Sampling proportional to π β π π½, according to the G.I.C. : π’ = π
2
2 π½+1, π¦ = cos 2ππ
1
1 β π’ π§ = sin 2ππ
1
1 β π’ π¨ = π’
π¨ π¦ π§
Advanced Graphics β BRDFs 11
Tangent / Local Space
Setting up a local coordinate system in 2D:
π = π π = βπ. π§ π. π¦ Setting up a local coordinate system in 3D: π = π π = πππ πππππ¨π(π Γ π) πΆ = π Γ π where π is a random unit vector; π β π.
π¨ π¦ π§
Good choice for π: π = (0,1,0) if abs(ππ¦) > 0.99; π = 1,0,0 otherwise.
πΆ πΌ πͺ
Advanced Graphics β BRDFs 12
Tangent / Local Space
Converting a vector from world space to local space: π
π¦
π
π§
π
π¨
= π β π π β πΆ π β π Local space to world space: ππ₯ππ ππ = π Γ ππππππ = π
π¦π + π π§πΆ + π π¨π
πΆ πΌ πͺ
Advanced Graphics β BRDFs 13
Normalizing the Lobe
A material cannot reflect more energy than it receives: ο¨ We thus scale the BRDF by the inverse of its integral over the hemisphere. For the Lambertian BRDF: π‘ππππ =
1 π (because cos π integrates to π)
For the cosine lobe, the scale is
π½+1 2π (*). However, there is a problem:
*: Physically Based Rendering, page 969; also see: http://www.farbrausch.de/~fg/stuff/phong.pdf
π π π
Advanced Graphics β BRDFs 14
The Modified Phong BRDF
The Phong BRDF has problems:
intersects the surface. Compensating for the intersection: Modified Phong BRDF. π
π π¦, ππ, ππ = ππ
1 π + ππ‘ π½ + 2 2π πππ‘π½π where π is the angle between the view vector and the reflected light vector. For ππ + ππ‘ < 1, this guarantees energy preservation*.
*: Lafortune & Willems, Using the Modified Phong Reflectance Model for Physically Based Rendering, 1994.
π
π π¦, ππ, ππ = ππ 1 π + ππ‘ π½+2 2π πππ‘π½π :
Total hemispherical reflection (note: integrating over
π π¦, ππ =
Ξ©
π
π π¦, ππ, ππ cos ΞΈππππ
=
Ξ©
(ππ 1 π + ππ‘ π½ + 2 2π πππ‘π½π) cos ΞΈππππ = ππ + ππ‘ π½ + 2 2π
Ξ©
πππ‘π½π cos ΞΈππππ The last integral is maximal when the incoming light arrives along the normal; in this case π = ππ, and the integral is 2π/ (π + 2). Therefore, in this case: π π¦, ππ = ππ + ππ‘ and conservation of energy is guaranteed iff: ππ + π_π‘ β€ 1.
Advanced Graphics β BRDFs 15
The Modified Phong BRDF
Despite the kludges, we now have a decent BRDF for glossy materials. We can sample it: π’ = π
2
2 π½+1, π¦ = cos 2ππ
1
1 β π’ π§ = sin 2ππ
1
1 β π’ π¨ = π’ Normalize it: π½ + 2 2π πππ‘π½π We have a PDF: π½ + 2 2π πππ‘π½π
And finally, we can blend it with the Lambertian BRDF:
0;
0 < π, Lambert otherwise;
πβπππ + 1 β π ππΈπΊ ππππ
Advanced Graphics β BRDFs 17
BRDFs Without Issues
We now have two BRDFs without problems:
These are plausible and can be sampled. The PDF is also clear. And, we have the somewhat kludged modified Phong BRDF.
Advanced Graphics β BRDFs 18
Microfacet BRDFs*
We can simulate a broad range of materials if we assume: at a microscopic level, the material consists of tiny specular fragments.
*: Torrance & Sparrow, Theory for Off-Specular Reflection from Roughened Surfaces. 1967.
Advanced Graphics β BRDFs 19
Microfacet BRDFs*
The Microfacet BRDF: π
π π, π = πΊ π, π π» π, π, πΌ πΈ πΌ
4 π β π π β π Ingredients:
Advanced Graphics β BRDFs 20
Normal Distribution
Microfacet BRDF, ingredient 1: πΈ(πΌ) ο¨ the normal distribution function. Parameter πΌ: the halfway vector: π
π π, π = β―
A microfacet that reflects π towards π must have a normal halfway π and π:
H = normalize(V + L).
π
π π¦, ππ, ππ =
πππ(π¦, ππ) ππ π¦, ππ cos πππππ
πΎ π΄
Advanced Graphics β BRDFs 21
Normal Distribution
Intuitive choices for D: πΈ πΌ = π·: microfacet normals are equally distributed ο¨ diffuse material. πΈ πΌ = β, πππ πΌ = 0,0,1 0, ππ’βππ π₯ππ‘π : all microfacet normals are (0,0,1) ο¨ pure specular. Good practical choice for D: the Blinn-Phong distribution; πΈ πΌ = π½ + 2 2π π β πΌ
π½
Advanced Graphics β BRDFs 22
Geometry Term
Microfacet BRDF, ingredient 2: π»(π, π, πΌ) ο¨ the geometry term.
Advanced Graphics β BRDFs 23
Geometry Term
Intuitive choice for G: π»(π, π, πΌ) = 1: no occlusion. Good practical choice for G*: π» π, π, πΌ = min(1, min 2 π β πΌ π β π π β πΌ , 2 π β πΌ π β π π β πΌ
*: Physically Based Rendering, page 455
Advanced Graphics β BRDFs 24
Fresnel Term
Microfacet BRDF, ingredient 3: πΊ(π, πΌ) ο¨ the Fresnel term. So far, we assumed that the light reflected by a specular surface is only modulated by the material color. This is not true for dielectrics: here we use the Fresnel equations to determine reflection. In nature, Fresnel does not just apply to dielectrics.
π ππ ππ
Advanced Graphics β BRDFs 25
From βReal-time Rendering, 3rd edition, A. K. Peters.
Fresnel Term
Iron is specular, but reflectivity differs depending on incident angle. Aluminum is even more interesting: reflectivity depends on wavelength. The three lines in the graph: Top: blue, middle: green, bottom: red. Copper takes this to extremes: at grazing angles, it appears white. The lines in the graph: Top: red, middle: green, bottom: blue.
(hence its reddish appearance)
Advanced Graphics β BRDFs 26
Fresnel Term
For Fresnel, we once again use Schlickβs approximation: πΊ
π = ππ‘ππππ£πππ + (1 β ππ‘ππππ£πππ )(1 β π β πΌ )5
Note that this is calculated per color channel (ππ‘ππππ£πππ is an rgb triplet). Values for ππ‘ππππ£πππ for various materials: Iron 0.56, 0.57, 0.58 Copper 0.95, 0.64, 0.54 Gold 1.00, 0.71, 0.29 Aluminum 0.91, 0.92, 0.92 Silver 0.95, 0.93, 0.88
Advanced Graphics β BRDFs 27
Bringing it All Together
The Microfacet BRDF: π
π π, π = πΊ π, π π» π, π, πΌ πΈ πΌ
4 π β π π β π πΊ
π = ππ‘ππππ£πππ + (1 β ππ‘ππππ£πππ )(1 β π β πΌ )5
π» π, π, πΌ = min(1, min 2 π β πΌ π β π π β πΌ , 2 π β πΌ π β π π β πΌ πΈ πΌ = π½ + 2 2π π β πΌ
π½
For a full derivation of the denominator of the BRDF, see Physically Based Rendering, section 8.4.2.
Advanced Graphics β BRDFs 28
Lambertian BRDF
Advanced Graphics β BRDFs 29
Blinn-Phong Microfacet BRDF, Ξ±=1
Advanced Graphics β BRDFs 30
Blinn-Phong Microfacet BRDF, Ξ±=10
Advanced Graphics β BRDFs 31
Blinn-Phong Microfacet BRDF, Ξ±=50
Advanced Graphics β BRDFs 32
Blinn-Phong Microfacet BRDF, Ξ±=500
Advanced Graphics β BRDFs 33
Blinn-Phong Microfacet BRDF, Ξ±=50000
Advanced Graphics β BRDFs 34
Specular BRDF
Advanced Graphics β BRDFs 36
Sampling the Microfacet BRDF
A BRDF merely tells us how much energy we can expect to leave in a certain direction, given an incoming direction. We would like to pick a direction proportional to importance (even though any direction on the hemisphere is βcorrectβ). Lambertian: sample proportional to cos π (ππΈπΊ =
πβπ π ).
Phong: sample proportional to specular lobe (ππΈπΊ =
π½+2 π
π β π
π½, where π = π ππππππ’(π, π).
Microfacet: sample proportional to πΈ (ππΈπΊ =
π½+2 2π
π β πΌ
π½).
Sampling proportional to π β π, according to the Global Illumination Compendium:
π¦ = cos 2ππ
1
1 β π
2
π§ = sin 2ππ
1
1 β π
2
π¨ = π
2
Sampling proportional to π β π π½, according to the Global Illumination Compendium:
π’ = π
2
2 π½+1, π¦ = cos 2ππ
1
1 β π’ π§ = sin 2ππ
1
1 β π’ π¨ = π’
Advanced Graphics β BRDFs 37
Sampling the Microfacet BRDF
Sampling proportional to D: πΈ πΌ = π½ + 2 2π π β πΌ
π½
π’ = π
2
2 π½+1, π¦ = cos 2ππ
1
1 β π’ π§ = sin 2ππ
1
1 β π’ π¨ = π’ Vector π¦ π§ π¨ is the halfway vector, but we where looking for πβ¦ Luckily, π is π reflected in πΌ, and therefore: π = 2 π β πΌ πΌ β π
Advanced Graphics β BRDFs 38
Sampling the Microfacet BRDF
Problem: we are going to sample directions into the surface. Formal solution: these rays are occluded and return no energy. Better solution: use RIS.
π (>0) to each direction;
πππ ππ.
Note: using stratification, N=2 is sufficient (why?).
Advanced Graphics β BRDFs 39
Microfacet BRDF, 1spp, no RIS
Advanced Graphics β BRDFs 40
Microfacet BRDF, 1spp, RIS enabled
Advanced Graphics β BRDFs 41
Quo Vadis
Alternative normal distributions: Beckmann: πΈ πΌ = πΌ β π ππ½ππππ‘4πβ π
βπ’ππ2πβ π½π
2
GGX: πΈ πΌ = π½2 π πΌ β π 2 π½2 β 1 + 1
2
β¦and many others.
Advanced Graphics β BRDFs 42
Quo Vadis
Alternative geometric shadowing terms: Neumann: π» π, π, πΌ = (π β π)(π β π) max(π β π, π β π) GGX: π» πΌ = 2(π β π) π β π + π½2 + 1 β π½2 π β π 2 β¦and many others.
Advanced Graphics β BRDFs 43
Quo Vadis
Anisotropic materials:
Advanced Graphics β BRDFs 44
Quo Vadis
The Other Side: BSSRDF*
*: Jensen et al., 2001. A Practical Model for Subsurface Light Transport.
Advanced Graphics β BRDFs 45
Quo Vadis
Variance Reduction for BSSRDFs:
Advanced Graphics β BRDFs 46
Quo Vadis
Measured BRDFs:
Jacco Bikker - November 2016 - February 2017
next lecture: βGrand Recapβ