Advanced - Schema preparation

1. Getting a token

Getting a token

2. Creating a schema

You must describe all your types and model IDs in a JSON file. For example, you have 2 types of models - body and hair. The JSON structure will then look like this:

schema.json
{
	"hair" : [ # <- model type
		"hairM_01", "hairF_01" # <- model id
	],
	"body": [
		"body_01", "body_02", "body_03"
	]
}

In this example, 5 models are declared: 2 body IDs and 3 hairstyle IDs.

You can also leave the JSON empty, then when assembled, only the head will be generated.

schema.json
{
}

Note: You can't do nested model types. there are only 2 levels: types and IDs.

Sending your schema.

token="ENTER_YOUR_TOKEN"
schema_path="ENTER_SCHEMA_PATH"

curl -X 'PUT' \
  'https://api.metahumansdk.io/glb_const/schema' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F "token=$token" \
  -F "schema=@$schema_path;type=application/json"

You should get:

{
  "result": {
    "status": "schema loaded successfully"
  }
}

4. Uploading GLB models

You must add all the models declared in the schema.

Sending your GLB file.

Note: To calculate the hash you can use the command sha256sum in the terminal.

Note: If you want the texture with the skin color to be automatically repainted in the color taken from the face, the name of this material should contain "skin". The "baseColorFactor" component of the material is repainted.

token="ENTER_YOUR_TOKEN"
glb_path="ENTER_GLB_PATH"
glb_hash="ENTER_GLB_HASH"
data_type="ENTER_DATA_TYPE"
data_id="ENTER_DATA_ID"

curl -X 'PUT' \
  'https://api.metahumansdk.io/glb_const/glb' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F "token=$token" \
  -F "data=@$glb_path" \
  -F "sha256=$glb_hash" \
  -F "data_type=$data_type" \
  -F "data_id=$data_id"

You should get:

{
  "result": {
    "status": "model loaded successfully"
  }
}

Last updated