标题: [Unity 组件参考手册]组件:物理组件之蒙皮布料 [打印本页] 作者: . 时间: 2013-1-30 20:24 标题: [Unity 组件参考手册]组件:物理组件之蒙皮布料 Skinned cloth in the scene view and in the inspector.
蒙皮布料在场景和检视面板中。 The SkinnedCloth component works together with the SkinnedMeshRenderer to simulate clothing on a character. If you have an animated character which uses the SkinnedMeshRenderer, you can add a SkinnedCloth component to the game object with the SkinnedMeshRenderer to make him appear more life-like. Just select the GameObject with the SkinnedMeshRender, and add a SkinnedCloth component using Component->hysics->Skinned Cloth.蒙皮布料组件与蒙皮网格渲染组件一起模拟角色身上的衣服。如果你的动画角色使用了蒙皮网络渲染,那么你可以为其增加一个蒙皮布料来让其更真实。只需要选择具有蒙皮网络渲染组件的物件,使用Component->hysics->Skinned Cloth操作来增加蒙皮布料。What the SkinnedCloth component does, is to take the vertex output from the SkinnedMeshRenderer and apply clothing simulation to that. The SkinnedCloth component has a set of per-vertex coefficients, which define how free the simulated cloth can move with respect to the skinned mesh.当使用蒙皮布料组件时,它将从蒙皮网格渲染组件中获取顶点,并根据这些顶点来模拟布料。蒙皮布料可以对每个顶点设置参数,这些参数定义模拟布料相对蒙皮移动的自由度。These coefficients can be visually edited using the scene view and the inspector, when the game object with the SkinnedCloth component is selected. There are two editing modes, selection and vertex painting. In selection mode, you click on vertices in the scene view to select them, and then edit their coefficients in the inspector. In vertex paining mode, you set the coefficient values you want in the inspector, enable the "paint" button next to those coefficients you want to change, and click on the vertices to apply the values to those.当你在场景或检视面板中选中了一个带有蒙皮布料组件的对象时,这些参数将被可见的设置。有两种设置方式,选择模式和喷涂模式,在选择模式,你在场景中选择相应的顶点,来设置其参数。在喷涂模式,你设置好参数后,点击对应的paint按钮,然后选择顶点来设置这些参数。Note that skinned cloth simulation is only driven by the vertices skinned by the SkinnedMeshRenderer, and will not otherwise interact with any colliders. This makes skinned cloth simulation much faster then the fully physical Interactive Cloth component, as it does not need to be simulated on the same frame rate and the same thread as the rest of the physics simulation.记住,蒙皮布料只会被蒙皮网格渲染组件的蒙皮的顶点驱动,而不会和其他碰撞体交互。这使得蒙皮布料比完全的物理交互布料的模拟要快,它不需要像其它物理模拟一样,在同一线程按固定帧率模拟。You can disable or enable the skinned cloth component at any time to turn it on or off. Turning it off will switch rendering to the normal SkinnedMeshRenderer, so you can switch between these whenever needed to dynamically adjust for varying performance. You can also smoothly cross-fade between the two modes from a script using the SkinnedCloth.SetEnabledFading() method, to make the transition unnoticeable to the player.你可以在任何时候激活或冻结互动布料组件来使其开启或关闭,关闭将渲染为普通的蒙皮网格渲染,所以你可以在动态的切换来实现很多效果。采用SkinnedCloth.SetEnabledFading()方法可以使其效果平滑的淡入淡出,来使得玩家忽视其切换。
【Cloth Coefficients 布料参数】There a four coefficients per vertex, which define how cloth vertices can move with respect to the skinned vertices and normals. These are:对每个顶点,都有四个参数可以设置,这些参数定义了布料顶点相对蒙皮顶点与法线的运动范围。它们是:-------------------------------------------------------------------------- Max Distance
最大距离
Distance a vertex is allowed to travel from the skinned mesh vertex position. The SkinnedCloth component makes sure that the cloth vertices stay within maxDistance from the skinned mesh vertex positions. If maxDistance is zero, the vertex is not simulated but set to the skinned mesh vertex position. This behavior is useful for fixing the cloth vertex to the skin of an animated character - you will want to do that for any vertices which shouldn't be skinned, or for parts which are somehow fixed to the character's body (such as the waist of trousers, fixed by a belt). However, if you have large parts of the character which should not use cloth simulation (such as the face or hands), for best performance, set those up as a separate skinned mesh, which does not have a SkinnedCloth component.
最大距离。一个布料顶点到蒙皮网格顶点的最大距离。蒙皮布料组件让布料顶点与蒙皮顶点的距离始终在最大距离范围内。如果最大距离为0,那么顶点将不模拟而是直接设为蒙皮顶点的位置。这种方式用于设置某些布料店孤独在角色的蒙皮上很有用——用于某些不蒙皮的顶点,以及一些角色固定在角色身体上的东西(比如裤子的腰部,被腰带固定住)。如果大部分不需要布料模拟的话(比如面部或手部),最好的方式还是将其分离为独立的不带互动布料组件的蒙皮网格。
Distance Bias
距离偏移
Distorts the sphere defined by the maxDistance based on skinned mesh normals. The feature is disabled for a value of 0.0 (default). In this case the max distance sphere is undistorted. Decreasing the maxDistanceBias towards -1.0 reduces the distance the vertex is allowed to travel in the tangential direction. For -1.0 the vertex has to stay on the normal through the skinned mesh vertex position and within maxDistance to the skinned mesh vertex position. Increasing maxDistanceBias towards 1.0 reduces the discance the vertex is allowed to travel in the normal direction. At 1.0 the vertex can only move inside the tangental plane within maxDistance from the skinned mesh vertex position.
偏心距。基于蒙皮网格法线,根据最大距离来扭曲这个球。值为0时不生效,也就是球不发生扭曲。从0到-1.0将在正切方向上减少顶点的移动范围。当为-1.0时,这个顶点只允许在蒙皮顶点到最大距离范围间沿法线移动。从0到1.0减少顶点沿法线移动的距离。当为1.0时,顶点只能在蒙皮顶点到最大距离范围间沿正切方向移动。
Collision Sphere Radius and Collision Sphere Distance
碰撞球半径和碰撞球距离
Definition of a sphere a vertex is not allowed to enter. This allows collision against the animated cloth. The pair (collisionSphereRadius, collisionSphereDistance) define a sphere for each cloth vertex. The sphere's center is located at the position constrainPosition - constrainNormal * (collisionSphereRadius + collisionSphereDistance) and its radius is collisionSphereRadius, where constrainPosition and constrainNormal are the vertex positions and normals generated by the SkinnedMeshRenderer. The SkinnedCloth makes sure that the cloth vertex does not enter this sphere. This means that collisionSphereDistance defines how deeply the skinned mesh may be penetrated by the cloth. It is typically set to zero. collisionSphereRadius should be set to a value larger then the distance between the neighboring vertices to make sure the cloth vertices will not be able to slip around the collision spheres. In such a setup, the cloth will appear to collides against the skinned mesh.
碰撞球半径及碰撞球距离。定义一个顶点无法进入的球。该球可以与模拟布料进行碰撞。这对参数为每个布料顶点定义了一个球。这个球的球心在constrainPosition - constrainNormal * (collisionSphereRadius + collisionSphereDistance)(很难描述,看图即知),半径为collisionSphereRadius。--------------------------------------------------------------------------Refer to this image for a visual representation on how these coefficients work with respect to a skinned vertex and normal for different values of maxDistanceBias. The red area is the collision sphere defined by collisionSphereRadius and collisionSphereDistance, which the cloth vertex cannot enter. Thus, the green area, defined by maxDistance and maxDistanceBias subtracted by the red area defines the space in which the cloth vertex can move.下图列出了在不同的最大偏心距情况下这些参数是怎样在蒙皮顶点与法线参考系中作用的。红的区域是由碰撞球半径和碰撞球距离定义的碰撞球,它是布料顶点不能进入的区域。绿的区域,由最大距离与最大偏心距决定,它除去红色的区域,就是空间中布料顶点可以活动的区域。【The SkinnedCloth inspector 蒙皮布料检视面板】When you select a GameObject with a SkinnedCloth component, you can use the SkinnedCloth inspector to edit cloth vertex coefficients, and other properties. The inspector has three tabs:当你选择了一个具有蒙皮布料组件的对象时,你可以在蒙皮布料检视面部中编辑顶点参数和其他属性。检视面板有三个标签。
Vertex Selection Tool 顶点选择工具In this mode you can select vertices in the scene view, and the set their coefficients in the inspector (see the previous section for an explanation on how the cloth coefficients work). It is possible to set multiple coefficients by holding the shift key, or by dragging a rectangle with the mouse. When multiple vertices are selected, the inspector will display average values for the vertices coefficients. When you change the values, however, that coefficient will be set to the same value for all vertices. If you switch the scene view to wireframe mode, you will also be able to see and to select back-facing vertices, this can be useful when you want to select full parts of the character.在此模式下,你可以在场景视图中选择订单,然后在检视面板照哦功能设置参数(参考前一节对参数的介绍)。按住shift键或者用鼠标框选可以一次设置多个顶点的参数。当你选择多个顶点时,检视面板将显示平均值。当你改变这个值,那么所有的顶点都会被设为同样的值。当场景视图为线框模式时,你可以看到和选择背面的顶点,这种技巧在选择角色的整个部件时比较有用。To help you understand which values the coefficients have for all the vertices, you can click the eye icon next to a coefficient field, to make the editor visualize that coefficient in the scene view. This shows the vertices with the lowest value of that coefficient in a green tint, mid-range values will be yellow, and the highest values get a blue tint. The colors scale is always chosen relative to the used value range of that coefficient, and is independent of absolute values.为了帮助你弄清楚所有顶点的参数值分布,你可以选择参数区域边的眼睛图标,编辑器会将这些参数可视化。值小的顶点渲染为绿色,中间范围内的为黄色,最大的为蓝色。这些颜色范围取决于已设置参数的范围。
Vertex Painting Tool 顶点喷涂工具Similar to the vertex selection, this is a tool to help you configure the vertex coefficient values. Unlike vertex selection, you don't need to click on a vertex before changing a value - in this mode, you just enter the values you want to set, enable the paint***sh toggle next to the coefficients you want to change, and then click on all vertices you want to set that value for.类似于顶点选择,这个工具帮助你配置顶点参数。不同于顶点选择操作方式,你不需要在改变数值之前选中顶点。在这种模式下,你只需要设置好相应的值,激活参数边的画笔开关,然后选中你要设置的顶点。
Configuration 配置The third tab lets you configure various properties of the skinned cloth:第三个标签用于配置蒙皮布料的各种属性。-------------------------------------------------------------------------- Bending Stiffness 抗弯刚度
Bending stiffness of the cloth. 布料的抗弯刚度。
Stretching Stiffness 拉伸刚度
Streching stiffness of the cloth. 布料的拉伸刚度。
Damping 阻尼
Damp cloth motion 布料运动的阻尼。
Use Gravity 使用重力
Should gravity affect the cloth simulation?
布料模拟是否受重力影响。
External Acceleration
外部加速度
A constant, external acceleration applied to the cloth.
设置一个固定的,外部加速度给布料。
Random Acceleration
随机加速度
A random, external acceleration applied to the cloth.
设置一个随机的,外部加速度给布料。
World Velocity Scale
世界速度比例
How much world-space movement of the character will affect cloth vertices. The higher this value is, the more the cloth will move as a reaction to world space movement of the GameObject. Basically, this defines the air friction of the SkinnedCloth.
定义角色在世界空间的移动对布料顶点的影响。值越大,布料对角色在世界移动的反应越剧烈。这个参数基本是用于定义蒙皮布料的空气阻力。
World Acceleration Scale
世界加速度比例
How much world-space acceleration of the character will affect cloth vertices. The higher this value is, the more the cloth will move as a reaction to world space acceleration of the GameObject. If the cloth appears lifeless, try increasing this value. If it appears to get unstable when the character accelerates, try decreasing the value.
定义角色在世界空间的加速度对布料顶点的影响。值越大,布料对角色在世界空间的加速度反应越剧烈。如果布料看起来很生硬,那么试着将该值增加。当布料在角色加速时表现的不稳定,那么试着将该值减少。【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/