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 jointsA physics component allowing a dynamic connection between rigidbodies, usually allowing some degree of movement such as a hinge. More info
See in Glossary 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.
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 engineA system that simulates aspects of physical systems so that objects can accelerate correctly and be affected by collisions, gravity and other forces. More info
See in Glossary. This is typically used to create the “ragdoll” effect, where a character’s limbs flail after being thrown or struck by an explosion.
Some of these properties also appear on the Mesh RendererA mesh component that takes the geometry from the Mesh Filter and renders it at the position defined by the object’s Transform component. More info
See in Glossary reference page. The following table provides information about the rest of the properties that appear inside the blue box.
Property: | Function: |
---|---|
BlendShapes | Stores the blend shapes defined on this Mesh. |
Rendering Layer Mask | Determine which renderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info See in Glossary layer this renderer lives on. When you use a scriptable render pipeline, you can specify an additional rendering-specific layer maskA value defining which layers to include or exclude from an operation, such as rendering, collision or your own code. More info See in Glossary. 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 skinningThe process of binding bone joints to the vertices of a character’s mesh or ‘skin’. Performed with an external tool, such as Blender or Autodesk Maya. More info See in Glossary 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. |
MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info See in Glossary |
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). |
BoundsThe coordinates that define the bounding volume. Bounds are pre-calculated on import from the Mesh and animations in the model file, and are displayed as a wireframe around the model in the Scene View. See in Glossary |
Set the bounding volumeA closed shape representing the edges and faces of a collider or trigger. More info See in Glossary that Unity uses to determine when the Mesh is offscreen. Unity pre-calculates the bounds when importing the Mesh and animations in the Model fileA file containing a 3D data, which may include definitions for meshes, bones, animation, materials and textures. More info See in Glossary, and displays the bounds as a wireframe around the Model in the Scene viewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info See in Glossary. For more information, see Determining a GameObject’s visibility below. |
Unity uses the Mesh’s Bounds to determine whether or not a GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary is visible. That is, the entire bounding volume must be outside the view of any active CameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary. 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:
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)