TLDR: We've developed a method to measure a surface's microfacet distribution, and are looking for a way to integrate this in a Cycles shader. For more info, see this paper.

Hi all,

Together with a fellow student, I have developed a low budget way to get somewhat accurate measurements of the microstructure of a surface that concern the glossyness of a surface for a university course on surface engineering. We've also tried to make a method to integrate this in a cycles shader, which in theory should give a "carbon copy" of the gloss of the original real world sample, or at least a more accurate representation. This would be a nice way to get better previews in product design, but could also be nice in a more general purpose way if you can build up a library of different real world materials to get more convincing shaders.

Right now, the only thing we are struggling with is the actual inplementation. I'm pretty experienced with Blender as a user, but I'm pretty new to coding, and while most aspects of the shaders are easily customizable, the one parameter we need (the microfacet distribution) doesn't allow for options outside of the dropdown menu, and as far as I can tell, it can only be changed by diving into the source code (which seems a bit intimidating, to say the least). What I'm looking for is a way to make something like a plugin or node group which enables me to plug the image that contains the measurement data into the microfacet model as some sort of a lookup table. Does anyone know how to do this?

Thanks in advance!

Since it is all pretty technical, and took us quite some time to figure out, here is some background info:

The gloss of a surface is for a large part determined by the slopes in the surface which distort the reflection. Since these "bumps" or "microfacets" are too small to see individually, they sort of "blend together" to form the blurriness of the reflection you see. Because this blend is the result of lots of these microfacets, the total amount of reflected light is proportional to the (average) presence of these microfacets. This is the microfacet distribution Microfacet model

Since there is some randomness to this distribution, it can be represented as a statistical model, which is what render engines use to emulate the roughness of a surface. There are all kinds of different models with different equations, strengths and weaknesses, like phong, Beckmann and GGX. In Cycles, you can pick a model from the top dropdown of most shader nodes. By changing the roughness parameter, the distribution changes and gives a shinier or rougher surface look.

For our method, the idea is to use a dataset gathered from an actual surface instead of a mathematical approximation. Below are some examples gathered through our method (see paper for more detailed explanation). The position represents a certain microfacet slope, while the brightness indicates the probability density, or the relative presence of that slope.

Test results

I hope this info helps to clarify the issue, or at least give some more insight in how realistic rendering works behind the scenes.

  • $\begingroup$ Nodes can represent any programming except jmp instructions (goto, loops, etc). You could try providing a large number of samples to a sharp glossy shader, each with a normal defined by your distribution function and a random number. Not sure how well that would work-- Blender's distro functions aren't just alterations of normals like this, but seem to actually blur the ray--- and doing the low-level coding would be preferable. $\endgroup$ – Nathan Jul 17 '18 at 17:30
  • $\begingroup$ Have a look also here: blenderartists.org/t/… $\endgroup$ – cgslav Jul 17 '18 at 21:06
  • $\begingroup$ Also I think you should get in touch with Blender devs: devtalk.blender.org $\endgroup$ – cgslav Jul 17 '18 at 21:15

Your Answer

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

Browse other questions tagged or ask your own question.