Anybody tried implementing Disney's Principled BRDF?

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Anybody tried implementing Disney's Principled BRDF?
Hi all,
I have been reading the note from Disney about their principled BRDF.
http://disneyanimation.s3.amazonaws.co ... tes_v2.pdf
And I just don't think this note has provided enough detail for others to implement it.
In particular, I don't understand how their specular D component, and how they are using 2 specular lobes.
Also they didn't mention clearly how most of their parameters fit into their brdf, like the specular.
Anybody has experience with this?
I have been reading the note from Disney about their principled BRDF.
http://disneyanimation.s3.amazonaws.co ... tes_v2.pdf
And I just don't think this note has provided enough detail for others to implement it.
In particular, I don't understand how their specular D component, and how they are using 2 specular lobes.
Also they didn't mention clearly how most of their parameters fit into their brdf, like the specular.
Anybody has experience with this?
Re: Anybody tried implementing Disney's Principled BRDF?
Their principled BRDF is based on Walter et al. "Microfacet Models for Refraction through Rough Surfaces" GGX BRDF. I'd recommend reading this article.
You can find an implementation of the GGX BRDF in Disney's "BRDF Explorer": an open source application for exploring the characteristics of BRDFs.
Disney extended the GGX to anisotropic BRDF. That is explained in the appendix of their paper.
When you mention "2 specular lobes", are you referring to the "clearcoat" property? If so, then I don't see that as a 2lobes BRDF but rather as two GGX BRDF coupled by a Fresnel function. This first specular lobe represents the scattering characteristics of a base material the second lobe represents the scattering characteristics of a clear coating (varnish or glazing) covering the base material. Their "roughness" and "clearcoatGloss" parameters control the roughnesses of the two BRDF respectively. And instead of letting the IOR controlling the strength of the specular, they use "specular" and "clearcoat" parameters for that.
You can find an implementation of the GGX BRDF in Disney's "BRDF Explorer": an open source application for exploring the characteristics of BRDFs.
Disney extended the GGX to anisotropic BRDF. That is explained in the appendix of their paper.
When you mention "2 specular lobes", are you referring to the "clearcoat" property? If so, then I don't see that as a 2lobes BRDF but rather as two GGX BRDF coupled by a Fresnel function. This first specular lobe represents the scattering characteristics of a base material the second lobe represents the scattering characteristics of a clear coating (varnish or glazing) covering the base material. Their "roughness" and "clearcoatGloss" parameters control the roughnesses of the two BRDF respectively. And instead of letting the IOR controlling the strength of the specular, they use "specular" and "clearcoat" parameters for that.

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Re: Anybody tried implementing Disney's Principled BRDF?
Thanks for your detailed explanation. That helps. Though I still have some confusion.ypoissant wrote:Their principled BRDF is based on Walter et al. "Microfacet Models for Refraction through Rough Surfaces" GGX BRDF. I'd recommend reading this article.
You can find an implementation of the GGX BRDF in Disney's "BRDF Explorer": an open source application for exploring the characteristics of BRDFs.
Disney extended the GGX to anisotropic BRDF. That is explained in the appendix of their paper.
When you mention "2 specular lobes", are you referring to the "clearcoat" property? If so, then I don't see that as a 2lobes BRDF but rather as two GGX BRDF coupled by a Fresnel function. This first specular lobe represents the scattering characteristics of a base material the second lobe represents the scattering characteristics of a clear coating (varnish or glazing) covering the base material. Their "roughness" and "clearcoatGloss" parameters control the roughnesses of the two BRDF respectively. And instead of letting the IOR controlling the strength of the specular, they use "specular" and "clearcoat" parameters for that.
1. I guessed that the 2 specular lobes are two seperate brdf weighted by Fresnel. But in each of the brdf, there are already a Fresnel term in the microfacet model. How exactly are they combined?
2. I still don't get the part that how IOR could control the strength of specular incidence. I don't see a specular parameters in their brdf equation.
3. They didn't specify how parameters like "sheen" "specularTint" are used in their brdf equation. If only they could've written down a explicit brdf equation that includes all those parameters.
I will also take a look at the rough surface paper to see if it will help. Thanks
Re: Anybody tried implementing Disney's Principled BRDF?
Whatever energy is not reflected by the coating BRDF goes through to the base BRDF. Since the energy reflected by the coating BRDF is determined by the Fresnel term on the coating microfacet, this is how they are combined.shiqiu1105 wrote: 1. I guessed that the 2 specular lobes are two seperate brdf weighted by Fresnel. But in each of the brdf, there are already a Fresnel term in the microfacet model. How exactly are they combined?
See
"A Microfacet Based Coupled SpecularMatte BRDF Model with Importance Sampling" by Csaba Kelemen & László SzirmayKalos,
"Arbitrarily Layered MicroFacet Surfaces" by Andrea Weidlich & Alexander Wilkie,
"Thinking in Layers  Modelling with Layered Surfaces" by Andrea Weidlich & Alexander Wilkie
A BRDF has two distribution components: a directional distribution component and a spectral distribution component. Measured BRDF contain the two components but analytic BRDFs represent only the directional component. The directional component must be scaled by the spectral component at the surface shading point. One way of getting the spectral component is through the Fresnel equation and the spectral IOR, especially for coating materials.2. I still don't get the part that how IOR could control the strength of specular incidence. I don't see a specular parameters in their brdf equation.
They didn't write everything down into a single BRDF equation because all the parameters do not relate to a single BRDF but rather to several BRDFs that are mixed together in order to obtain a requested artistic look while still keeping the reflectance model relatively well physically behaved.3. They didn't specify how parameters like "sheen" "specularTint" are used in their brdf equation. If only they could've written down a explicit brdf equation that includes all those parameters.
"specularTint" is just a part of the spectral component. "sheen" relates to yet another BRDF directional distribution type.
I would suggest you start playing with simpler BRDFs such as a simple GGX. Once you understand how GGX works and how to use it in a renderer, then you will be able to figure how those parameters are used together into their principled BRDF.

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Re: Anybody tried implementing Disney's Principled BRDF?
ypoissant wrote:Whatever energy is not reflected by the coating BRDF goes through to the base BRDF. Since the energy reflected by the coating BRDF is determined by the Fresnel term on the coating microfacet, this is how they are combined.shiqiu1105 wrote: 1. I guessed that the 2 specular lobes are two seperate brdf weighted by Fresnel. But in each of the brdf, there are already a Fresnel term in the microfacet model. How exactly are they combined?
See
"A Microfacet Based Coupled SpecularMatte BRDF Model with Importance Sampling" by Csaba Kelemen & László SzirmayKalos,
"Arbitrarily Layered MicroFacet Surfaces" by Andrea Weidlich & Alexander Wilkie,
"Thinking in Layers  Modelling with Layered Surfaces" by Andrea Weidlich & Alexander Wilkie
A BRDF has two distribution components: a directional distribution component and a spectral distribution component. Measured BRDF contain the two components but analytic BRDFs represent only the directional component. The directional component must be scaled by the spectral component at the surface shading point. One way of getting the spectral component is through the Fresnel equation and the spectral IOR, especially for coating materials.2. I still don't get the part that how IOR could control the strength of specular incidence. I don't see a specular parameters in their brdf equation.
They didn't write everything down into a single BRDF equation because all the parameters do not relate to a single BRDF but rather to several BRDFs that are mixed together in order to obtain a requested artistic look while still keeping the reflectance model relatively well physically behaved.3. They didn't specify how parameters like "sheen" "specularTint" are used in their brdf equation. If only they could've written down a explicit brdf equation that includes all those parameters.
"specularTint" is just a part of the spectral component. "sheen" relates to yet another BRDF directional distribution type.
I would suggest you start playing with simpler BRDFs such as a simple GGX. Once you understand how GGX works and how to use it in a renderer, then you will be able to figure how those parameters are used together into their principled BRDF.
Thanks for your explaination!
I took a closer look at the rough surface bsdf. I found that the Disney is using GTR as their D function.
And I plotted in the BRDF explorer and found out that GGX is equivalent to TR.
And I tried implementing the GTR proposed by the disney course note, and just couldn't produce the same profile as GGX or TR.
The following is my implementation.
Code: Select all
analytic
# TrowbridgeReitz (from Blinn 77)
# normalization constant added:
# 1/Integrate[(c^2 / (Cos[x]^2 (c^2  1) + 1))^2 Cos[x] Sin[x], {x, 0, Pi/2}, {phi, 0, 2 Pi}]
# == 1/(c^2 Pi)
# variables go here...
# only floats supported right now.
# [type] [name] [min val] [max val] [default val]
::begin parameters
float c 0.001 1 .1
float a 0.001 1 .1
bool normalized 0
::end parameters
# Then comes the shader. This should be GLSL code
# that defines a function called BRDF (although you can
# add whatever else you want too, like sqr() below).
::begin shader
const float PI = 3.14159265358979323846;
float sqr(float x) { return x*x; }
float GTR(float c, float a, float cosAlpha)
{
return c/sqr(sqr(a * cosAlpha) + (1  sqr(cosAlpha)));
}
vec3 BRDF( vec3 L, vec3 V, vec3 N, vec3 X, vec3 Y )
{
// compute the half vec3
vec3 H = normalize( L + V );
float D = GTR(c, a, dot(N,H));
return vec3(D);
}
::end shader

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Re: Anybody tried implementing Disney's Principled BRDF?
Also, I read one of your previous post asking about the implementation of the walter 07 rough refraction brdf.
And I found their is a reference implementation in the BRDF explorer.
I will post it here as well, hope that helps
And I found their is a reference implementation in the BRDF explorer.
I will post it here as well, hope that helps
Code: Select all
analytic
# Walter07, w/ GGX
# variables go here...
# only floats supported right now.
# [type] [name] [min val] [max val] [default val]
::begin parameters
float Kd 0 1 0
float Ks 0 1 .1
float alphaG 0.001 1 .1
float ior 1.3 3 2
bool useFresnel 0
::end parameters
::begin shader
const float PI = 3.14159265358979323846;
float sqr(float x) { return x*x; }
float GGX(float NdotH, float alphaG)
{
return alphaG*alphaG / (PI * sqr(NdotH*NdotH*(alphaG*alphaG1) + 1));
}
float smithG_GGX(float Ndotv, float alphaG)
{
return 2/(1 + sqrt(1 + alphaG*alphaG * (1Ndotv*Ndotv)/(Ndotv*Ndotv)));
}
vec3 BRDF( vec3 L, vec3 V, vec3 N, vec3 X, vec3 Y )
{
float NdotL = dot(N, L);
float NdotV = dot(N, V);
if (NdotL < 0  NdotV < 0) return vec3(0);
vec3 H = normalize(L+V);
float NdotH = dot(N, H);
float VdotH = dot(V, H);
float D = GGX(NdotH, alphaG);
float G = smithG_GGX(NdotL, alphaG) * smithG_GGX(NdotV, alphaG);
// fresnel
float c = VdotH;
float g = sqrt(ior*ior + c*c  1);
float F = useFresnel ? 0.5 * pow(gc,2) / pow(g+c,2) * (1 + pow(c*(g+c)1,2) / pow(c*(gc)+1,2)) : 1.0;
float val = Kd/PI + Ks * D * G * F / (4 * NdotL * NdotV);
return vec3(val);
}
::end shader

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Re: Anybody tried implementing Disney's Principled BRDF?
I read more on this topic and played around with BRDF Explorer, and I think I have a better understanding now.
I do have another question.
Since the BRDF is the sum of a diffuse component and a specular component modeled by microfacet, when we sample scattering event at the surface, which component do we importance sample? The specular D or the diffuse, or based on fresnel of the marcofacet normal?
I do have another question.
Since the BRDF is the sum of a diffuse component and a specular component modeled by microfacet, when we sample scattering event at the surface, which component do we importance sample? The specular D or the diffuse, or based on fresnel of the marcofacet normal?
Re: Anybody tried implementing Disney's Principled BRDF?
You could select 50/50 between the coating or the base BRDF for reflection using a Russian Roulette. Or you could use a Russian Roulette on the coating microfacet Fresnel reflectance. Both are good. Personally, I select based on the coating Fresnel reflectance.
Re: Anybody tried implementing Disney's Principled BRDF?
The GGX BRDF implementation as found in BRDF Explorer does not strictly follow the paper equations. There is a simplification that I couldn't match/proof in Mathematica. But the end result works quite well. I also changed the implementation to strictly follow the published equations and got the same results. So I conclude that the simplification is valid.shiqiu1105 wrote:Also, I read one of your previous post asking about the implementation of the walter 07 rough refraction brdf.
And I found their is a reference implementation in the BRDF explorer.
I will post it here as well, hope that helps
The issues I was having was with the BTDF, which doesn't have a public implementation. So I implemented the BTDF in BRDF Explorer starting with the GGX BRDF and adding the IOR based factors, strictly following the equations in the paper. This produced a BTDF with totally weird albedoes. I rederived all the equations and arrived at the same results as in the paper. So I'm a bit lost. The GGX BRDF itself does not have a perfectly flat albedo for all roughnesses and incident directions although regarding the albedo, GGX is still the best analytic BRDF so far. But the resulting BTDF was totally in another league.
Re: Anybody tried implementing Disney's Principled BRDF?
Indeed, GGX is a TrowbridgeReitz BRDF. Schlick BRDF is also a TrowbridgeReitz BRDF but the shortcuts used in its implementation results in some weird albedos in some parts of the roughnessincidence space.shiqiu1105 wrote:And I plotted in the BRDF explorer and found out that GGX is equivalent to TR.
I guess that is why they call it "clearcoat". A real coating material will absorb some of the energy on its way down to the base material and then after bouncing off the base material, absorb some more on its way up outside the coating. But an implementation does not have to do that. And from a production point of view, the coating is better off not absorbing any energy.Also I think disney mentioned in their course note, the coating layer doesn't reduce energy reached at the bottom layer.
However, the energy that is bounced off the coating is not available to go through the coating down to the base. So if 0.04 of the energy reflects off the coating, then only 0.96 left of this energy can go down to the base material.