Draft - Tutorials - Custom Avatars from .fbx

## Steps

1. Bring avatar into unity
2. Add animator Change animation type to Humanoid
3. dd APS-SDK directly next to animator
4. Build avatar

## Introduction

The idea behind APS is to use custom avatars so that the avatar is used throughout the entire workflow and avoids needing to retarget at any point. But you can regarget if you'd like - it just may cause undesired offsets (as with any retargeting).

The **AvatarBuilder** is legacy. It would be more preferred to use the .fbx directly in Unity and add the APS\_SDK and press Build Avatar From .fbx

The APS\_SDK can be used to create custom mocap avatars from mixamo, cc3, vrchat and other compatible rigs.

You could use the APSSDK to build the avatar in Unity (similar to vrchat sdk). Here are some tutorials showing how to use the sdk:

* VRChat (and other .fbx) avatars: https://youtu.be/oEwkhIr4ffw
* Mixamo avatars: https://youtu.be/ykJ7O0Bs8oQ

There's no default armature, the sdk relys on the Unity humanoid setup, so as long as the avatar is compatible with Unity Mechanim then it should work. Most skeletons are compatible, if the skeleton meets the minimum requirements for the Unity humanoid setup.

There are two ways to import avatars, if your rig is Mixamo, makehuman, CC3 or rigify you can simply use the APS auto avatar importer to import from the .blend directly. If you rig uses other naming convention then you will have to export it from the .blend to a .fbx and open that in Unity, make sure the humanoid config is setup and in tpose, then add the APS\_SDK component and press "build the avatar manually". If the build was successful then the assetfolder should appear which you just move to the game folder.

Start a new Unity project, import the APS\_SDK.unitypackage to the Unity project and change its type to Humanoid (ensure the Mecanim humanoid has no errors!!), add the APS\_SDK component to the avatar's animator and press build avatar from .fbx, after it has completed you can then add and the eye ref target for better HMD alignment, add materials and textures is you'd like, then press build avatar again to save changes, finally copy/paste the generated myAvatar$avatar folder into the VR\_MocapAssets folder in the Luxor appdata folder %USERPROFILE%\AppData\LocalLow\Animation Prep Studios\LUXOR\VR\_MocapAssets\ to make it available in Luxor's avatar browser.

Check out this video showing how to export mocap data from APS and then build the scene in Blender using the SceneLoader.blend, then export from Blender SceneLoader to Unity project as a .fbx: https://www.youtube.com/watch?v=SyFvBqTX6RA

