10
$\begingroup$

I am currently working with Earl Hammon Jr's Presentation PBR Diffuse Lighting for GGX+Smith Microsurfaces (now mentioned as [PBR, p.XYZ] and have read through (among others) Brent Burley's Physically-Based Shading at Disney (now mentioned as [DIS, p. XYZ] to get a good diffuse BRDF component. I am stuck at combining the two with the Fresnel Term.

Short introduction for vectors and angles as I use them:

  • $\omega_i$ is the light vector
  • $\omega_o$ is the view vector
  • $\omega_n$ is the macro geometry normal

  • $\theta_i$ is the angle between $\omega_i$ and $\omega_n$

  • $\theta_o$ is the angle between $\omega_o$ and $\omega_n$
  • $\theta_h$ is the angle between $\omega_n$ and $\omega_h$
  • $\alpha_{hi}$ is the angle between $\omega_i$ and $\omega_h$
  • $\alpha_{ho}$ is the angle between $\omega_o$ and $\omega_h$ (this distinction is for clarification)
  • $\alpha_h$ is any of the angles $\alpha_{hi}$, $\alpha_{ho}$, since they are equal

now given that $r_s$ is the BRDF term of the specular component without the fresnel factor and $r_d$ accordingly the term of the diffuse component without the fresnel stuff, the fresnel factor is written as $F(angle)$. [PBR, p.105] mentions that the diffuse light is transmitted two times, once in and once out. Thus, the Fresnel component has to be multiplied two times. [PBR, p. 106] goes on to say Fresnel's laws are symmetrix, meaning entering and leaving is direction independent (i.e. it does not matter that once we go into the material from air and once we leave into air). Now I would assume (for $F_1$ is Fresnel for entering and $F_2$ is for Fresnel leaving the material) to use

$(1-F_1(\alpha_{hi}))*(1-F_2(\alpha_{ho}))$

$F_1$ and $F_2$ are the same function, and $\alpha_{hi}$ and $\alpha_{ho}$ are the same angle, therefore

$(1-F(\alpha_h))^2$

This would lead to a brdf $f$:

$f = F(\alpha_h) * r_s + (1-F(\alpha_h))^2 * r_d$

But both [PBR, p.113] and [DIS, p.14] use

$f = F(\alpha_h) * r_s + (1-F(\theta_i))*(1-F(\theta_o)) * r_d$

as does the original paper to use this kind of calculation by Shirely et al. 1997. I just don't get this, why do they change from the microfacet angles to the macro angles? The microfacet angles lead to energy conversation

$F \in [0, 1]$ $\Rightarrow(1-F) \in [0, 1] $ $\Rightarrow(1-F)^2 \in [0, 1]$ and $(1-F(\alpha_h)) >= (1-F(\alpha_h))^2)$

it should be reciprocal

