Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A very basic OSL hair shader is presented below. Note that we use the same roughness in the longitudinal and azimuthal directions.

Code Block
#include "3delightosl.h"

surface basic_hair(
    color absorption = 1 - color( 0.99, 0.8, 0.6 ),
    float weight[3] = { 1, 1, 1 },
    float roughness[3] = { 0.03, 0.4, 0.6 },
    float highlight_position[3] = { 0.05, 0.05, 0.05 }
    )
{
    closure color hair_ci =
        hair(
            dPdv, 1.55, absorption,
            weight[0] * hair_component( "R", roughness[0], roughness[0], -highlight_position[0] ) +
            weight[1] * hair_component( "TT", roughness[1], roughness[1], -highlight_position[1] ) +
            weight[2] * hair_component( "TRT", roughness[2], roughness[2], -highlight_position[2] )
            );

    Ci = hair_ci;
}