ZEGO Avatar
  • iOS : Objective-C
  • Android
  • Overview
  • Client SDKs
  • Demo app
  • Getting started
    • Integrate the SDK
    • Create a virtual avatar
    • ZegoCharacterHelper instructions
  • Guides
  • Best practice
  • Error codes
  • API Documents
  • FAQ

Manual avatar creation

Last updated:2022-06-29 12:12

Overview

The ZegoAvatar SDK provides the manual avatar creation feature. Users can adjust different facial parts (such as the eye size, nose width, and mouth size) of their virtual avatars based on their own aesthetic preferences to build unique virtual avatars for themselves. This feature can be widely used in various game scenarios.

Prerequisites

Before you implement the manual avatar creation feature, ensure that the following conditions are met:

Implementation steps

Refer to the following procedures to implement the manual avatar creation feature. After the basic virtual avatar is created, call the setFaceShape API and introduce the faceshapeID (adjustable facial dimension), value (avatar creation coefficient), and other parameters to set or modify the dimensions of facial parts. For more information about adjustable facial dimensions, see the following table. We also describe all adjustable facial dimensions (faceshapeID) in helper/ZegoCharacterHelper.h.

/** Set the avatar creation coefficient. For the value of faceshapeID, see the following table. Constants defined in ZegoCharacterHelper can be used directly.*/
[_characterHelper setFaceShape:FACESHAPE_BROW_SIZE_Y value:0.3];

Adjustable facial dimensions include:

In the following dimensions, the shape in corresponding face positions (such as the length, thickness, height, size, and angle) varies with the value. That is, a larger value indicates a greater shape change in the corresponding position.

Dimension Description Value range Default value
faceshape_brow_size_y
Eyebrow thickness
0.0 ~ 1.0
0.5
faceshape_brow_size_x
Eyebrow length
0.0 ~ 1.0
0.5
faceshape_brow_all_y
Eyebrow height
0.0 ~ 1.0
0.5
faceshape_brow_all_roll_z
Eyebrow rotation
0.0 ~ 1.0
0.5
faceshape_eye_size
Eye size
0.0 ~ 1.0
0.5
faceshape_eye_roll_y
Eye height
0.0 ~ 1.0
0.5
faceshape_eye_roll_z
Eye rotation
0.0 ~ 1.0
0.5
faceshape_eye_x
Distance between two eyes
0.0 ~ 1.0
0.5
faceshape_nose_all_x
Nose width
0.0 ~ 1.0
0.5
faceshape_nose_all_y
Nose height
0.0 ~ 1.0
0.5
faceshape_nose_all_roll_y
Nose rotation
0.0 ~ 1.0
0.5
faceshape_nostril_roll_y
Nostril rotation
0.0 ~ 1.0
0.5
faceshape_mouth_all_y
Lip height
0.0 ~ 1.0
0.5
faceshape_lip_all_size_y
Lip thickness
0.0 ~ 1.0
0.5
faceshape_lipcorner_y
Mouth corner rotation
0.0 ~ 1.0
0.5
faceshape_lip_upper_size_x
Upper lip width
0.0 ~ 1.0
0.5
faceshape_lip_lower_size_x
Lower lip width
0.0 ~ 1.0
0.5
faceshape_jaw_all_size_x
Chin width
0.0 ~ 1.0
0.5
faceshape_jaw_y
Chin height
0.0 ~ 1.0
0.5
faceshape_cheek_all_size_x
Cheek width
0.0 ~ 1.0
0.5