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.

Note: The quality of the photo must be a good resolution.

Note: Hair should be clearly visible.

Note: So far, we are unable to work well with ponytails and pigtails.

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

Example rendering

Rendering in Blender

5. Visualization with head

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

GLB Constructor currently supports only hair involume mode

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 'head_uv=@uv.png;type=image/png' \
    -F 'head_config=@head_config.json;type=application/json' \
    -F 'custom_models=@hair.glb;type=image/png' \
    -F 'add_facs=true' > head.glb

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

Result:

Last updated