ADR-0012 Metail Scanatar Creation

Publication Date2021-05-17
Last Update2021-05-17


The scanatars created by the QuantaCorp Body Model Service are post-processed by a Metail pipeline that performs clean-up of the scan, landmark detection, mesh fitting, and skeleton fitting. The output from the Metail pipeline is a Unity-compatible avatar that can be used in eTryOn applications. We would like the Metail pipeline to run every time a new QuantaCorp scanatar is uploaded to Cloud Storage.


Metail will implement an AWS Step Function to run the Metail pipeline.

This step function will:

  • Read additional parameters (such as gender and height) from its invocation parameters;
  • Read the QuantaCorp scan from Cloud Storage using a pre-signed URL;
  • Run the Metail Scanatar Pipeline on this input;
  • Write the finished scanatar to Cloud Storage using a pre-signed URL.

We will create an eTryOn service user in the Metail AWS IAM account and grant this user permissions to invoke the step function.

We will generate access keys for the AWS service user and store them in Google Secret Manager so they are available to services running in the eTryOn Google Cloud project.

We will implement a Google Cloud Function and configure a trigger to invoke this function whenever a QuantaCorp scanatar is written to Cloud Storage. This cloud function will:

  • Create a record in Cloud Firestore to track the pending avatar creation;
  • Create pre-signed Cloud Storage URLs for the input (QuantaCorp scanatar) and output (Unity-compatible avatar);
  • Read the configured AWS keys from Secret Manager;
  • Invoke the Metail Step Function and pass the pre-signed input/output URLs and additional metadata (such as the user’s height and gender) as parameters.

We will implement another Google Cloud Function to be triggered when the finished avatar is written to Cloud Storage. This function will update the Cloud Firestore record to update the status of the new avatar.


Providing Metail AWS credentials to eTryOn middleware functions enables them to call AWS APIs directly.

Using pre-signed URLs for input and output avoids us having to share credentials in the opposite direction.

Tracking scanatar creation status in Cloud Firestore allows client applications to show jobs in progress and be notified when the status changes.

We will have to ensure the pre-signed URLs have a long enough expiry for the Metail pipeline to complete and write its output back to Cloud Storage.

We will need a mechanism to signal an error if the Metail Pipeline cannot process the input QuantaCorp scanatar.