How to use a custom avatar with InstantVR

InstantVR comes with a default MakeHuman avatar, but it is easy to replace this by your own custom avatar. In this post I will explain how you can do this and what you can do to get the best experience.With InstantVR you can use any Mecanim avatar with a Humanoid rig. In order to use your own avatar mesh, you can replace the default MakeHuman avatar in the InstantVR game object by your own. The following video shows some examples of this:

Avatar configuration

The primary requirement for an avatar to be used with InstantVR is that it should have a Humanoid Rig animation type. This enables InstantVR to find all the necessary bones. Check the rig as follows:

  • In the prefab, select the ‘Rig’ tab. Ensure the ‘Animation Type’ is set to ‘Humanoid’.
  • Ensure ‘Optimize Game Objects’ is deselected.RigTab4_3

InstantVR requires a number of bones to be mapped correctly. You can check this by clicking the ‘Configure…’ button.

BoneMapping

The following bones need to be mapped correctly.

  • Body: Hips, Spine.
    Note that the ‘Hips’ bone should be mapped to a bone at hip-height. Sometimes this is the root at the ground level, which does not lead to the right pose.
  • Left Arm: Upper Arm, Lower Arm & Hand
  • Right Arm: Upper Arm, Lower Arm & Hand
  • Left Leg: Upper Leg, Lower Leg & Foot
  • Right Leg: Upper Leg, Lower Leg & Foot
  • Head: Neck
  • Version 2.1.1 only: you also need to have mapped the Left Eye and Right Eye or you will get a number of object references not found errors. This will be corrected in version 2.1.2

Inserting the custom avatar

When you have insterted the default InstantVR prefab you will see the following hierarchy in the scene:GameObjects 2_1

You can insert your own avatar by removing the default_simple game object with you own. When you have done this, InstanVR will use the new avatar in the scene.

For the best poses you do need to align a number of targets and bones, because not all rigs are positioned the same with respect to the mesh. You can do this by ensuring that the world position of the target matches the world position of the bone exactly. You need to do this for the following targets:

  • Head Target
  • Hip Target
  • Left Foot Target
  • Right Foot Target

The easiest way to do this by temporarily dragging the target to a child position of the applicable bone in the hierarchy and setting the local position to zero. After this you can drag the target back to its original position as a child of the Targets game object.

Colliders

If you want to have fully interactive custom avatar you will need to add a number of colliders to the hands. I found out that the best experience is achieved by sizing the colliders 1 cm bigger than the mesh and setting the Minimum Penetration for Penalty to 0.01. In this way you fingers will accurately collide with any non-kinematic rigidbody.

To get the correct positions from your avatar you should align the head, hip and foot targets with the corresponding bones in the body as every avatar will has a slightly different bone structure.

When you use the avatar for first-person only you can optimize the mesh considerably. As you will not be able to see your own head and your avatars back, it does not make sense to render or even render those parts. For that reason I have created a first-person avatar which looks like this:

Now we have an avatar that can move, but you will notice that you are not able to pick up objects. This is because the hands do not have colliders. InstantVR is not able to add colliders automatically, so we have to add them manually.

For my avatars I only use Box and Sphere colliders. Capsule colliders seem to be unreliable, especially between the two end spheres, so I try to avoid them where I can. Mesh colliders are not an option either, because of their limited collision support. In the image on the right you can see the collider setup I use for most of my avatars with box colliders for the overall hand structure and sphere colliders at the end of the fingers. This setup ensures that the colliders will also work well when the fingers are curled as you can see in the other figure.HandColliders3 HandColliders4

The colliders should be connected to the following bones:

Finger:
– Proximal
– Distal

Thumb:
– Intermediate

For the fingers, the box colliders need to be attached to the first (proximal) bone. The sphere colliders are attached to the last (distal) bone. Also note that the colliders are larger than the mesh itself. This is to compensate for the Minimal Penetration for Penalty, which I usually set to 0.01. Making the colliders 0.01 larger than the mesh ensures that you can touch objects exactly at the mesh boundaries. Especially with the finger tips, this is very important for immersion.

Finally

That is basically all there is to use your own avatar. I have tried to make it as easy as possible, but it may still be tricky in some cases. So do not hesitate to reply if you are using InstantVR Advanced and still have issues with you avatar!

Tagged with: , ,