# Geometric term in physically based shading

This topic is 1833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Sébastian Lagarde
Simon's Tech Blog

The sebastian article mainly describes distribution function for the specular and never mentions a geometric term, while the simon article compares different geometric terms that are used together with the distribution function.

Now I am curious why the one is including a geometric term and the other isn't. Are these two different approaches or is one article just focusing on a smaller part of the equation? Edited by B_old

##### Share on other sites

The first link uses the implicit geometry term  which cancels out with the bottom of the microfacet specular BRDF

For example, you can use the implicit geometry factor on older hardware.

##### Share on other sites

Having an implicit geometry term (which basically equates to not having one) has been used on current-gen console hardware in order to save performance. If you have the ALU to spare then you definitely want to use one, it's an important part of getting the right look at grazing angles (especially for materials with higher roughness values). It's also an important part of maintaining energy conservation with microfacet BRDFs.

Thanks!

##### Share on other sites

I'm wondering about the 4 * dot(n,l) * (n, v). It can become 0. Are you applieing some max(x, epsilon) on the individual dot products or on the whole term or something different?

##### Share on other sites
I'm wondering about the 4 * dot(n,l) * (n, v). It can become 0. Are you applieing some max(x, epsilon) on the individual dot products or on the whole term or something different?

It only becomes zero at a very grazing angle between the view vector (or light vector) and the surface, but in practice you'll probably want a few epsilons there just to guard against division by zero, since it'll mess up your entire pipeline if you end up with pixels with infinite brightness. I've seen a good shader implementation of Cook-Torrance someone on the internet which shows how to do those checks correctly and efficiently, though I can't find it right now.

Of course if you can cancel things out, make sure you do, as the safest and fastest operation is the one you never compute. You'll notice the dot(N, L) one is automatically cancelled out by the Lambertian cosine term, for instance.