Version: 5.3
Mesh Renderer
텍스트 메시

스킨드 메시 렌더러

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 joints bend (as opposed to a machine where joints are more like hinges).

A Skinned Mesh Renderer is automatically added to any mesh that needs it at import time.

프로퍼티

프로퍼티: 기능:
Cast Shadows If enabled, 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.
Materials The list of Materials the model will be rendered with.
Use Light Probes Does the mesh take Light Probes into account?
Quality The maximum number of bones that can affect any given vertex.
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 object is offscreen.
Mesh Mesh used by this renderer.
Root Bone The bone that is the “root” of the animation (ie, the bone relative to which all the others move).
Bounds The bounding volume that is used to determine when the mesh is offscreen. The bounds are precalculated on import from the Mesh and animations in the model file and are displayed as a wireframe around the model in the Scene View.

세부 정보

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(s) they are connected to, so the “skin” follows the movement of the skeleton. At a simple joint (an elbow, say), 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 mesh, resulting in more subtle movements.

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

품질(Quality)

Unity는 각 버텍스를 하나, 둘, 또는 네 개의 뼈대로 스킨할 수 있습니다. 뼈대 네 개를 사용하면 최상의 결과물이 나오지만 이는 프로세싱 오버헤드를 높입니다. 게임에서는 보통 두 개의 뼈대 웨이트를 사용하는데 이 경우 화질과 퍼포먼스 사이에 균형이 잘 이뤄집니다.

If the Quality is set to Automatic, the Blend Weights value from the Quality Settings will be used. 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, since this avoids wasting CPU time. The skinning is not updated until the mesh comes back on screen.

The object’s visibility is determined from the Mesh’s Bounds (ie, the entire bounding volume must be outside the view frustum of any active camera). However, the true bounding volume of an animated mesh can change as the animation plays (eg, the volume will get taller if the character raises their hand in the air). Unity takes into account all attached animations 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 following situations, for example, become a problem when they push bones or vertices out of the precalculated 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 precalculated bounds;
  • using ragdolls.

In those cases there are two solutions:

  1. modify the Bounds to match 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 since it has better 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 (when using ragdolls, say).

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 there is some reason why 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:

  • Maya
  • Cinema4D
  • 3D Studio Max
  • Blender
  • Cheetah 3D
  • XSI
  • Any other tool that supports the FBX format

On mobiles, Unity handles skinning on the CPU with hand-coded neon/vfp assembly. A caveat is that normals/tangents are not normalized, so if you are writing your own shaders, you should take handle the normalization youself. If you are using surface shaders, however, the normalization is handled automatically by Unity.

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 are order-independent.

단순히 FBX 파일을 임포트해 사용한다면 Unity는 트랜스폼의 순서를 살필 것입니다.

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

  1. In ‘non-optimized’ mode, you need to make sure that, the SkinnedMeshRenderer.bones match SkinnedMeshRenderer.sharedMesh in a strict way: the referenced Transforms should be there in the correct order.
  2. In ‘optimized’ mode, it’s much simpler. As long as the avatar has the referenced bones, the rendering will be fine. In this case SkinnedMeshRenderer.bones is always empty.
Mesh Renderer
텍스트 메시