Version: 2020.1
Mesh Renderer
Text Mesh

Skinned Mesh Renderer

Unity uses the Skinned Mesh Renderer component to render Bone animations, where the shape of the Mesh is deformed by the animated bones. This technique is useful for characters and other objects whose joints bend (as opposed to a machine where joints are more like hinges).

Bones are invisible objects inside a skinned Mesh that affect the way the Mesh is deformed during animation. Bones are joined together to form a hierarchical “skeleton”, and rotating the joints of the skeleton to make it move defines the animation. Each bone is attached to some of the vertices of the surrounding Mesh. When you play the animation, the vertices move with the bone or bones they are connected to, so the “skin” follows the movement of the skeleton. At a simple joint (for example, an elbow), the Mesh vertices are affected by both of the bones that meet there, and the Mesh stretches and rotates realistically as the joint bends. In more complex situations, more than two bones affect a particular area of the Mesh, resulting in more subtle movements.

Unity automatically adds a Skinned Mesh Renderer component to any Mesh that needs it at import time.
Unity automatically adds a Skinned Mesh Renderer component to any Mesh that needs it at import time.

Although a skinned Mesh is most commonly used with animations, you can also attach Rigidbody components to each bone in a skeleton to put it under the control of the Physics engine. This is typically used to create the “ragdoll” effect, where a character’s limbs flail after being thrown or struck by an explosion.

Propiedades

Some of these properties also appear on the Mesh Renderer reference page. The following table provides information about the rest of the properties that appear inside the blue box.

Property: Función:
BlendShapes Stores the blend shapes defined on this Mesh.
Rendering Layer Mask Determine which rendering layer this renderer lives on. When you use a scriptable render pipeline, you can specify an additional rendering-specific layer mask. This filters the renderers based on the mask the renderer has and the mask passed to the DrawRenderers command.
Renderer Priority Sort renderers by priority. Lower values are rendered first and higher values are rendered last.
Quality Define the maximum number of bones used per vertex while skinning. The higher the number of bones, the higher the quality of the Renderer.

Unity can skin every vertex with any number of bones from one to 32, although more than four bones reduces performance. The more bones you use, the better results you get, but each extra bone comes with a higher processing overhead.
    Auto Use the Blend Weights Quality setting.

Note: If you imported a custom number of Skin Weights and you want to allow more than four bones of influence, you must choose this option and make sure Blend Weights is set to Unlimited.
    1 Bone Use only one bone to influence each vertex.
    2 Bones Use up to two bones per vertex. This is a common setting for games, because it is a good compromise between visual quality and performance.
    4 Bones Use up to four bones per vertex. If you need to allow more than four bones to influence a single vertex, use the Blend Weights Quality setting.
Update When Offscreen Enable this option to calculate the bounding volume at every frame even when it is not visible by any Camera. Disable this option to stop running the animations when the GameObject is off-screen.

By default, Unity does not update any skinned Meshes that are not visible to any Camera. When the Mesh comes back on screen, Unity updates the skinning again. This saves system resources. For more information, see Determining a GameObject’s visibility below.
Skinned Motion Vectors Enable this option to double-buffer the Mesh skinning data, so Unity can interpolate the skinned motion and place it into the motion vector Texture. This uses more GPU memory, but leads to more correct motion vectors.
Mesh Set the Mesh (skin) used by this Renderer.
Root Bone Set the bone that is the “root” of the animation (that is, the bone relative to which all the others move).
Bounds Set the bounding volume that Unity uses to determine when the Mesh is offscreen. Unity pre-calculates the bounds when importing the Mesh and animations in the Model file, and displays the bounds as a wireframe around the Model in the Scene view. For more information, see Determining a GameObject’s visibility below.

Determining a GameObject’s visibility

Unity uses the Mesh’s Bounds to determine whether or not a GameObject is visible. That is, the entire bounding volume must be outside the view of any active Camera. However, the true bounding volume of an animated Mesh can change as the animation plays (for example, the bounding volume gets taller if the character raises their hand in the air). Unity takes all attached animations into account when it calculates the maximum bounding volume, but there are cases when the bounds can’t be calculated to anticipate every possible use case.

Each of the following example situations can be a problem when Unity pushes bones or vertices out of the pre-calculated bounding volume:

  • Animations added at run-time
  • Additive animations
  • Procedurally changing the positions of bones from a script
  • Using vertex Shaders which can push vertices outside the pre-calculated bounds
  • Using ragdolls

In those cases, you can try either of these solutions to fix the problem:

  • Modify the bounds to match the potential bounding volume of your Mesh.

    Use this option if possible, because it is better for performance.

  • Enable Update When Offscreen to skin and render the skinned Mesh all the time.

    Use this option if performance is not a major concern, or if you can’t predict the size of your bounding volume (for example, when using ragdolls).

In order to make Skinned Meshes work better with ragdolls, Unity automatically remaps the Skinned Mesh Renderer to the root bone on import. However Unity only does this if there is a single Skinned Mesh Renderer in the model file. Turn off this optimization if you use ragdolls, and you can’t attach all Skinned Mesh Renderers to the root bone or a child.


  • 2019–05–31 Page amended

  • Updated to include Skin Weights (2019.1)

Mesh Renderer
Text Mesh