The facial hair asset is labeled as “hair” because it uses the same basic structure as a hair object. The only difference between head hair, eyebrow hair, and facial hair is the set of attributes.
To cap the number of returned facial hair assets using the limit parameter:
The datagen.api.catalog.beards.count() function tells you how many facial hair assets match your query. You can count how many facial hair assets there are in total, or filter the catalog using facial hair attributes.
When you get a facial hair object from the catalog, you can edit that object in certain ways. These are the editable properties of facial hair objects:
id
string
The id property defines the shape, styling, and length of the actor’s facial hair, selecting it from our catalog of facial hair types. This property does not define the facial hair’s color or how it reflects light.
Tip
To download a CSV with a complete list of facial hair styles, click here
Our facial hair types are categorized by style:
Beards
To download a CSV with a complete list of the UUIDs that define beards, click here
Full beards
To download a CSV with a complete list of the UUIDs that define full beards, click here
Mustaches
To download a CSV with a complete list of the UUIDs that define mustaches, click here
Partial beards
To download a CSV with a complete list of the UUIDs that define partial beards, click here
Stubble
To download a CSV with a complete list of the UUIDs that define stubble styles, click here
color_settings
The color_settings object contains a variety of settings that determine the color and shine of the actor’s facial hair.
This code takes a facial hair asset from the catalog and changes the default hair color:
The color_settings object contains the following properties:
melanin and redness
64-bit floats
The melanin and redness values together define the color of the actor’s facial hair. Melanin is the amount of black color in the hairs; redness is the amount of red. Both properties can accept floating-point values between 0 and 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:
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
whiteness
64-bit float
The whiteness property defines how much of the hair has begun to go grey or white. This property accepts floating-point values from 0 (no white hairs) to 1 (fully white).
While the increase in grey and white hairs using this property 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 facial hair, while values above 0.7 generate white facial hair.
roughness
64-bit float
The roughness property 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 property accepts floating-point values from 0.15 to 0.5.
The index_of_refraction property 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 property accepts floating-point values from 1.4 to 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.