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
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
To get the full set of eyebrow assets:
from datagen.api import catalog catalog.eyebrows.get()
To get a specific eyebrow asset using its id:
from datagen.api import catalog catalog.eyebrows.get(id="829b0d6e-102a-4bad-8c87-22a0148ed72c")
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)
To get a single eyebrow asset using the limit parameter:
from datagen.api import catalog catalog.eyebrows.get(limit=1)
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)
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()
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)
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.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
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)
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:
- 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:
idproperty 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.
To download a CSV with a complete list of available eyebrow styles, click here
Datagen has dozens of eyebrow textures, labeled by gender:
To download a CSV with a complete list of female eyebrow styles, click here
To download a CSV with a complete list of male eyebrow styles, click here
color_settingsobject 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)
color_settingsobject contains the following properties:
melanin and redness
rednessvalues 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
whitenessproperty 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.
roughnessproperty 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_refractionproperty 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.