21
$\begingroup$

In Cycles, the glossy (and anisotropic) shaders have a Distribution option. Since I don't really know the difference, I have always left it at it's default (GGX).

enter image description here

So what is a distribution model, what's the difference between them, and how do I choose which one to use?

Here is a simple test I've conducted:

enter image description here
125 samples, all shaders are pure white glossy, roughness = 0.1.

GGX has much less fireflies, especially in the shadow, and it seems a little foggier. I can't see any difference between Ashikhmin-Shirley and Beckmann. And sharp looks like a glossy shader with 0 roughness (even though it is set to 0.1 like the other 3).

Here's another test, this time with anisotropic shaders:

enter image description here
Also 125 samples, roughness = 0.6, anisotropy = 0.8, radial-z tangent.

$\endgroup$
  • 6
    $\begingroup$ Here's another test which makes the differences a little more obvious. $\endgroup$ – gandalf3 Oct 25 '15 at 23:42
  • 3
    $\begingroup$ Sharp is not affected by roughness. $\endgroup$ – cegaton Oct 26 '15 at 0:04
  • 3
    $\begingroup$ I believe the lack of fireflies in the shadow for GGX is because there's no sphere to its left. $\endgroup$ – Stuntddude Oct 26 '15 at 1:24
  • $\begingroup$ @RayMairlot See this meta post about code formatting. $\endgroup$ – PGmath Oct 27 '15 at 23:02
  • 1
    $\begingroup$ @PGmath I've seen it, and I disagree with it. But you are of course free to use that formatting, it just doesn't make sense to me. $\endgroup$ – Ray Mairlot Oct 28 '15 at 16:38
10
+150
$\begingroup$

We can take Sharp off the list right away as the entry in the manual states:

Distribution: Microfacet distribution to use. Sharp results in perfectly sharp reflections like a mirror, while Beckmann, GGX and Ashikhmin-Shirley can use the Roughness input for blurry reflections.

You may find this article to be a big help in visualizing the differences between the different models.

What I have found as far as formulas is as follows:

GGX: A potentially useful Cornell publication Time: 01:29.25

$$D(\mathbf m)=\frac{\alpha_g^2\chi^+(\mathbf m\cdot\mathbf n)}{\pi\cos^4\theta_m\left(\alpha_g^2+\tan^2\theta_m\right)^2}$$

$$G_1(\mathbf v,\mathbf m)=\chi^+\left(\frac{\mathbf v\cdot\mathbf m}{\mathbf v\cdot\mathbf n}\right)\frac{2}{1+\sqrt{1+\alpha_g^2\tan^2\theta_v}}$$

Ashikhmin-Shirley: Source Code from the commit Time: 01:23.59

$$\rho(\mathbf k_1,\mathbf k_2)=\frac{\sqrt{(n_u+1)(n_v+1)}}{8\pi}\frac{(\mathbf{nh})^\frac{n_u(\mathbf{hu})^2+n_v(\mathbf{hv})^2}{1-(\mathbf{hn})^2}}{(\mathbf{hk})\max((\mathbf{nk}_1),(\mathbf{nk}_2))}F((\mathbf{kh}))$$

Beckmann: A very informative portion of a Wikipedia article Time: 01:24.06

$$k_\text{spec}=\frac{\exp\left(-\tan^2(\alpha)/m^2\right)}{\pi m^2\cos^4(\alpha)},\alpha=\arccos(N\cdot H)$$

In conclusion

None of these are better than any other per se, however it is interesting to note that the Beckmann model is much more similar to standard diffuse at high roughness, while Ashikmin-Shirley is much darker. The differences are quite subtle, however some common recommendations are to use GGX for metallic materials.

I personally use GGX frequently (ceramics, metallic paint, metal, etc), and Beckmann second most (wood, rough plastics, etc). I find the differences between those two are the most pronounced. The best way to be sure what distribution model works for you is to try each one in your specific use case.

$\endgroup$
  • 2
    $\begingroup$ What are some of the advantages or disadvantages these methods have compared to each other? $\endgroup$ – gandalf3 Oct 28 '15 at 18:18
  • $\begingroup$ @gandalf3 just a sec $\endgroup$ – VRM Oct 28 '15 at 18:20
  • 3
    $\begingroup$ Quite an impressive array of equations! But it would be nice to know what all those variables represent. $\endgroup$ – PGmath Oct 28 '15 at 18:27
  • 6
    $\begingroup$ Complicated formulas without variables description have 0 informative value, they just look cool. $\endgroup$ – Jaroslav Jerryno Novotny Oct 28 '15 at 18:27
  • 1
    $\begingroup$ Testing on my CPU, Sharp seems to have a decent performance advantage; 1:17 for GGX 0 roughness 1:07 for Sharp. $\endgroup$ – gandalf3 Oct 28 '15 at 18:51
13
$\begingroup$

tl;dr: Always use GGX, set your roughness map to Non-color Data and square it with a math node before plugging it into the Glossy BSDF.

Different microfacet distributions will have differently shaped specular highlights. Beckmann and Ashikhmin-Shirley are both similar to a Blinn-Phong specular highlight that you might find in a game engine or Blender Internal, although they're normalized so that tighter highlights are brighter and duller highlights are less bright.

