HairMaterial_v3

Overview


An energy-conserving, artist-friendly shader for human hair, animal fur and any other curve-based geometry.

The three most important attributes that determine the overall look:

Hair Color

This color determines the color of your hair. The shader will internally calculate the correct absorption and scattering coefficients required for the physically based hair shading model to create the final user-specified color. Primary specular highlights are not affected by this color which only affects the transmission and secondary specular highlights. Secondary specular is always darker than transmission since it travels longer inside the hair fiber and gets absorbed more.

Primary Specular Roughness

This should be your one-stop shop to control the roughness of the hair material. For physical behavior, this roughness will automatically determine what the transmission and secondary specular roughnesses should be. The secondary specular roughness is calculated as 2x and the transmission roughness is calculated as 0.5x the primary specular roughness. If desired, this connection between roughnesses can be broken based on attributes outlined below.

Transmission Azimuthal Roughness

Azimuthal roughness only applies to the transmission lobe and controls the lateral spread of energy from the hair fibers. This attribute helps control how the shader distributes energy in the hair/fur volume. Lower values will distribute the energy in a narrow band only when the light is exactly at the back resulting in darker renders whereas, higher values tend to distribute energy more evenly resulting in a more natural look. Use a value of 0.75 for human hair and 1.0 for animal fur.

Importance of max depth and max hair depth

The color of the hair comes from true multiple scattering inside the hair/fur volume. This means that the number of bounces will have a significant impact on the color of your hair. Especially for lighter/white/blonde hair, this depth should be set to a high number to allow for a more realistic hair color.

Moonray provides a separate depth variable called max hair depth that helps you control the number of bounces for the hair material. This should be set to at least 5 and for best results 10 or more for white hair.


Attribute Reference

Advanced attributes

show_multiple_scattering

Bool
default: True

show the amount of light scattered after TRT bounce, good for blonde/white hair

use_optimized_sampling

Bool
default: True

optimized sampling of all the hair lobes, results in 2x-4x speedup on average (disables individual hair lobe AOVs). When false, the look may slightly change if using biased techniques like roughness/sample clamping.

Common attributes

casts_caustics

Bool
default: False

allows continuation of caustic light paths.

presence

Float bindable
default: 1.0

controls the visibility of this object. Useful for fading an object in/out, or to specify a cut-out mask on thin single-sided geometry (eg. a complex leaf texture on a simple card).

Emission attributes

emission

Rgb bindable
default: [ 1, 1, 1 ]

the energy emitted from this material

show_emission

Bool
default: False

enables/disable emission

Fresnel attributes

cuticle_layer_thickness

Float bindable
default: 0.1

No documentation available

fresnel_type

Int enum
  0 = “simple longitudinal”
  1 = “dielectric cylinder” (default)
  2 = “layered cuticles”

No documentation available

refractive_index

Float
default: 1.45

keep this value between [1.3,2.0] for realistic behavior (human hair is around 1.55)

refractive index 1-3

Primary Specular attributes

primary_specular_offset

Float bindable
default: -3.0

offset specular highlight along hair direction (in degrees) [-10,+10], around -3 for human hair

primary_specular_roughness

Float bindable
default: 0.5

roughness of the primary specular highlight, also sets the transmission roughness to 0.5x and secondary specular roughness to 2x by default unless independent roughnesses are being used for both

primary specular roughness 0-1

primary_specular_tint

Rgb bindable
default: [ 1, 1, 1 ]

tint the primary specular highlight with this color (leave white for physical behavior)

show_primary_specular

Bool
default: True

show primary specular

Secondary Specular attributes

glint_eccentricity

Float bindable
default: 0.85

secondary specular glint eccentricity [0.85, 1], values that deviate from 1 make the hair fiber more elliptical and more glinty

glint_max_twists

Float bindable
default: 2.5

the maximum number of twists along the hair's length. More twists means more glints. Each hair strand will be randomly assigned a twist amount between [min twists, max twists]

glint_min_twists

Float bindable
default: 1.5

the minimum number of twists along the hair's length. More twists means more glints. Each hair strand will be randomly assigned a twist amount between [min twists, max twists]

glint_roughness

Float bindable
default: 0.5

secondary specular glint roughness

glint_saturation

Float bindable
default: 0.5

secondary specular glint saturation

independent_secondary_specular_roughness

Float bindable
default: 0.4

secondary specular roughness

independent secondary specular roughness 0-1

secondary_specular_offset

Float bindable
default: -4.5

offset secondary specular highlight along hair direction (in degrees) [-10,+10], around -4.5 for human hair

secondary_specular_tint

Rgb bindable
default: [ 1, 1, 1 ]

tint secondary specular with this color (leave white for physical behavior)

show_hair_glint

Bool
default: False

show hair glint

show_secondary_specular

Bool
default: True

show secondary specular

use_independent_secondary_specular_roughness

Bool
default: False

when disabled, uses a physically correct value for secondary specular roughness which is linked to the primary specular roughness

Transmission attributes

direct_transmission_saturation

Float bindable
default: 1.0

(Non-Physical, Advanced) saturate/desaturate direct transmission highlights.

independent_transmission_roughness

Float bindable
default: 0.1

transmission roughness

independent transmission roughness 0-1

show_transmission

Bool
default: True

show tranmission specular

transmission_azimuthal_roughness

Float bindable
default: 1.0

higher values create a softer look

transmission azimuthal roughness 0-1

transmission_offset

Float bindable
default: -1.5

offset transmission highlight along hair direction (in degrees) [-10,+10], around -1.5 for human hair

transmission_tint

Rgb bindable
default: [ 1, 1, 1 ]

tint transmission with this color (leave white for physical behavior)

use_independent_transmission_roughness

Bool
default: False

when disabled, uses a physically correct value for Transmission roughness which is linked to the primary specular roughness

General attributes

extra_aovs

Map
default: None

Bind this attribute to a 'ListMap' that contains references to ExtraAovMaps that specify additional outputs that can be assigned to a RenderOutput "light aov" result

hair_color

Rgb bindable
default: [ 1, 1, 1 ]

No documentation available

invisible_refractive_cryptomatte

Bool
default: False

Indicates whether material should/should not appear in the refractive cryptomatte layers

label

String
default:

label used in material and light aovs

priority

Int
default: 0

The material's place in an order of precedence for overlapping dielectrics. A value of 0 means the priority should be ignored. Materials with lower numbers (higher priority) "override" materials with higher numbers (lower priority). To enable automatic removal of self-overlapping geometry, a non-zero priority must be set on the geometry's material.