朱峰社區(qū)首頁 朱峰社區(qū)

搜索資源 注冊(cè)|登陸

等待

返回 展開菜單
按功能 按軟件

Unity3D游戲制作教程

Unity3D游戲制作教程

包含5節(jié)視頻教程

本系列包含Unity3D介紹、Unity3D導(dǎo)出人物、Unity3D導(dǎo)出場(chǎng)景、Unity3D導(dǎo)出動(dòng)作、游戲測(cè)試最終完成一個(gè)簡(jiǎn)單的游戲。是一套非常完整的Unity3D游戲制作教程。

關(guān)閉

Unity組件:Skinned Cloth 蒙皮布料

關(guān)注:5241 留言:0 樓主:aiqi007 發(fā)帖時(shí)間:15年11月16日

aiqi007

普通會(huì)員

aiqi007

社區(qū)新人:1級(jí)

關(guān)注4766人

  • 性別

  • 年齡

    18

  • 積分

    1

  • 登陸

    1

  • 發(fā)帖

    1

  • 作品

    1

間隔線


Skinned cloth in the scene view and in the inspector.
蒙皮布料在場(chǎng)景和檢視面板中。

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->Physics->Skinned Cloth.

蒙皮布料組件與蒙皮網(wǎng)格渲染組件一起模擬角色身上的衣服。如果你的動(dòng)畫角色使用了蒙皮網(wǎng)絡(luò)渲染,那么你可以為其增加一個(gè)蒙皮布料來讓其更真實(shí)。只需要選擇具有蒙皮網(wǎng)絡(luò)渲染組件的物件,使用Component->Physics->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.

當(dāng)使用蒙皮布料組件時(shí),它將從蒙皮網(wǎng)格渲染組件中獲取頂點(diǎn),并根據(jù)這些頂點(diǎn)來模擬布料。蒙皮布料可以對(duì)每個(gè)頂點(diǎn)設(shè)置參數(shù),這些參數(shù)定義模擬布料相對(duì)蒙皮移動(dòng)的自由度。

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.

當(dāng)你在場(chǎng)景或檢視面板中選中了一個(gè)帶有蒙皮布料組件的對(duì)象時(shí),這些參數(shù)將被可見的設(shè)置。有兩種設(shè)置方式,選擇模式和噴涂模式,在選擇模式,你在場(chǎng)景中選擇相應(yīng)的頂點(diǎn),來設(shè)置其參數(shù)。在噴涂模式,你設(shè)置好參數(shù)后,點(diǎn)擊對(duì)應(yīng)的paint按鈕,然后選擇頂點(diǎn)來設(shè)置這些參數(shù)。

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.

記住,蒙皮布料只會(huì)被蒙皮網(wǎng)格渲染組件的蒙皮的頂點(diǎn)驅(qū)動(dòng),而不會(huì)和其他碰撞體交互。這使得蒙皮布料比完全的物理交互布料的模擬要快,它不需要像其它物理模擬一樣,在同一線程按固定幀率模擬。

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.

你可以在任何時(shí)候激活或凍結(jié)互動(dòng)布料組件來使其開啟或關(guān)閉,關(guān)閉將渲染為普通的蒙皮網(wǎng)格渲染,所以你可以在動(dòng)態(tài)的切換來實(shí)現(xiàn)很多效果。采用SkinnedCloth.SetEnabledFading()方法可以使其效果平滑的淡入淡出,來使得玩家忽視其切換。

Cloth Coefficients 布料參數(shù)

There a four coefficients per vertex, which define how cloth vertices can move with respect to the skinned vertices and normals. These are:

對(duì)每個(gè)頂點(diǎn),都有四個(gè)參數(shù)可以設(shè)置,這些參數(shù)定義了布料頂點(diǎn)相對(duì)蒙皮頂點(diǎn)與法線的運(yùn)動(dòng)范圍。它們是:

  • 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.
    最大距離。一個(gè)布料頂點(diǎn)到蒙皮網(wǎng)格頂點(diǎn)的最大距離。蒙皮布料組件讓布料頂點(diǎn)與蒙皮頂點(diǎn)的距離始終在最大距離范圍內(nèi)。如果最大距離為0,那么頂點(diǎn)將不模擬而是直接設(shè)為蒙皮頂點(diǎn)的位置。這種方式用于設(shè)置某些布料店孤獨(dú)在角色的蒙皮上很有用——用于某些不蒙皮的頂點(diǎn),以及一些角色固定在角色身體上的東西(比如褲子的腰部,被腰帶固定住)。如果大部分不需要布料模擬的話(比如面部或手部),最好的方式還是將其分離為獨(dú)立的不帶互動(dòng)布料組件的蒙皮網(wǎng)格。
  • 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.
    偏心距;诿善ぞW(wǎng)格法線,根據(jù)最大距離來扭曲這個(gè)球。值為0時(shí)不生效,也就是球不發(fā)生扭曲。從0到-1.0將在正切方向上減少頂點(diǎn)的移動(dòng)范圍。當(dāng)為-1.0時(shí),這個(gè)頂點(diǎn)只允許在蒙皮頂點(diǎn)到最大距離范圍間沿法線移動(dòng)。從0到1.0減少頂點(diǎn)沿法線移動(dòng)的距離。當(dāng)為1.0時(shí),頂點(diǎn)只能在蒙皮頂點(diǎn)到最大距離范圍間沿正切方向移動(dòng)。
  • 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.
    碰撞球半徑及碰撞球距離。定義一個(gè)頂點(diǎn)無法進(jìn)入的球。該球可以與模擬布料進(jìn)行碰撞。這對(duì)參數(shù)為每個(gè)布料頂點(diǎn)定義了一個(gè)球。這個(gè)球的球心在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.