If you are just rendering for yourself I'd recommend sticking with GGX unless you've got a really, really good reason not to. The longer tail on the highlight makes the microfacet distribution more believable. Generally people remap the roughness map to make it more perceptually linear, so that if something is 30% glossy (for example) a specular highlight will have a radius of 30% of the radius of the hemisphere. Renderman, Unreal Engine 4, and Substance Designer and Painter all square the roughness for GGX, while Cryengine uses the formula roughness=(1-smoothness*0.7)^6 (Schulz 2014) because Cryengine loves to be weird and do things differently. Finally, Marmoset Toolbag 2 and Unity both use a normalized Blinn-Phong BRDF which is most accurately reproduced in Cycles by plugging the roughness through an RGB curves node and plugging that into a Glossy BSDF set to Ashikhmin-Shirley. Here's a chart with all of the different microfacet models and remappings. Note that all of these assume you read your roughness map either from an alpha channel or from a texture that's marked as Non-Color Data! Otherwise, the remapping is going to be different from what you probably intended.

Microfacet distribution chart

From left to right, the roughness or glossiness parameter is increasing from 0 to 1 in increments of 0.1. From top to bottom, they are vanilla Beckmann, vanilla Ashikhmin-Shirley, vanilla GGX, GGX with roughness squared (like UE4 and Renderman), GGX with the roughness squared and inverted for easier comparison to Cryengine's remapping, the Cryengine GGX remapping itself, and the Unity/Toolbag remapping of Ashikhmin-Shirley. Here they all are again with more reflection bounces and an environment:

Microfacet distribution chart with envmap

Beckmann acts particularly oddly at higher roughnesses (>.6) so if you're going to use it I would stay away from making your materials rougher than that. Ashikhmin-Shirley looks better, but GGX looks the best in my opinion. As far as remappings go I think Crytek's is the most linear-looking but I prefer to use the UE4 mapping as Substance Painter and 3D-Coat both support it and it blends well enough between material layers with different roughnesses.

The RGB curves node that remaps Unity/Toolbag 2 smoothness to Ashikhmin roughness looks like this if you're interested. I just eyeballed it but it's pretty close:

RGB curves node

The points are as follows: (0,0), (.13182, .05625), (.45455, .18750), (.81364, .36785), (1, .61250). This inverts the roughness map (just like Toolbag and Unity) and compresses it to a region where most of the plausible surfaces are, as well as making the highlight's size roughly linear as smoothness varies, making texture authoring more predictable.

Here's the node setup for the Crytek roughness remapping that converts smoothness to GGX roughness.

roughness=(1-smoothness*0.7)^6

The UE4/Renderman/everything else roughness remapping is easy to set up: just multiply it by itself with a math node

Note that in all of these cases a 100% rough glossy BSDF still doesn't look the same as a Diffuse BSDF. Because the BRDFs that Cycles implement always reflect the light depending on the half angle, rough glossy BSDFs will look really rough but will still look like rough metal instead of a rough dielectric.

$\endgroup$
6
$\begingroup$

Depending on the Distribution parameter the Glossy node will use a formula or other to show glossiness on you shader. The Roughness parameter determine if the glossiness is sharp (value 0.0) or rough (the maximum rough value is 1.0).

I use these rules to select the correct distribution:

  • Sharp: It creates perfect reflections and doesn't use the roughness paramenter. It is equal to Beckmann or Ashikhmin-Shirley distributions with a roughness value of 0.0, but Sharp is faster in rendering in this case.
  • Beckmann: It is better for materials which reflect much light or are very shining or glossy, that is, whose roughness is lower than 0.2.
  • GGX: It is better for materials which reflect little light or are little shining, that is, whose roughness is higher than 0.2.
  • Ashikhmin-Shirley: This distribution was introduced in cycles after Beckmann. It is said that it is more perfect and real than Beckmann, but probably a bit slowly in rendering. Differences can be appreciated when reflecting dark colors (Ashikhmin-Shirley is better).

So I will use the proper distribution depending on the roughness factor:

  • roughnes = 0.0 => Sharp
  • 0.0 < roughness < 0.2 => Ashikhmin-Shirley
  • roughness > 0.2 => GGX

Remember that changing the Beckmann distribution for Ashikhmin-Shirley in an existing material will change its dark reflections and can look different.

$\endgroup$
  • 1
    $\begingroup$ You are mixing the amount of reflection with the roughness of it. The amount is determined with the value of the glossy color (and fresnel). And doesn't matter if it's glossy shader or whatnot, even diffuse shader reflects light. $\endgroup$ – Jaroslav Jerryno Novotny Oct 29 '15 at 16:56
  • $\begingroup$ Yes @Jerryno, I agree with you, maybe I didn't explain it very well. In Cycles render engine, a perfect smooth surface (roughness 0.0) produce a specular reflection, by which I mean all light rays are reflected in one direction (this is I wanted to say). A 'perfect' rough surface (roughness 1.0) produce a diffuse reflection, by which I mean the light rays are reflected in all possible angles. $\endgroup$ – Elbrujodelatribu Oct 30 '15 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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