Using Blender Sceneloader.blend to auto-load the mocap and retarget the mocap avatar then allows the user to simplify the animation data (using https://youtu.be/z5vBfCU6uOs?t=53) prior to exporting the .fbx to Unity

Tutorial for building a custom avatar from a .fbx (starts at 2:35)

## Quick steps

When exporting a model from Blender as .fbx it should have had the armature's transforms (loc, rot, scale) reset, as well as any pose offsets from all pose bones (clear pose) of the armature (which is identical to a restpose). And the .fbx should be exported without any animations or keyframes.

Do you know any unity? If you do, you can just import your model and set up it's materials and textures as needed, then select it in the outliner and in it's inspector, you can go add the aps\_sdk component and click build avatar.

It'll then load for a bit and make a garbled mess of your avatar's name in the viewport. Leave that as is. Go back to the avatar's inspector and see that there's this new component under the aps sdk one now.

If your model was set to humanoid it should have filled the slots in automatically. At that point you're already half way done. All you need now is to set up either visemes or facecapture blendshapes by adding a new component and searching for viseme or facecap linker. I'm not familiar with the viseme one because i haven't had a use for it yet, but it should be straight forward enough.

For the facecap one just click the single button that's on it and it should try to automatically find your blendshapes. It might miss a few based on if you named them \_L and \_R or Left and Right though. It's kind of annoying. After you've finished setting that up just press Re-Build avatar and after it loads it'll open a new window in your explorer with a folder that has the same garbled mess as the name.

Take the entire folder and copy and paste it into your Luxor folders. If you're not sure which folder that is, run Luxor and press the "open in explorer"or "open folder" or something button at the bottom of the avatar window. That'll open it in explorer for you to paste the newly built avatar folder into.

## Mixamo avatars

You could also try using http://www.mixamo.com/ to convert the model to a mixamo character, then it would be possible to use the auto avatar importer to create the avatar: https://youtu.be/ykJ7O0Bs8oQ

## More setup notes

Try checking the Unity humanoid setup to ensure the arms have been properly mapped, there's a button that becomes visible after pressing play in the Unity editor that can be used to verify the mechanim tpose for the avatar after building it. Could you please try pressing play in the Unity editor to ensure the avatar animation looks correct ( https://youtu.be/oEwkhIr4ffw?t=169 )

While the editor is playing there should be a new button visible on the avatar's APS\_SDK component named Set Animator TPose which can be used to verify the avatar in the actual mecanim tpose (the avatar should be facing forward along Z with feet planted on the ground):

## About bone orientation

"Do you know of a way to visualize bone groups in unity? I am having trouble with moving some 'hair' wings from rooting from head to upper back. Can't identify the right group to transfer the bone weight"

I sometimes add a arrows mesh object directly to each bone in the chain. I think it makes it easier to visualize both the position and rotation of each bone:

https://discord.com/channels/738881083256471703/738882482593857638/826823396738072646

## Notes about texture/image processing

"Another unexpected plus is that your importer does a much cleaner job than the unity importer microsoft created (movebox studio) which creates some odd transparencies with the hair on the avatars. with your script though i'm not seeing any of those issues which is great!"

The AvatarBuilder actually does some image processing when it imports the avatar. It tries to optimize the textures a little for better performance in game engines by limiting the resolution of each texture to 1024x1024 and applies AA to the result. It also combines separate opacity maps and diffuse maps together resulting in texture with the combined color/alpha channels.

## About blendshapes

Blendshapes can be mapped in the APSSDK but are optional. Face rig bones would be ignored by Unity and APS. Same with hair, ears, tail and clothing bones would be ignored - unless they have dynamicbone components added.

The main requirement for building an avatar using the APS\_SDK is that the avatar be compatible with Unity's mechanim tpose setup (similar to VRChat requirements):

## Using jaw bone instead of blendshapes

"To get the character's mouth to move when talking, using the jaw bone instead of blendshapes, do i need to add any components to the avatar, or should it work just with the armature linker?"

Jaw flapping should work if the jaw bone was assigned in the Unity humanoid setup

## About avatarts with extra limbs

"Is it possible to use character who has 4 arms (with rig)?"

Not directly in APS, but you might be able to build a avatar that has extra limbs as a mocap avatar using the APS\_SDK (but mapping only the default two upper arms like normal humanoid). Then record mocap in APS, export it to blender, and once imported in Blender you could add IK constraints to the additional arms and either hand animate them or use a track to constraint to make the IK targets of the auxiliary arms follow the primary hand bones of the main arms (or add weighting so they are interpolated slightly).

## About armature compatibility with Unity

Make sure your avatar's armature(bones), have all the mandatory bones to be usable, it the armature is not compatible with Mecanim humanoids the you will run into issues, check the following link for more info:

https://blog.unity.com/technology/mecanim-humanoids

## About avatar height variations

"So in LUXOR.. not sure how to word this. Is the height of the avatar determined by it's height in unity or will every model resize itself to your height. Like if I wanna do an animation with 2 very different models, will I actually be shorter than the other model in LUXOR or will it resize myself to be the same height."

Traditionally the avatar was always calibrated to the player's height, but new options have just been added in v3.8.1 to allow calibrating the player's height to the avatar's height, this can be used to preserve the height of short (chibi) avatars when calibrating tpose.

- When building avatars in the APSSDK you can enable the "Keep Avatar Scale" checkbox for chibi avatars to retain their height after calibrating tpose (#1)

- Or, in Luxor you can press Reset Avatar Scale (#2) or manually adjust the scale to a desired height, then by pressing both menu buttons + both triggers at the same time to calibrate the player to the avatar's height (#3).

## Blender tips

And if you have a custom rig you'd want to use in blender here is a video that may help with copying over APS animation to your rig.
https://youtu.be/wYrz0U4RApk

And last if you have extra cash to spare I HIGHLY reccomend Auto Rig Pro this addon i've been using it myself and actually does a fantastic job of transferring animation data and has a very clean rig setup. https://www.youtube.com/watch?v=0GKPCn-JQ4k

## About viewpoint target helper

This feature was just added to the APS\_SDK. User's can now specify the viewpoint target when building avatars (which sets the default HMD alignment). Thanks!

## More about imports

When adding a .fbx into a Unity project check that the animation type is set to Humanoid and press apply. After pressing apply be sure to click on Configure and check that the bone mappings are reasonable.

Not all rigs are 100% Unity compatible and sometimes Unity skips or chooses the incorrect bones.