The Avatar API makes changing Avatar Config simple, regardless if you’re building a web experience or a game in Unity. We partnered with Dinesh Punni from Immersie Insiders to go over the API’s features and using it with Unity.
How to use the Avatar API
All you need to get started with the Avatar API with an avatar ID that ends with the GLB file extension. You can get an avatar URL to your existing avatar from the My Avatars section of the Ready Player Me Hub or by creating it on the demo subdomain. It should look like this: https://api.readyplayer.me/v1/avatars/6185a4acfb622cf1cdc49348.glb
Avatar API allows you to change the Avatar Config by adding parameters to the URL. For example, to change the mesh’s level of detail, you have to add ?meshLod=2
at the end of the link: https://api.readyplayer.me/v1/avatars/6185a4acfb622cf1cdc49348.glb?meshLod=2
.
Currently, you can use the following parameters, with more to come in future releases:
meshLod
– control the triangle count of the returned avatartextureSizeLimit
– set the upper limit for texture resolution in pixels of any texture in the avatartextureAtlas
– generate a texture atlas of the desired resolutionmorphTargets
– comma-separated list of individual morph targets or morph target standard groups to include on the avatarpose
– define the pose for a full-body avataruseDracoMeshComparassion
– reduce the file size by compressing output avatars with Draco mesh compressionuseHands
– toggle hands for half-body VR avatars
You can see a list of all available values in our developer docs.

Getting 2D renders through the Avatar API
By changing the file extension from GLB to PNG, you can export a 2D render of the avatar using the Render API. There are a couple of parameters that let you change the render background and avatar’s expression:
scene
– the name of the portrait type to render (full-body, half-body, transparent, etc.)blendShapes
– map of 3D meshes to their blend shapes (changing avatar’s expression)
See the list of all available values for 2D avatars.
Avatar API also allows you to see the following metadata of an avatar:
bodyType
(full-body or half-body)outfitGender
(masculine or feminine)outfitVersion
(depends on the outfit)skinTone
(provided as a hex value – you can use it for setting the skin tone of custom hands for VR avatars)createdAt
updatedAt
Using the Avatar API with the Unity SDK
If you’re using the Ready Player Me Unity SDK, you can access Avatar API’s features directly through the Unity editor. You can also take advantage of the Scriptable Objects and dynamically change the Avatar Config based on the gameplay. It can be used for things like distance-based rendering of avatars with a variable mesh LOD. You can use one of the default Avatar Configs or create a custom one that fits your needs.
Get started with the Avatar API and Ready Player Me
You have everything that’s needed to get started with the Avatar API. Head to the developer docs for more detailed instructions and to learn more about integrating Ready Player Me avatars into your app or game. You can also read more about Avatar API from the Immersive Insiders team.
We spent seven years building a perfect 3D avatar system, so you don’t have to. Ready Player Me avatars work on the web, mobile, and every platform that support Unity or Unreal Engine.
Join the growing list of over 5,000 Ready Player Me partners who integrate our avatars into their apps and games, including Animaze, Immersed, Spatial, and Hiber.
Ready Player Me is free to use for users and developers. Become a Ready Player Me partner to use our avatars in your commercial app or game.
Article appeared first:Source link