hair

object

The hair object is responsible for setting the style, color, and other attributes of the actor’s facial hair.

This object is optional; if you do not want your actor to have eyes, simply leave it out or set it equal to null.

The hair object contains the following fields:

"hair": {
  "id": //A UUID that defines the actor's hairstyle
  "color_settings": {
    "melanin": //The amount of black color in the hair
    "redness": //The amount of red color in the hair
    "whiteness": //How much the hair has gone grey or, at higher values, white
    "roughness": //How diffuse light as it reflects off of the hairs, which defines how shiny or dull the hair is
    "index_of_refraction": //How much light rays change direction as they travel through the hairs
  }
},

Sample usage

Location in the data request

In the JSON hierarchy of the data request, the hair object is found here:

{
  "datapoints": [
    {
      "human": {
        "head": {
          "hair": {

          }
        },
      }
    },
  ]
}

A sample complete hair object

"hair": {
  "id": "ca1decca-ad8e-48f4-bf61-553779075298",
  "color_settings": {
    "melanin": 0.5,
    "redness": 1,
    "whiteness": 0,
    "roughness": 0.2,
    "index_of_refraction": 1.4
  }
},

These values will generate a layered hairstyle made up of chin-length, straight red hair.

id

string

The id field selects a specific hairstyle from our catalog.

Tip

To download a CSV with a complete list of the hairstyles that we have available, click here

This field defines the shape of the hair but not its color or behavior in the light. Datagen has hundreds of unique hairstyles divided…

By gender

Female

To download a CSV with a complete list of UUIDs that define hairstyles appropriate for female actors, click here

Male

To download a CSV with a complete list of UUIDs that define hairstyles appropriate for male actors, click here

By style

Afros

To download a CSV with a complete list of UUIDs that define afro hairstyles, click here

Balding

To download a CSV with a complete list of UUIDs that define balding hairstyles, click here

Bangs

To download a CSV with a complete list of UUIDs that define hairstyles with bangs, click here

Bobs

To download a CSV with a complete list of UUIDs that define bob hairstyles, click here

Buns

To download a CSV with a complete list of UUIDs that define hairstyles with buns, click here

Crew cuts

To download a CSV with a complete list of UUIDs that define crew cut hairstyles, click here

Curtains

To download a CSV with a complete list of UUIDs that define curtain hairstyles, click here

Hair down

To download a CSV with a complete list of UUIDs that define hairstyles with the hair down, click here

High top cuts

To download a CSV with a complete list of UUIDs that define high top cut hairstyles, click here

Layered

To download a CSV with a complete list of UUIDs that define layered hairstyles, click here

Ponytails

To download a CSV with a complete list of UUIDs that define ponytail hairstyles, click here

Pulled back

To download a CSV with a complete list of UUIDs that define hairstyles with the hair pulled back, click here

Undefined

To download a CSV with a complete list of UUIDs that define hairstyles that don’t fit neatly into the other categories, click here

By length

Armpit

To download a CSV with a complete list of UUIDs that define armpit-length hairstyles, click here

Buzz cut

To download a CSV with a complete list of UUIDs that define buzz cut-length hairstyles, click here

Chin

To download a CSV with a complete list of UUIDs that define chin-length hairstyles, click here

Ear

To download a CSV with a complete list of UUIDs that define ear-length hairstyles, click here

Mid-back

To download a CSV with a complete list of UUIDs that define hairstyles with lengths that reach the middle of the back, click here

Shoulder

To download a CSV with a complete list of UUIDs that define shoulder-length hairstyles, click here

Tailbone

To download a CSV with a complete list of UUIDs that define tailbone-length hairstyles, click here

Undefined

To download a CSV with a complete list of UUIDs that define hairstyles of variable or unusual lengths, click here

By texture

Curly

To download a CSV with a complete list of UUIDs that define curly hairstyles, click here

Straight

To download a CSV with a complete list of UUIDs that define straight hairstyles, click here

Wavy

To download a CSV with a complete list of UUIDs that define wavy hairstyles, click here

Undefined

To download a CSV with a complete list of UUIDs that define hairstyles with textures that don’t fit neatly into the other categories, click here

Sample usage

A sample id field and its location in the data request

