Avatar Configuration
Apply Avatar API parameters to avatar loading.
Last updated
Apply Avatar API parameters to avatar loading.
Last updated
The Ready Player Me Avatar API allows partners to specify the Avatar Configuration parameters to apply when loading avatars. These configuration parameters can be applied in the Unity Editor Avatar Loader or at runtime.
The SDK provides functionality for loading avatars with specific configurations. For example, you may need a high-quality detailed avatar for showing the model at close range, and a low-quality avatar that will be rendered in a single draw call for other situations. You can set the configuration for each avatar with a custom Avatar Config data asset.
Avatar Configs will only work with the new avatar API URLs. If you have a saved URL in your project, you may need to regenerate the avatar and update the URL in order to use the Avatar Config.
Several Avatar Configuration templates are included in the SDK with recommended settings for high, medium, and low quality avatars. Find the templates at
/Packages/Ready Player Me Core/Runtime/Core/Configurations/
You can click and drag these into the Assets folder to duplicate an AvatarConfig that you can then edit.
Select Assets > Create > Scriptable Objects > Ready Player Me > Avatar Configuration. This creates a new Avatar Configuration asset in the current folder.
Give your Avatar Configuration a name.
Select your Avatar Configuration to open it in the Inspector.
Change the settings according to your requirements.
See the Avatar API 3D Avatars page for details on these options.
Mesh LOD: Choose a level of detail (high, medium for 50%, or low for 25%). An example of this can be found in our MultipleQualityAvatarLoading which can be imported via the Unity Package manager under the Ready Player Me Core section.
Pose: Choose A Pose or T Pose.
Use Hands: Check to include hands with half-body VR avatars.
Texture Atlas: Turn on texture atlassing and choose the atlas size. (With texture atlas enabled avatars will come with 1 single mesh)
Texture Size Limit: Set an upper limit on texture size.
Texture Channel: Define which texture channels to include or exclude
Shader Override: This property can be used to define a custom shader you want the avatar to be loaded with.
The texture channel properties nested under the Shader Override can be used to map the textures to the appropriate shader properties
Use Draco Compression: If enabled, loaded avatars will use Draco mesh compression.
Use Mesh Opt Compression: If enabled, loaded avatars will use Mesh Opt compression.
Morph Targets: List of individual morph targets or morph target standard groups to include on the avatar. Click Add and then select your target from the menu.
If using Mesh Opt Compression you need to ensure that you have the com.unity.meshopt.decompress
plugin imported into your project. Steps to add this package can be found here.
Avatar Configurations can be applied in the Unity Editor Avatar Loader or at runtime.
Open your scene.
Open Ready Player Me > Settings.
Assign an Avatar Configuration to the Avatar Configuration setting.
Open Ready Player Me > Avatar Loader.
Assign your avatar URL.
Click Load Avatar into the Current Sence. The specified avatar with the specified Avatar Configuration is loaded into the current scene.
In your code, create an instance of AvatarObjectLoader
.
[Optional] Load a previously created Avatar Configuration asset or instantiate a new Avatar Configuration
scriptable object and set its parameters.
[Optional] Assign the Avatar Configuration to the AvatarConfig
property of the AvatarObjectLoader
instance.
Call the LoadAvatar()
method on the AvatarLoader
instance, passing a valid avatar URL.
The Avatar Configuration assigned to the URL will be applied to the loaded avatar.
If no Avatar Configuration is assigned to an AvatarObjectLoader
instance, the Avatar Configuration selected in the Ready Player Me Settings window is applied.
Find example usage of Avatar Configurations in the SDK Runtime Examples at
Assets\Samples\Ready Player Me Core\[VERSION_NUMBER]\
AvatarLoadingSamples\
.
See also More Examples.