$f(\theta_i, \theta_o) = F(\alpha_{hi}) * r_s + (1-F(\alpha_{hi}))*(1-F(\alpha_{ho}) * r_d = F(\alpha_h) * r_s + (1-F(\alpha_h))^2 * r_d = F(\alpha_{ho}) * r_s + (1-F(\alpha_{ho}))*(1-F(\alpha_{hi})) * r_d = f(\theta_o, \theta_i)$

and thus fulfill BRDF requirements. The microfacet angle is used for the specular term, therefore it is the more sensible thing to interpolate between specular and diffuse component (ignoring the fact of two transmissions for this argument). Instead, [PBR, p.113] and [DIS, p. 14] put the $\theta_h$ into a roughness calculation and leave that rather unexplained.

Additionally to my confusion about this, in the explanation slides [PBR, p.187] uses the dot product $\omega_h * \omega_o$ (and therefore the $\alpha_{ho}$ angle) and later on [PBR, p. 191] also the dot product $\omega_h * \omega_i$ ($\Rightarrow\alpha_{hi}$).

$\endgroup$

2 Answers 2

8
$\begingroup$

I finally figured out a flaw in my argumentation to use the half vector for the diffuse part.

tl;dr version:

$\alpha_{hi}$ and $\alpha_{ho}$ are not equal, this assumption only works for the specular part. Therefore the energyconservation is not given.

More correct: Per definition $\alpha_{hi} = \alpha_{ho}$, but you are not allowed to use them in the equation, you need to use the microfacet normals instead of the half vectors. The microfacet normal and the half vector are however not generally equal.

long version:

The diffuse BRDF (like the specular one) is an integration over all possible microfacet normals. The generalized BRDF form is:

(1)

$f = \int_{\Omega} \frac{\rho_m * D * G * \cos(\alpha_{hi}) * \cos(\alpha_{ho})}{ \cos(\theta_i) * \cos(\theta_o)}$

where $\rho_m$ is the behaviour of light when it reaches a microfacet, $D$ is the normal distribution function, $G$ is the geometry function and the rest is normalization [PBR, p.16-25][HEI, p.61f.]

Now for the specular BRDF, the behaviour is perfect reflection. This means, only microfacets where the microfacet normal $\omega_m$ equals the half vector $\omega_h$ between light ($\omega_i$) and view ($\omega_o$) direction reflect light from the light direction to the view direction. Mathematically, this translates to a Dirac Delta function $\delta(\omega_h)$. The amount of light reflected is determined by Fresnel $F$. With accounting for integration domain changes[PBR, p.31-41], this leads to ($\rho_{m,s}$ being the specular specific reaction of microfacets for the specular part):

(2)

$\rho_{m,s} = \frac{\delta(\omega_h) * F }{4*\alpha_{hi}*\alpha_{ho}}$

Plug this into (1) and you integrate over any $\omega_m$, but the dirac delta function makes you ignore anything where $\omega_m \neq \omega_h$. This is the nice thing about those dirac delta functions, the "cancel" the integral. Therefore, you come to the well known BRDF [PBR, p.43]

(3)

$f_s = \frac{F * D * G}{4 * \cos(\theta_i) * \cos(\theta_o)}$

and here you can savely assume $\alpha_{hi} = \alpha_{ho}$. The Fresnel part makes this one side of a linear interpolation (seeing as this is the ratio of light being specularly reflected).

On the other side though, you still have an integral and you can't "cancel" it with anything. Let $\theta_{mi}$ be the angle between the microfacet normal and the light dir, $\theta_{mo}$ between the microfacet normal and the view dir (as opposed to $\alpha_{hi}$ and $\alpha_{ho}$, which specifically are defined for the half angle!).That means 2 important things:

(4)

$\theta_{mi} \neq \alpha_{hi} = \alpha_h = \alpha_{ho} \neq \theta_{mo} \forall \omega_m \neq \omega_h$

and $\rho_{m,d}$ (as the diffuse reaction of light when reaching microfacets) is depended upon Fresnel, it can only use non reflected parts, but you cannot just assume EVERY microfacet normal diffusley reflects all the light that was not specularly reflected (i.e. $(1-F(\alpha_h))$).

So the problem now is, you have one side of that linear interpolation being the analytically solvable specular BRDF without an integral. On the other side, you have the interpolation factor within the integral, and thus you would use it for any microfacet normal. This is not energy conserving anymore, if you model $\rho_{m,d}$ with a lambertian term.

If you manage to pull the $1-F$ part out of the integral, then and only then can you use the half vector for both specular and diffuse BRDFs, otherwise you need to handle it differently.

If you still want to use the half vector for the "Fresnelinterpolation", then you need to normalize.

$f = F(\alpha_h) * r_s + (1-F(\alpha_h)) * r_d * k$

With $k$ being chosen, such that

$r_d * k = 1$

Note that $r_d$ still includes an integral over all possible microfacet normals.

Using $\theta_i$ and $\theta_o$

I guess I should add a sentence about the actually used angles, because the question I originally posed was not just "why not $\alpha_h$" but also "why $\theta_i$ and $\theta_o$". So for the poeple wondering if this is correct: No. It is just an approximation.

Instead, we can modify the matte term to be a simple approximation that captures the important qualitative angular behavior[...].

[SHI, p.46]

Discussion on why this is so hard to figure out

Now [DIS, p.14] and [PBR, p.100,184] quoted [SHI] and [ASH] on this, where [ASH] uses [SHI], so it boils down to the model of the latter. And seeing as [DIS] and [PBR] are non-scientific (though pretty well thought through) publications, I can't fault them too much, but really, a better way of quoting papers or an extra explanation might have helped and saved me about 2 weeks of thinking, reading and almost starting a paper on why everybody is (supposedly) wrong.

Furthermore, neither of them really explains their diffuse approximations, [PBR, p.193] just mentions trying different functions until he saw one he liked.

Additionally, [SHI, p.46] actually quoted [SCH, p.10f.] who used the linear interpolation between $F(\alpha_h)$ and $1-F(\alpha_h)$. However, [SHI, p.46] quoted him incorrectly, they said he used $F(\theta_i)$ and $1-F(\alpha_h)$. Assuming this, they are of course right in thinking [SCH] is not energy conserving, but this lead me to believe that $F(\alpha_h)$ and $1-F(\alpha_h)$ would be. Their mistake might've come from them using $F(\theta_i)$ themselves, I can't say.

Literature

  • [ASH] An anisotropic phong BRDF model, in Journal of Graphics Tools Vol. 5, No. 2, Michael Ashikhmin and Peter Shirley, 2000
  • [SCH] An Inexpsensive BRDF Model for Physically-based Rendering, in Computer Graphics Forum Vol. 13, No. 3, Christophe Schlick, 1994
  • [SHI] A Practitioners' Assessment of Light Reflection Models, in The Fifth Pacific Conference on Computer Graphics and Applications, 1997. Proceedings, Peter Shirley, Helen Hu, Brian Smits and Eric Lafortune, 1997
  • [DIS] Physically-Based Shading at Disney, at SIGGRAPH 2012 Course: Physically Based Shading in Film and Game Production, Brent Burley, 2012
  • [HEI] Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs, in Journal of Computer Graphics Techniques Vol. 3, No. 2, Eric Heitz, 2014
  • [PBR] PBR Diffuse Lighting for GGX+Smith Microsurfaces, at GDC2017, Earl Hammon Jr., 2017
$\endgroup$
2
$\begingroup$

We're actually going through that paper for our own GGX BRDF metallic & edge_tint model, and we've spotted one crucial problem.

Hammon is still using the Fresnel Schlick approximation for his microfacet field ray-trace which in reality only works for dielectrics (and conductors but with a hack).

But we went all out on actual Fresnel (discarding polarization) and do the full calculation, enabling us to set $F_0=0$ when we do not wish for specular on a surface at all.

https://github.com/Crisspl/IrrlichtBAW/commit/914b50d7238fc4a30f23fc2a4ea570e467f4ab75#r34031272

The problem is that Schlick falls apart for $F_0<0.02$, so the GGX diffuse would be too dark for those materials (because its still assuming low transmittivity at glancing angles).

As an aside, something that stinks to me is that DIS and PBR use $(1-F(\theta_i))(1-F(\theta_o))$ which is a split-sum approximation (fresnel with average facet normal) instead of the proper calculation which would be weighted average of fresnel with every facet normal possible, weighted of course by the normal distribution function.

In PBR the smooth component could stay as-is (except that the Schlick would need replacing by proper Fresnel) but I wonder what rough and multi would have to become with an $F_0<0.02$ .

I guess that rough would probably change very little, but enough to make a difference (since with $\alpha=1$ GGX NDF is a constant) if $F_0=0$.

I hope we could drop E. Hammon an email and see if the simulation could be re-run for full Fresnel and the extended IoR (F0) range, 1.0 (0.0) inclusive.

EDIT: Seb. Lagarde also has the same concern as I did about the Fresnel used http://openproblems.realtimerendering.com/s2017/02-PhysicallyBasedMaterialWhereAreWe.pdf

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.