-
Notifications
You must be signed in to change notification settings - Fork 14
Avatar Rendering
This section describes how Avatar are structured in unity-explorer, and how we take advantage of a custom Avatar rendering technique for maximum performance.
Each Avatar in unity-explorer is composed by an AvatarBase prefab and as many wearables as the player has equipped.

AvatarBase is the base GameObject prefab that drives the animation. This GameObject consists ono a bone structure and an invisible skinned mesh renderer (for documentation purposes, it has been turned on in the following image). The parent GameObject contains the Animator component, which plays the animation, moving the bones.

'Wearables' are GameObjects that have been instantiated using the assets downloaded from the asset bundle server. These assets are downloaded as skinned mesh renderers, but this makes them non-scalable given Unity's current SMR processing. Therefore, we have to transform them into MeshRenderers (as shown in the image below) and use a custom skinning and rendering technique to achieve maximum performance.

Avatars are rendered using a combination of Unity's Job System, a Compute Shader and the AvatarCelShading shader.

These systems work together to achieve the skinning and rendering of all instantiated avatars present in the Global World. Let's break it down to see more in detail how it works.
Explorer-alpha uses a custom solution of GPU skinning. The skinning operation is divided as follows:

Were part of the math operation is done in CPU, to be later completed in the GPU.
Avatar animation are driven by an AvatarBase