How it works
Here you will learn how the ReadyPlayerMe Unreal plugin works

Requirements

  • The Plugin supports Unreal Engine 4.25, 4.26 and 4.27
  • A valid avatar URL was created from Ready Player Me to import an avatar to an Unreal scene.
Included in our zip file is a free third party plugin called glTFRuntime, which is required for importing glTF files and that only supports Engine versions 4.25,4.26 and 4.27
The Ready Player Me Unreal Engine plugin comes with two pre-made blueprints BP_RPM_Component and BP_RPM_Actor. These blueprints are examples of loading a Ready Player Me avatar from a URL at Runtime and spawning it into the map. To get started, let's take a look at the most simple way to add avatars into your application using the Ready Player Me Actor Component

Ready Player Me Actor Component

The Ready Player Me actor component can be added to any actor blueprint and has the functionality required to load our Ready Player Me Avatars into the map at Runtime.
You can find an example of this in the Unreal Editor Content Browser at ReadyPlayerMe Content/Blueprints/BP_RPM_Component.
If you open up the example BP_RPM_Component blueprint, or add the component to an existing actor blueprint, you should see it show up in the Components hierarchy like this.
Then you can select this component and inspect the editable variables on the Details panel, as shown below.
Here you will see some important properties. For starters, there is a Url Shortcode property. This is where you need to set the URL (or shortcode) to the Ready Player Me Avatar GLB file. This can be set either inside the editor or at Runtime.
If the URL Shortcode property is not set, the avatar loading will fail.
Next, we have the Anim Blueprint property. By default, it is set to our example animation blueprint BP_RPM_Animation but feel free to update this property as required. If nothing is set here, no blueprint will be assigned, and the avatar won't animate.
Lastly, we have the Target Skeleton. This property also needs to be set to a skeleton in the Unreal Project that matches the skeleton of the avatar model you are loading. By default, we set this to RPM_Mixamo_Skeleton.
If you want to create or use your target skeleton, be aware that it needs to perfectly match the skeleton that you are loading from the URL. It is not recommended that you change this property.
Now that you understand the editable properties of the component, let's take a look at the Event Graph.
As you can see example is quite simple, with only a RunAvatarSetup function. As the name suggests, it handles the loading and setup of a Ready Me Avatar. When this function is called, it does a number of things in the background like:
  • Make a web request to load the avatar metadata and then the avatar model (GLB file)
  • It loads the mesh, material, and texture data into the SkeletalMesh component on this actor
  • Assigns the target skeleton and animation blueprint (if set)
There is also an OnSetupFailed delegate function that you can use to display messages if RunAvatarSetup fails to complete.

Ready Player Me Actor Blueprint

To get an understanding of how you can load a Ready Player Me avatar at Runtime, let's take a look at the BP_ReadyPlayerMeActor blueprint event graph. You can find this blueprint in the Content Browser under ReadyPlayerMe Content/Blueprints/.

Local Variables

Before jumping into the blueprint nodes, there are a couple of important local variables.
SkeletalMeshComponent
Once the Ready Player Me mesh is loaded, it is stored in this skeletal mesh component.

UrlShortcode

This is a public string that should contain the generated Ready Player Me URL or shortcode. It is public so that it can be easily editable.

AnimBlueprintInstance

This stores a reference to the preconfigured animation blueprint and is used to set up and play animations on the loaded model. This is also public so that it can be changed.
AvatarMetaData
This holds information about the type of avatar it is and is required during the loading and skeletal mesh setup process.

URL / Shortcode validation

Loading an avatar into our demo scene is great, but most likely, you will want to know how it all works and, more importantly, how you can implement it into your games and other applications. To get started, let's open up the BP_ReadyPlayerMeActor blueprint. Firstly, let's look at the first group of nodes connected to the BeginPlay node, as shown below.
As you can see, on BeginPlay, we call the function RPM Validate Url ShortCode. As the name suggests, this tries to validate the Url or shortcode provided by the local Url variable. It then returns the validated Url. If it returns an empty string, it means that the Url or shortcode is not valid. For this reason, we have added this Branch node here to prevent attempts to load from invalid URLs. If the validation is successful, we update the local UrlShortcode variable before jumping to the next group of nodes.
Shortcodes are a feature that can be configured for a specific Ready Player Me partner domain. If this feature is enabled, it will return a code (6-8 Digit code) using only numbers and letters. You can learn more about this feature here.

Load Avatar Metadata

Once we have validated the URL, we can load the Ready Player Me Metadata, as you can see below.
Next, we run the RPM Load Avatar Meta Data, which will return the Avatar Metadata and return an Avatar Metadata object that we need to set up our avatar later properly. You can see we also update the Avatar Meta Data here using the SET node.
When an avatar is generated from our Ready Player Me web platform, it generates two files. One GLB file contains the 3D model and all its required data, but also a .json file that contains data about what type of avatar it is, for example, the avatar type (full-body or half-body) and the body type (masculine, feminine).

Load Avatar Data from the Web

The next group of nodes is quite self-explanatory. It gets the appropriate config structure, the validated Url, and then calls the glTFRuntime Load Asset from the URL function, as you can see below.
NE
You'll notice in the glTF Load Asset from Url node there is a callback event called Completed. It returns a glTFRuntimeAsset, and we will use this in the next step for loading the skeletal mesh.
It's worth noting that while glTF Load Asset From Url loads the asset, it does not spawn it in the scene. It simply loads the data from the URL and stores it in a format we can then use.

Load to a Skeletal Mesh

Using the OnAssetLoaded node above (connected to the Completed callback event we mentioned), we can begin loading the skeletal mesh from the glTFRuntime asset, which holds all the avatar model data.
First, we use the Get glTFRuntime Skeletal Mesh Config to get the required config information and as the Root Bone name. We also need to pass in the Avatar Meta Data and select the desired target skeleton here.
We connect the outputs into the Load Skeletal Mesh node, which will generate a Skeletal mesh object and return it via the Async Callback event.
It is important that the Skeletal Mesh Config settings and Node Name are correct; otherwise, there will be issues with animation retargeting. That is why we include this custom Get glTFRuntime Skeletal Mesh Config helper function.

Setup Skeletal Mesh On Actor

After the skeletal mesh has been loaded, we can begin to set up the actor, as shown below:
The OnSkeletalMeshLoaded returns a skeletal mesh object that we can connect to our RPM Setup Skeleton helper function. We also need to connect in our Avatar Meta Data and Anim Blueprint Instance to ensure the skeleton gets set up correctly so that animations can be applied.
Since we don't connect anything to the Target input in RPM Setup Skeleton, it will default to itself. However, if you are spawning a separate actor for this, you can assign it here.
Once this function is complete, it will return a reference to the newly created skeletal mesh component, and then we assign it to this actors' Skeletal Mesh Component with the SET node.

Set Face Morphs

Finally, we have an optional set of nodes to show how you can set Avatar Morph targets. We create a map of morph targets and run the helper function RPM Set Avatar Morph Targets to apply them to the connected Skeletal Mesh component.
For anybody with experience using other 3D software or game engines, morph targets are also commonly referred to as blendshapes
If you want to see exactly what our RPM helper functions do. you can find the C++ class files in [PROJECT_NAME/Plugins/ReadyPlayerMe/Source/ReadyPlayerMe/Private.

Have issues gettings started?

If you are having issues getting started or have some further questions, you can refer to our FAQ or Troubleshooting pages linked below. Alternatively, you can contact support by emailing [email protected]
Last modified 16d ago