3D Hair Reconstruction

Reconstructs 3D hair from a photo of a person.

1. Getting a token

Getting a token

2. Choice of photo

Choose a photo of a person.

Need a successful image? Download a sample

3. Reconstruct 3D Hair

Make a request by sending your chosen photo. Make sure you are using the mode you really need. 'card' mode is used by default.

token="ENTER_YOUR_TOKEN"
image_path="ENTER_IMAGE_PATH"

curl -X 'POST' \
  'https://api.metahumansdk.io/hair_recon/run_pipeline' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F "token=$token" \
  -F "image_bytes=@$image_path;type=image/png" > hair.glb \
  -F 'mode=card'

The expected result is the hair.glb file.

4. Check GLB model

Check saved file in GLB viewer (for example in Blender).

Examples of results

Open in Blender

Original photo
Reconstructed hair mesh in card mode
Reconstructed hair mesh in volume mode

Example rendering

Rendering in Blender

Rendered hair mesh in card mode
Rendered hair mesh in volume mode

5. Visualization with head

In order to get a 3D model of the head with hair, we will use GLB Constructor:

At this step it is assumed that you have already received uv.png and head_config.jsonfrom 3D Face Reconstruction tab.

token="ENTER_YOUR_TOKEN"

curl -X 'POST' 'https://api.metahumansdk.io/glb_const/assemble' \
    -H 'accept: application/json' \
    -H 'Content-Type: multipart/form-data' \
    -F "token=$token" \
    -F '[email protected];type=image/png' \
    -F 'head_config=@head_config.json;type=application/json' \
    -F '[email protected];type=image/png' \
    -F 'add_facs=true' > head.glb

After the completed stages, you get a glb model head.glb .

Result:

image.png
head.glb

Last updated