Marschner Shader 

Ornatrix carries a bunch of shaders specifically designed to model light interactions with hair. One shader is particularly accurate and is designed to model light scattering almost the way it happens in the real world. To remove some confusion and to allow an average user to use this special shader, this article will explain how it works and the parameters used to control it.

The most widely used shading models in CG world are Phong and Blinn models. These use very simple procedures involving measuring the angle from light rays to surface normals and deciding how much light is reflected based on these angles. Most common light reflections that are modeled are diffuse- the overall color of the object to simulate surface roughness, specular- sharp reflection to simulate surfaces that are smooth, and ambient- the contribution of overall environment light onto the object.

These basic shaders were translated to render hair to form the Kajiya2 shading model, used by Cheap and Translucent shaders in Ornatrix. If one studies hair more carefully, however, they will find out that there is a lot more going on than diffuse, specular, and ambient light scattering. Let us look at what actually goes on when a light ray hits a hair follicle.


Light scattering from a hair fiber1

The material that hair is composed of is not fully reflective (like a rock for example), and it isn't fully adsorbent- rather it allows some light pass through it and at the same time reflects hair off of itself (more like glass). Therefore it wouldn't be fair to just model specular reflections. The reflections that we will model are: direct reflections (R- light doesn't enter the hair follicle, it bounces right back from it), secondary reflections (TRT- light goes inside hair strand, bounces off the inside wall, and comes back out from the outside wall), and transmission (TT- light enters the hair strand, and goes right through it).

By making basic observations it is easy to see that primary reflections will always be the color of the light (since they never enter the strand). Secondary reflections and transmission will have some hair color since while the light travels inside hair strands some of it will be absorbed.

If you have done previous hair research you will know that organic hair isn't composed of flat cylinders. It has scales that go only in one direction (away from the root). This can be easily observed if a hair strand is felt in one direction and then in another. Only in one direction will you inhibit friction. These scales have a significant effect on how light is reflected. The slight slant in these scales bends light rays as they enter and exit the strand. The more the light travels inside a hair strand the more perturbations does its direction account. This makes secondary reflection exit at a different angle than primary reflection thus splitting the final hair reflection into two.

Another real world phenomena that influences light scattering in hair is the fact that most organic hair are not circular in cross-section. In fact most real hairs are elliptical. Because of the elliptical cross-section light that enters the strand from different directions will be scattered differently. There are certain directions that make the hair 'sparkle', these are real-world singularities which we refer to as glints.

These natural phenomena change the way real hair looks when compared to synthetic hair and can have a big impact on hair renders.

In the image above you can see the difference between a standard Phong/Kajiya2 scattering model, and same hair shaded with Marschner's model. Hair glints and secondary reflections become apparent. If the same hair is looked at from the back one will also notice the transmission carried by Marschner's1 model. All of this is carried into Ornatrix expensive shader.

Ornatrix hair shader has a random absorption parameter. This parameter will make absorption of every strand a little bit random to simulate slight differences in hair thickness and shape. It also magnifies the effect of hair colour variation among strands. The twists of every strands relative to the scalp are also randomized so that if your hair strands are elliptical, every ellipse faces in a different direction.

You have control over the glints by changing their intensity, and maximum allowed width (some glints can be infinitely bright because of divisions by 0). Internally Ornatrix solves a bunch of cubic equations to compute secondary reflections and transmissions so changing some parameters can have great impact on the speed of the algorithm.

User also has control over index of refraction, which specifies what sort of medium hair strands are composed of, and the medium they are interacting with. Many other more straightforward parameters like the scales tilt, or surface roughness are used to give the user total control of the algorithm. It is up to you to make your hair look dazzling and realistic.

 

References 

1 Marschner R. S., Henrik W. J., Cammarano M., Worley S., Hanrahan P., 2003. Light Scattering from Human Hair Fibers. In Proceedings of SIGGRAPH 2003.

2 Kajiya, J. T., and Kay, T. L. 1989. Rendering fur with three dimensional textures. In Proceedings of SIGGRAPH 1989, 271-280.

Missing Something? Let us know if this page needs more information about the topic.