In the JSON hierarchy of the data request, the id field is found here:

{
  "datapoints": [
    {
      "human": {
        "head": {
          "hair": {
            "id": "6ffea888-2bd7-4828-a65f-08996fddc1f4",
          },
        }
      }
    }
  ]
}

This value will generate a balding crew cut appropriate for adult or older males of North European, South Asian, Hispanic, or Mediterranean ethnicity.


color_settings

object

The color_settings object contains a variety of controls that you can use to adjust the color and shine of the actor’s hair.

The color_settings object contains the following fields:

"color_settings": {
  "melanin": //The amount of melanin in the hair, which defines how dark it is
  "redness": //The ratio between pheomelanin and eumelanin, which defines how red it is
  "whiteness": //How much the hair has gone grey or white
  "roughness": //How diffuse light as it reflects off of the hairs, which defines how shiny or dull the hair is
  "index_of_refraction": //How much light rays change direction as they travel through the hairs
},

Sample usage

Location in the data request

In the JSON hierarchy of the data request, the color_settings field is found here:

{
  "datapoints": [
    {
      "human": {
        "id": "101a0478-03e7-4e93-a33d-9bc22f6fdb4b",
        "head": {
          "hair": {
            "color_settings": {

            }
          }
        }
      }
    }
  ]
}

A sample complete color_settings object

"color_settings": {
  "melanin": 0.2,
  "redness": 0,
  "whiteness": 0,
  "roughness": 0.4,
  "index_of_refraction": 1.6
}

These values will generate blond hair.


melanin and redness

floats

The melanin and redness values together define the color of the actor’s hair. Melanin is the amount of black color in the hairs; redness is the amount of red. Both fields can accept floating-point values between 0 and 1:

Hair melanin vs. redness
../../_images/Hair_Melanin_0_Redness_0.png

"melanin"=0 "redness"=0

../../_images/Hair_Melanin_0_Redness_0.25.png

"melanin"=0 "redness"=0.25

../../_images/Hair_Melanin_0_Redness_0.5.png

"melanin"=0 "redness"=0.5

../../_images/Hair_Melanin_0_Redness_0.75.png

"melanin"=0 "redness"=0.75

../../_images/Hair_Melanin_0_Redness_1.png

"melanin"=0 "redness"=1

../../_images/Hair_Melanin_0.25_Redness_0.png

"melanin"=0.25 "redness"=0

../../_images/Hair_Melanin_0.25_Redness_0.25.png

"melanin"=0.25 "redness"=0.25

../../_images/Hair_Melanin_0.25_Redness_0.5.png

"melanin"=0.25 "redness"=0.5

../../_images/Hair_Melanin_0.25_Redness_0.75.png

"melanin"=0.25 "redness"=0.75

../../_images/Hair_Melanin_0.25_Redness_1.png

"melanin"=0.25 "redness"=1

../../_images/Hair_Melanin_0.5_Redness_0.png

"melanin"=0.5 "redness"=0

../../_images/Hair_Melanin_0.5_Redness_0.25.png

"melanin"=0.5 "redness"=0.25

../../_images/Hair_Melanin_0.5_Redness_0.5.png

"melanin"=0.5 "redness"=0.5

../../_images/Hair_Melanin_0.5_Redness_0.75.png

"melanin"=0.5 "redness"=0.75

../../_images/Hair_Melanin_0.5_Redness_1.png

"melanin"=0.5 "redness"=1

../../_images/Hair_Melanin_0.75_Redness_0.png

"melanin"=0.75 "redness"=0

../../_images/Hair_Melanin_0.75_Redness_0.25.png

"melanin"=0.75 "redness"=0.25

../../_images/Hair_Melanin_0.75_Redness_0.5.png

"melanin"=0.75 "redness"=0.5

../../_images/Hair_Melanin_0.75_Redness_0.75.png

"melanin"=0.75 "redness"=0.75

../../_images/Hair_Melanin_0.75_Redness_1.png

"melanin"=0.75 "redness"=1

../../_images/Hair_Melanin_1_Redness_0.png

"melanin"=1 "redness"=0

../../_images/Hair_Melanin_1_Redness_0.25.png

"melanin"=1 "redness"=0.25

../../_images/Hair_Melanin_1_Redness_0.5.png

