PxrMarschnerHair

PxrMarschnerHair

images/PxrMarschnerHair2.png

"Character tests with Marschner Hair” © Disney/Pixar


PxrMarschnerHair is a Pixar Studio hair shader. The shader provides the following:

  • It is a physically plausible Bxdf that is fully energy preserving.
  • Two diffuse model choices: Zinke and Kajiya.
  • Fully implemented Marschner specular lobes: multiple specular transport paths (R, TT, and TRT paths based on the hair scattering model of Marschner et al.); glints; eccentricity for elliptical cross-sections with azimuthal roughness control.
  • The implementation of the Marschner is using a ''data-driven'' light scattering model with Adaptive Importance Sampling that is optimized for hair rendering quality and most importantly hair rendering speed.

See Pixar Technical Memo 15-02 "A Data-Driven Light Scattering Model for Hair" by Leonid Pekelis, Christophe Hery, Ryusuke Villemin, Junyi Ling for more information.

Diffuse Parameters

Diffuse Model

There are two choices of diffuse models: Zinke and Kajiya. By default, it is set to Zinke diffuse model which is for bidirectional scattering. See Importance Sampling for Physically-Based Hair Fiber Models.

  • 0: Zinke
  • 1: Kajiya
RIB: float diffuseModelType
Default: 0

Diffuse Gain

Multiplier on diffuseColor. The product of diffuseGain and diffuseColor should be high (up to 1.0) for woolly fur, and low for e.g. human hair.

RIB: float diffuseGain
Default: 1.0

Diffuse Color

Diffuse color of hair.

RIB: color diffuseColor
Default: 0.18,0.18,0.18

To use the base and tip color from Maya Fur, create a PxrPrimvar node and set the Variable Name to Cs and Variable Type to color. Then wire its resultRGB to the Diffuse Color.

Pattern "PxrPrimvar" "HairColor" "string varname" ["Cs"] "string type" ["color"]
Bxdf "PxrMarschnerHair" "HairMaterial" "reference color diffuseColor" ["HairColor:resultRGB"]

We can also connect the color result from any RIS pattern into the Diffuse Color. For root and tip color along the length of the hair, we create a PxrPrimvar and set the Variable Name to v and then connect its output into a PxrMix node's Mix to mix between the root and tip color.

Pattern "PxrPrimvar" "HairV" "string varname" ["v"]
Pattern "PxrMix" "HairColor" "color color1" [1 0 0] "color color2" [0 1 0] "reference float mix" ["HairV:resultF"]
Bxdf "PxrMarschnerHair" "HairMaterial" "reference color diffuseColor" ["HairColor:resultRGB"]

Specular Parameters

images/PxrMarschnerHairSpec.png

"Light Scattering from Human Hair Fibers” © Cornell University

Marschner specular model is consisted of three specular lobes using multiple specular transport paths:
  • Primary Specular: R is for "reflect" where light hits the surface of the hair and reflects. This is the strong primary non-colored specular.
  • Secondary Specular: TRT is for "transmit", "reflect", and "transmit" where light transmits through the hair surface, then it reflects from within the hair surface and transmits to the front of the hair surface. This is the secondary colored specular.
  • Transmit Specular: TT is for "transmit" and "transmit" where light transmits through the hair surface and then transmits out of the back of the hair surface. This is the colored transmission that responses to back lighting.

See Marschner et al. for more information.

Specular Color

Specular color for tinting the Transmit Specular (the TT lobe), Secondary Specular (the TRT lobe) and GLINTS lobe. This specular color does not tint the Primary Specular (the R lobe) which is controlled separately by the Primary Specular Color.

Note that because the TRT lobe goes through the fiber volume twice, it is tinted by the square of the specular color.

RIB: color specularColor
Default: 1.0,1.0,1.0

Primary Specular Gain

