The ‘Eyebrows’ asset catalog#
!pip install datagen-tech -q
Accessing the catalog#
- class datagen.api.catalog.eyebrows#
The “eyebrows” object gives you access to the catalog of eyebrow assets. The Assets provided by this catalog are of type datagen.api.assets.Hair
.
You can query the eyebrows catalog using these functions:
- datagen.api.catalog.eyebrows.get(self, id: str = None, limit: int = None, **attributes) Union[Asset, List[Asset]]: #
Gets eyebrows assets from the asset catalog.
- Parameters:
id (str) – Optional. Returns a single Asset matching the chosen UUID.
limit (int) –
Optional. Caps the number of Assets that will be included in the response.
If limit=1, returns a single Asset object.
If limit>1, returns an object of type List[Asset] (even if there is only one matching eyebrows asset in the list).
attributes (Any) – Optional. A dictionary of attributes that you can use to filter the catalog. For details see Eyebrow attributes below.
- Returns:
The asset or assets that match your search query
- Return type:
List[Asset] in the form of a lazy list
Asset when limit=1 or when an id is provided
Sample usage
Getting the full set of eyebrows assets:
from datagen.api import catalog catalog.eyebrows.get()
<AssetInstancesList(50)>
Getting a specific eyebrows asset by 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 being the value of the set of attributes.
Using the limit parameter to cap the number of eyebrows assets:
from datagen.api import catalog catalog.eyebrows.get(limit=4)
<AssetInstancesList(4)>
Using the limit parameter to get a single eyebrows asset:
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])
)
Using attributes to filter the catalog:
from datagen.api import catalog from datagen.api.catalog import attributes catalog.eyebrows.get(gender_match=attributes.Gender.FEMALE)
<AssetInstancesList(25)>
- datagen.api.catalog.eyebrows.count(self, **attributes) int: #
Queries the catalog for the number of assets matching a certain request
- Parameters:
attributes (Any) – Optional. A dictionary of attributes that you can use to filter the catalog. For details see Eyebrow attributes below.
- Returns:
The number of assets in the catalog matching your query.
- Return type:
int
Sample usage
Counting the full set of eyebrows assets:
from datagen.api import catalog catalog.eyebrows.count()
50
Using attributes to filter the catalog:
from datagen.api import catalog from datagen.api.catalog import attributes catalog.eyebrows.count(gender_match=attributes.Gender.MALE)
25
Eyebrow attributes#
- 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#
These are the editable properties of eyebrows 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.