下圖列出了在不同的最大偏心距情況下這些參數(shù)是怎樣在蒙皮頂點(diǎn)與法線參考系中作用的。紅的區(qū)域是由碰撞球半徑和碰撞球距離定義的碰撞球,它是布料頂點(diǎn)不能進(jìn)入的區(qū)域。綠的區(qū)域,由最大距離與最大偏心距決定,它除去紅色的區(qū)域,就是空間中布料頂點(diǎn)可以活動(dòng)的區(qū)域。

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:

當(dāng)你選擇了一個(gè)具有蒙皮布料組件的對(duì)象時(shí),你可以在蒙皮布料檢視面部中編輯頂點(diǎn)參數(shù)和其他屬性。檢視面板有三個(gè)標(biāo)簽。

Vertex Selection Tool 頂點(diǎn)選擇工具

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.

在此模式下,你可以在場(chǎng)景視圖中選擇訂單,然后在檢視面板照哦功能設(shè)置參數(shù)(參考前一節(jié)對(duì)參數(shù)的介紹)。按住shift鍵或者用鼠標(biāo)框選可以一次設(shè)置多個(gè)頂點(diǎn)的參數(shù)。當(dāng)你選擇多個(gè)頂點(diǎn)時(shí),檢視面板將顯示平均值。當(dāng)你改變這個(gè)值,那么所有的頂點(diǎn)都會(huì)被設(shè)為同樣的值。當(dāng)場(chǎng)景視圖為線框模式時(shí),你可以看到和選擇背面的頂點(diǎn),這種技巧在選擇角色的整個(gè)部件時(shí)比較有用。

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.

為了幫助你弄清楚所有頂點(diǎn)的參數(shù)值分布,你可以選擇參數(shù)區(qū)域邊的眼睛圖標(biāo),編輯器會(huì)將這些參數(shù)可視化。值小的頂點(diǎn)渲染為綠色,中間范圍內(nèi)的為黃色,最大的為藍(lán)色。這些顏色范圍取決于已設(shè)置參數(shù)的范圍。

Vertex Painting Tool 頂點(diǎn)噴涂工具

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 paintbrush toggle next to the coefficients you want to change, and then click on all vertices you want to set that value for.

類似于頂點(diǎn)選擇,這個(gè)工具幫助你配置頂點(diǎn)參數(shù)。不同于頂點(diǎn)選擇操作方式,你不需要在改變數(shù)值之前選中頂點(diǎn)。在這種模式下,你只需要設(shè)置好相應(yīng)的值,激活參數(shù)邊的畫筆開關(guān),然后選中你要設(shè)置的頂點(diǎn)。

Configuration 配置

The third tab lets you configure various properties of the skinned cloth:

第三個(gè)標(biāo)簽用于配置蒙皮布料的各種屬性。

  • Bending Stiffness 抗彎剛度
    Bending stiffness of the cloth. 布料的抗彎剛度。
  • Stretching Stiffness 拉伸剛度
    Streching stiffness of the cloth. 布料的拉伸剛度。
  • Damping 阻尼
    Damp cloth motion 布料運(yùn)動(dòng)的阻尼。
  • Use Gravity 使用重力
    Should gravity affect the cloth simulation?
    布料模擬是否受重力影響。
  • External Acceleration
    外部加速度
    A constant, external acceleration applied to the cloth.
    設(shè)置一個(gè)固定的,外部加速度給布料。
  • Random Acceleration
    隨機(jī)加速度
    A random, external acceleration applied to the cloth.
    設(shè)置一個(gè)隨機(jī)的,外部加速度給布料。
  • 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.
    定義角色在世界空間的移動(dòng)對(duì)布料頂點(diǎn)的影響。值越大,布料對(duì)角色在世界移動(dòng)的反應(yīng)越劇烈。這個(gè)參數(shù)基本是用于定義蒙皮布料的空氣阻力。
  • 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.
    定義角色在世界空間的加速度對(duì)布料頂點(diǎn)的影響。值越大,布料對(duì)角色在世界空間的加速度反應(yīng)越劇烈。如果布料看起來很生硬,那么試著將該值增加。當(dāng)布料在角色加速時(shí)表現(xiàn)的不穩(wěn)定,那么試著將該值減少。

贊0 踩0

未知用戶

2005-2025 朱峰社區(qū) 版權(quán)所有 遼ICP備2021001865號(hào)-1
2005-2025 ZhuFeng Community All Rights Reserved

VIP

朱峰社區(qū)微信公眾號(hào)

回頂部

1.復(fù)制文本發(fā)給您的QQ好友或群、微信等;好友點(diǎn)擊鏈接以后,轉(zhuǎn)發(fā)就成功了。 2.如朋友點(diǎn)擊您的鏈接,您需要需刷新一下才行;同一個(gè)好友僅能點(diǎn)擊一次。
購買VIP,觀看所有收費(fèi)教程!