"melanin"=1 "redness"=0.5

../../_images/Hair_Melanin_1_Redness_0.75.png

"melanin"=1 "redness"=0.75

../../_images/Hair_Melanin_1_Redness_1.png

"melanin"=1 "redness"=1

As you can see in the images above, the relationship between melanin and redness is not linear. The two influence each other greatly. At very high and very low concentrations of melanin, changing the redness has little or no effect. When melanin has medium-level values, the effects of redness are more noticeable.

The values for typical hair colors are at or close to:

Blonde: melanin=0.2, redness=0

Red: melanin=0.5, redness=1

Black: melanin=1, redness=0

Dark brown: melanin=0.8, redness=0.2

Light brown: melanin=0.5, redness=0.6

Sample usage

Sample melanin and redness fields and their location in the data request

In the JSON hierarchy of the data request, the melanin and redness fields are found here:

{
  "datapoints": [
    {
      "human": {
        "head": {
          "hair": {
            "color_settings": {
              "melanin": 0.75,
              "redness": 0.3,
            }
          }
        }
      }
    }
  ]
}

These values will generate dark brown hair that is slightly red.


whiteness

64-bit float

The whiteness field defines how much of the hair has begun to go grey or white. This field accepts floating-point values from 0 (no white hairs) to 1 (fully white).

../../_images/hair_Whiteness_0.png

"whiteness"=0

../../_images/hair_Whiteness_0.25.png

"whiteness"=0.25

../../_images/hair_Whiteness_0.5.png

"whiteness"=0.5

../../_images/hair_Whiteness_0.75.png

whiteness"=0.75

../../_images/hair_Whiteness_1.png

"whiteness"=1

While the increase in grey and white hairs using this field is not strictly linear, it is still useful to think of this value as whitening the hair roughly in percentage terms. As a rule, values between 0.4 and 0.7 generate greying hair, while values above 0.7 generate white hair.

Sample usage

A sample whiteness field and its location in the data request

In the JSON hierarchy of the data request, the whiteness field is found here:

{
  "datapoints": [
    {
      "human": {
        "head": {
          "hair": {
            "color_settings": {
              "whiteness": 0.65,
            }
          }
        }
      }
    }
  ]
}

This value will generate hair that has gone mostly grey and may soon be on the way to white.


roughness

64-bit float

The roughness field affects the reflectivity of the hair. The rougher the surface of the hair, the more light gets absorbed within it and gets reflected as diffuse light rather than mirror-like reflections.

This field accepts floating-point values from 0.15 to 0.5.

../../_images/Hair_Roughness_0.15.png

"roughness"=0.15

../../_images/Hair_Roughness_0.225.png

"roughness"=0.225

../../_images/Hair_Roughness_0.5.png

"roughness"=0.5

Sample usage

A sample roughness field and its location in the data request

In the JSON hierarchy of the data request, the roughness field is found here:

{
  "datapoints": [
    {
      "human": {
        "head": {
          "hair": {
            "color_settings": {
              "roughness": 0.48,
            }
          }
        }
      }
    }
  ]
}

This value will generate hair with a fairly dulled color and no glossiness.


index_of_refraction

64-bit float

The index_of_refraction field affects how the hair bends light that is traveling through it. All hair is at least somewhat translucent, lighter hair in particular. Simulating the changes in the direction of light rays as they travel through the hair is an important part of making hair look realistic.

This field accepts floating-point values from 1.4 to 1.65.

../../_images/Hair_IOR_1.4.png

"index_of_refraction"=1.4

../../_images/Hair_IOR_1.525.png

"index_of_refraction"=1.525

../../_images/Hair_IOR_1.65.png

"index_of_refraction"=1.65

Although the above images may appear to be in different colors, they all have the same amount of melanin; the only change is in how light reflects inside and through the individual hairs.

Sample usage

A sample index_of_refraction field and its location in the data request

In the JSON hierarchy of the data request, the index_of_refraction field is found here:

{
  "datapoints": [
    {
      "human": {
        "head": {
          "hair": {
            "color_settings": {
              "index_of_refraction": 1.5,
            }
          }
        }
      }
    }
  ]
}

This value will generate hair with a low-medium index of refraction.