Gain for the R lobe of Marschner specular. This is like a clearcoat where the specular is fairly sharp and glossy and normally not colored. This specular is a direct reflection which is not tinted by any volume attenuation.

RIB: float specularGainR
Default: 0.33

Primary Specular Color

Specular color for tinting the Primary Specular (the R lobe).

RIB: color specularSheen
Default: 1.0,1.0,1.0

Secondary Specular Gain

Gain for the TRT lobe of Marschner specular. This is a rougher and colored specular. This goes through the fiber volume twice.

RIB: float specularGainTRT
Default: 0.33

Transmit Specular Gain

Gain for the TT lobe of Marschner specular. This is a transmission-type (refraction) specular with some volume attenuation. It goes through the fiber volume once.

RIB: float specularGainTT
Default: 0.33

Glint Gain

Gain for glints.

RIB: float specularGainGLINTS
Default: 0.0

Cone Angle

Cone angle (theta) in degrees. The broader the angle, the softer and broader the highlight.

RIB: float specularConeAngle
Default: 8.0

Specular Offset

Cone offset in degrees.

RIB: float specularOffset
Default: -3.0

Refraction Index

Index of refraction.

RIB: float specularIor
Default: 1.55

Fresnel Mix

How much do we account for fresnel attenuation.

RIB: float specularMixFresnel
Default: 1.0

Glint Width

Smooths TRT distribution, should be between 10 and 25.

RIB: float specularGlintWidth
Default: 10.0

Eccentricity

Elliptical cross section aspect ratio. Between 1 and 0.85. Note that eccentricity depends on Nn. Note that Nn from the hair geometry should be in correct orientation.

RIB: float specularEccentricity
Default: 1.0

Other Parameters

Presence

Hair mask. This sets the presence (whether the hair is visible). Note that Presence in RIS means the chance of surface hit. It should be either 0 or 1. By default, it is set to 1 meaning that it has 100% chance of surface hit and thus the surface is present to the renderer. If it is set to 0, that means the surface is not present to the renderer. Setting it between 0 and 1 may produce unwanted noise.

RIB: float presence
Default: 1.0

Opacity Color

Shadow opacity color.

RIB: color opacityColor
Default: 1.0,1.0,1.0

Important

Shadow opacity color currently only works in the PxrPathTracer integrator and not VCM.

Input AOV

Connect an AOV pattern like PxrMatteID to trigger AOV output.

RIB: int inputAOV
Default: 0

From PxrHair

Mapping PxrHair to PxrMarschnerHair's parameters:

PxrHair PxrMarschnerHair
diffuse
    diffuse model = Goldman
    diffuseRootColor, diffuseTipColor

specular
    highlightWidth
    highlightShift

transmit
    transmitRootColor, transmitTipColor
diffuse
    diffuse model = Kajiya or Zinke
    diffuseColor

specular
    specularConeAngle
    specularOffset

transmit
    specularColor

From RMSHair

Mapping RMSHair to PxrMarschnerHair's parameters:

RMSHair (RfM RSL shader) PxrMarschnerHair
diffuse
    diffuse model = Goldman
    DiffuseRootColor, DiffuseTipColor

specular
    Highlight Width (Beta)
    Highlight Offset (Alpha)

transmit
    Specular Color
    Transmit Color
diffuse
    diffuse model = Kajiya or Zinke
    diffuseColor

specular
    specularConeAngle
    specularOffset

transmit
    Primary Specular Color (specularSheen)
    Specular Color (specularColor)

From Maya Fur/Hair

Maya Fur/Hair uses Kajiya-Kay specular model which is different than Marschner's specular model. Marschner's specular model is closer to real hair's specular response.

There are no exact mappings from Kajiya-Kay specular shader parameters.

First adjust the specular cone angle in PxrMarschnerHair. It should be between 5 to 10 degree. The broader the cone angle, the softer and broader the hair which is the opposite of the response from specular power and specular sharpness, where the larger number yields a sharper and smaller hightlight.