Accessing the ‘eyebrows’ asset catalog#
You can access the catalog of eyebrow assets using the datagen.api.catalog.eyebrows
class. It contains two important functions:
!pip install datagen-tech -q
get()#
The datagen.api.catalog.eyebrows.get()
function gets one or more eyebrow assets from the asset catalog. These assets come in the form of objects of the datagen.api.assets.Hair
class.
To get the full set of eyebrow assets:
from datagen.api import catalog
catalog.eyebrows.get()
<AssetInstancesList(50)>
To get a specific eyebrow asset using its id:
from datagen.api import catalog
catalog.eyebrows.get(id="829b0d6e-102a-4bad-8c87-22a0148ed72c")
Hair(
id=’829b0d6e-102a-4bad-8c87-22a0148ed72c’,
color_settings=HairColor(
melanin=0.2,
redness=0.2,
whiteness=0.25,
roughness=0.15,
index_of_refraction=1.4
),
attributes=EyebrowsAttributes(gender_match=[Gender.MALE])
)
Note that the eyebrows object 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 eyebrow assets using the limit parameter:
from datagen.api import catalog
catalog.eyebrows.get(limit=4)
<AssetInstancesList(4)>
To get a single eyebrow asset using the limit parameter:
from datagen.api import catalog
catalog.eyebrows.get(limit=1)
Hair(
id=’04360bda-2169-4a5b-8b79-53198280f7a1’,
color_settings=HairColor(
melanin=0.2,
redness=0.2,
whiteness=0.25,
roughness=0.15,
index_of_refraction=1.4
),
attributes=EyebrowsAttributes(gender_match=[Gender.MALE])
)
To filter the eyebrow assets using the attributes parameter (see below for the list of valid eyebrow attributes):
from datagen.api import catalog
from datagen.api.catalog import attributes
catalog.eyebrows.get(gender_match=attributes.Gender.FEMALE)
<AssetInstancesList(25)>
count()#
The datagen.api.catalog.eyebrows.count()
function tells you how many eyebrow assets match your query. You can count how many eyebrow assets there are in total, or filter the catalog using eyebrow attributes.
To count the full set of eyebrow assets:
from datagen.api import catalog
catalog.eyebrows.count()
50
To count the number of eyebrow assets that match certain attributes (see below for the list of valid eyebrow attributes):
from datagen.api import catalog
from datagen.api.catalog import attributes
catalog.eyebrows.count(gender_match=attributes.Gender.MALE)
25
Eyebrow attributes#
The datagen.api.catalog.attributes.EyebrowsAttributes
class defines which attributes can be used to filter the catalog of eyebrow assets:
- class datagen.api.catalog.attributes.EyebrowsAttributes
Each eyebrows asset contains the following read-only attribute.
When you call the
datagen.api.catalog.eyebrows.get()
ordatagen.api.catalog.eyebrows.count()
functions, you can use this attribute to filter the catalog.- gender_match: List[Enum]
Matches the requested eyebrows(s) with a desired gender. Uses the
Gender
enum.An eyebrows asset may match with either or both genders.
NOTE: Gender group matches are recommendations only and are not mandatory.
Sample usage:
from datagen.api import catalog from datagen.api.catalog import attributes catalog.eyebrows.get(gender_match=attributes.Gender.FEMALE)<AssetInstancesList(25)>
Here is the complete list of valid values for this attribute:
- class datagen.api.catalog.attributes.Gender
The list of available genders.
This enum is valid for use in the following attributes:
Values:
- FEMALE = 'female'
- MALE = 'male'
Properties of eyebrows objects#
When you get an eyebrow object from the catalog, you can edit that object in certain ways. These are the editable properties of eyebrow objects:
id
string
The
id
property selects a specific pair of eyebrows from our catalog of eyebrow styles.The unique identifier (UUID) that you enter into this property defines the shape of the eyebrows but not their color or behavior in the light.
Tip
To download a CSV with a complete list of available eyebrow styles, click here
Datagen has dozens of eyebrow textures, labeled by gender:
Female
To download a CSV with a complete list of female eyebrow styles, click here
Male
To download a CSV with a complete list of male eyebrow styles, click here
color_settings
The
color_settings
object contains a variety of settings that determine the color and shine of the actor’s eyebrows.This code takes a eyebrows asset from the catalog and changes the default eyebrows color:
from datagen.api import catalog from datagen.api import assets eyebrows=catalog.eyebrows.get(limit=1) eyebrows.color_settings=assets.HairColor(melanin=0.9, redness=0.7, whiteness=0.04, roughness=0.23, index_of_refraction=1.6)The
color_settings
object contains the following properties:melanin and redness
64-bit floats
The
melanin
andredness
values together define the color of the actor’s eyebrows. 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 eyebrows, while values above 0.7 generate white eyebrows.
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.
index_of_refraction
64-bit float
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 hair in the above images may appear to be of slightly different colors, they all have the same amount of melanin; the only change is in how light reflects inside and through the individual hairs.