Version: 2018.3 (switch to 2019.1 )
Mesh Renderer
Text Mesh
Other Versions

Skinned Mesh Renderer

Switch to Scripting

Unity uses the Skinned Mesh Renderer component to render Bone animations, where the shape of the Mesh is deformed by predefined animation sequences. 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).

A Skinned 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
is automatically added to any Mesh that needs it at import time.

Properties

Property: Function:
Cast Shadows If enabled, the Mesh will cast shadows when a suitable Light shines on it.
Receive Shadows If enabled, the Mesh will show shadows that are cast upon it by other objects.
Motion Vectors If enabled, the line has motion vectors rendered into the 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
motion vector Texture. See Renderer.motionVectors in the Scripting API reference documentation to learn more.
MaterialsAn asset that defines how a surface should be rendered, by including references to the Textures it uses, tiling information, Color tints and more. The available options for a Material depend on which Shader the Material is using. More info
See in Glossary
The list of Materials the Mesh will be rendered with.
Light ProbesLight probes store information about how light passes through space in your scene. A collection of light probes arranged within a given space can improve lighting on moving objects and static LOD scenery within that space. More info
See in Glossary
Probe-based lighting interpolationThe estimation of values that determine the shape of an animation curve between two keys. More info
See in Glossary
mode.
Reflection ProbesA rendering component that captures a spherical view of its surroundings in all directions, rather like a camera. The captured image is then stored as a Cubemap that can be used by objects with reflective materials. More info
See in Glossary
If enabled, and if Reflection Probes are present in the sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
, a reflection Texture will be picked for this 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
and set as a built-in ShaderA small script that contains the mathematical calculations and algorithms for calculating the Color of each pixel rendered, based on the lighting input and the Material configuration. More info
See in Glossary
uniform variable.
Anchor Override A Transform used to determine the interpolation position when the Light Probe or Reflection Probe systems are used.
Quality Define the maximum number of bones used per vertex while 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
. The higher the number of bones, the higher the quality of the Renderer. Set the Quality to Auto to use the Blend Weights value from the settings on the Quality window.
Skinned Motion Vectors If enabled, the Mesh skinning data will be double buffered so that skinned motion can be interpolated and placed into the motion vector Texture. This has a GPU memory overhead, but leads to more correct motion vectors.
Update When Offscreen If enabled, the Skinned Mesh will be updated even when it can’t be seen by any Camera. If disabled, the animations themselves will also stop running when the GameObject is off-screen.
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
Use this to define the Mesh used by this Renderer.
Root Bone Use this to define 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
The bounding volumeA closed shape representing the edges and faces of a collider or trigger. More info
See in Glossary
that is used to determine when the Mesh is offscreen. The bounds are pre-calculated on import from 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 are displayed 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
.

Details

Bones are invisible objects inside a skinned Mesh that affect the way the Mesh is deformed during animation. The basic idea is that the bones are joined together to form a hierarchical “skeleton”, and the animation is defined by rotating the joints of the skeleton to make it move. Each bone is attached to some of the vertices of the surrounding Mesh. When the animation is played, 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 will stretch and rotate realistically as the joint bends. In more complex situations, more than two bones will affect a particular area of the Mesh, resulting in more subtle movements.

Although a skinned Mesh is most commonly used with predefined animations, it is also possible to 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.

Quality

Unity can skin every vertex with one, two or four bones. Using four bones gives the best results but this comes with a higher processing overhead. Games commonly use two bone weights, which is a good compromise between visual quality and performance.

If the Quality is set to Auto, Unity uses the Blend Weights value from the settings on the Quality window. This allows end-users to choose the quality setting themselves and get the desired balance of animation quality and framerate.

Update When Offscreen

By default, skinned Meshes that are not visible to any camera are not updated. The skinning is not updated until the Mesh comes back on screen. This is done to save system resources.

The object’s visibility is determined from the Mesh’s Bounds (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 will get taller if the character raises their hand in the air). Unity takes all attached animations into account when calculating 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 become a problem when they push 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 shadersA program that runs on each vertex of a 3D model when the model is being rendered. More info
    See in Glossary
    which can push vertices outside the pre-calculated bounds
  • using ragdolls

In those cases, there are two solutions:

  1. Modify the Bounds to match the potential bounding volume of your Mesh
  2. Enable Update When Offscreen to skin and render the skinned Mesh all the time

You should usually use the first option, because it is better for performance. However, the second option is preferable 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 will automatically remap 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. This means that if you can’t attach all Skinned Mesh Renderers to the root bone or a child, and you use ragdolls, you should turn off this optimization.

Importing skinned Meshes

Currently, skinned Meshes can be imported from:

  • Autodesk® Maya®
  • Cinema4D
  • Autodesk® 3ds Max®
  • Blender
  • Cheetah 3D
  • XSI
  • Any tool that supports the FBX format

On mobile devices, Unity handles skinning on the CPU with hand-coded NEON/VFP assembly. A limitation here is that normals and tangents are not normalized, so if you are writing your own Shaders, you should handle the normalization youself. However, if you are using Surface ShadersUnity’s code generation approach that makes it much easier to write lit shaders than using low level vertex/pixel shader programs. More info
See in Glossary
, Unity automatically handles the normalization.

Note: Optimized Meshes sort bones differently from non-optimized Meshes, resulting in potentially significant animation problems. This is because non-optimized Meshes rely on bone order to animate, while Optimized Meshes use the bone names and do not rely on bone order.

If you simply import the FBX file and use it, Unity will take care of the order of the transforms.

For advanced users, if you want to change SkinnedMeshRenderer.sharedMesh:

  1. In ‘non-optimized’ mode, you need to make sure that the SkinnedMeshRenderer.bones matches SkinnedMeshRenderer.sharedMesh in a strict way. The referenced Transforms should be there in the correct order.
  2. In optimized mode, it’s much simpler; the 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
    works as long as the avatarAn interface for retargeting animation from one rig to another. More info
    See in Glossary
    has the referenced bones. In this case, SkinnedMeshRenderer.bones is always empty.

Did you find this page useful? Please give it a rating:

Mesh Renderer
Text Mesh