青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當(dāng)自強(qiáng)而不息

Working with skeletal animation(4)

Working with Skinned Meshes

In the first half of this chapter, you learned how to manipulate a hierarchy of bones that forms the basis of skeletal animation. That's all fine and dandy, but playing with imaginary bones isn't going to cut the mustard. Your game's players need to see all your hard work in the form of rendered meshes, which is where skinned meshes come in.

Skinned meshes are almost like the standard meshes with which you are already familiar. Using a D3DXMESHCONTAINER_EX object, you can store your mesh's data, from the vertices and indices to the materials and texture data, all wrapped up in one convenient ID3DXMesh object. As for the actual skinned mesh data, that information is contained in a special object called ID3DXSkinInfo.

I'll skip the ID3DXSkinInfo introductions for the moment and instead explain what makes a skinned mesh unique to other meshes. A skinned mesh deforms to match the orientation of the underlying skeletal structure. As the bones twist and turn, so do the mesh's vertices. The mesh−s vertices make the skinned mesh unique. You'll be dealing with the changing positions of the vertices when it comes to skinned meshes.

Take a look at Figure 4.3, which shows a skeleton surrounded by a simplistic mesh.

In Figure 4.3, each vertex is connected to a bone. As a bone moves, so do the vertices that are attached to it. For example, if you were to rotate the bone 45 degrees about the x−axis, the attached vertices would rotate 45 degrees as well, with the bone's joint acting as the pivot point or the origin of the rotation.

Now take a closer look at Figure 4.3, and you'll see that a couple vertices are attached to more than one bone. That's right−you're not limited to attaching a vertex to a single bone. In fact, you can connect a vertex to as many bones as you want with DirectX. Whenever one of the bones to which the vertex is attached moves, the vertex inherits a percentage of the motion. For example, if a bone rotates 60 degrees about the z−axis, an attached vertex may inherit only 25 percent of the motion, meaning the vertex will rotate only 15 degrees about the z−axis.

The exact percentage of motion the vertex inherits is called the vertex weight. Each vertex in the skinned mesh is assigned one vertex weight per bone to which it is attached. Those weights are typically 1.0 for vertices that are attached to only one bone, meaning that the vertex inherits the full motion of the bone. The weights are divided among the bones for vertices attached to multiple bones, and are usually calculated by taking into consideration the vertex's distance from each bone. (Most 3D modeling programs will graciously
calculate this for you.) For example, suppose a vertex is attached to two bones, meaning that both weights are set to 0.5. The vertex will inherit 50 percent of the motion from each bone. Notice that the total of all weights summed must always equal 1.

The purpose of using skin weights is quite ingenious. By allowing certain bones to influence specific vertices, you can have awesome effects such as wrinkling skin, bulging muscles, and stretching clothes−all in real time as your characters animate!

The way DirectX treats the vertex weights is quite simple. After you've loaded a mesh to use as your skinned mesh and you've loaded the vertex weights (also called skin weights), you can transform the vertices to match the bones' orientations using the following steps.

1. Iterate all vertices. For each vertex, proceed to Step 2.

2. For each bone to which the current vertex is connected, get the bone transformation. For each bone transformation, multiply the matrix by the vertex's weight and apply the result to a combined transformation for the vertex.

3. Repeat Step 3 for each bone connected, and repeat Steps 2 through 4 for each vertex. When you're finished, apply the combined transformation matrix to the specific vertex being iterated (from Step 1).

How exactly do you obtain these skin weights? With the help of the ID3DXSkinInfo object I mentioned earlier, you can load the weights from an .X file. The skin weights are stored within a Mesh data object, usually at the end of the Mesh object's data.

For each bone in your skeletal structure, there is a matching SkinWeights data object. Inside the SkinWeights object is the name of the bone, followed by a number of vertices attached to it. A skinned mesh header determines the number of bones to which each vertex in the mesh can be connected. If some of the vertices are attached to two bones, then all vertices must be attached to two bones. To get around the oddity of having vertices that connect to different numbers of bones, you can assign a weight of 0 to the second bone.

As I mentioned, the SkinWeights object includes the number of vertices that are connected to the bone. It lists an array of vertex index numbers. After the array of vertex indices, there is an array of vertex weight values. Finally, there is an inversed bone transformation to help you orient the vertices around the bone's joint.

Take a look at this sample SkinWeights template data object:

SkinWeights {
"Bip01_R_UpperArm";
4;
0, 3449, 3429, 1738;
0.605239, 0.605239, 0.605239, 0.979129;
−0.941743, −0.646748, 0.574719, 0.000000,
−0.283133, −0.461979, −0.983825, 0.000000,
0.923060, −1.114919, 0.257891, 0.000000,
−65.499557, 30.497688, 12.852692, 1.000000;;
}

In this data object, a bone called Bip01_R_UpperArm is used. There are four vertices attached to the bone, and the vertex indices are 0, 3449, 3429, and 1738. Vertex 0 has a weight of 0.605239, vertex 1 has a weight of 0.605239, and so on. A transformation matrix aligns the vertices listed around the bone's joint. This matrix is very important. Without it, the vertices will rotate around the origin of the world instead of the bone's joint.

Thankfully, you don't have to deal directly with the SkinWeights templates. The data is handled for you while you are loading the skinned mesh from an .X file using the D3DX helper functions.


posted on 2008-04-23 18:42 lovedday 閱讀(475) 評(píng)論(0)  編輯 收藏 引用


只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(lèi)(178)

3D游戲編程相關(guān)鏈接

搜索

最新評(píng)論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲免费av观看| 亚洲欧美另类久久久精品2019| 欧美成人一区二区| 欧美成人午夜剧场免费观看| 亚洲精品乱码久久久久久按摩观| 一区二区三区产品免费精品久久75 | 久久九九免费视频| 99re在线精品| 西西裸体人体做爰大胆久久久| 亚洲国产天堂久久综合网| 亚洲深夜福利视频| 亚洲高清免费| 欧美一区二区视频在线| 在线一区二区三区做爰视频网站| 欧美在线亚洲在线| 亚洲影院高清在线| 久久一区欧美| 久久黄色级2电影| 欧美视频精品一区| 亚洲丰满在线| 国产一区二区三区网站 | 欧美中在线观看| 免费观看成人| 久久蜜桃av一区精品变态类天堂| 欧美性大战久久久久久久| 欧美在线视频观看| 欧美视频精品在线观看| 亚洲国产精品专区久久| 亚洲国产精品久久久久秋霞不卡| 亚洲欧美日韩另类| 亚洲在线观看免费| 欧美午夜www高清视频| 欧美激情按摩| 在线观看成人一级片| 欧美一区二区三区在线看| 午夜在线观看免费一区| 欧美午夜大胆人体| 99精品国产在热久久婷婷| 日韩视频一区| 久久综合久久美利坚合众国| 久久久午夜精品| 国产精自产拍久久久久久| 一区二区欧美在线| 亚洲图片在线| 国产精品美女在线观看| 亚洲少妇中出一区| 性色av一区二区三区在线观看| 国产精品久久久久久久久动漫| 亚洲国产精品一区在线观看不卡 | 久久精品一区二区| 国产一区二区精品久久91| 欧美在线观看一区二区三区| 久久夜色精品国产| 国产一区二区成人| 久久精品国产第一区二区三区最新章节 | 99这里有精品| 欧美性一区二区| 亚洲影院高清在线| 久久久久成人精品免费播放动漫| 国产一区二区三区久久| 久久精品国产综合| 欧美激情在线| 一区二区三区欧美| 国产精品二区二区三区| 亚洲男人的天堂在线观看| 久久精品日产第一区二区三区| 国产在线欧美日韩| 欧美mv日韩mv亚洲| 亚洲网站在线观看| 老司机67194精品线观看| 国产一区二区三区免费不卡| 久久久久久久一区| 亚洲精品一品区二品区三品区| 国产精品私拍pans大尺度在线| 久久婷婷丁香| 欧美中文字幕不卡| 欧美视频免费看| 日韩午夜精品| 91久久一区二区| 艳妇臀荡乳欲伦亚洲一区| 亚洲影视在线播放| 国产综合久久久久久鬼色| 欧美国产欧美综合| 一区二区三区回区在观看免费视频| 亚欧美中日韩视频| 最近中文字幕日韩精品| 国产精品视频内| 欧美电影免费观看高清| 午夜精品电影| 日韩一级视频免费观看在线| 久久视频在线免费观看| 日韩视频一区| 亚洲国产99| 一区二区三区在线免费视频| 国产美女精品| 国产精品第2页| 欧美日韩日韩| 欧美日韩成人在线播放| 欧美成人一区二区| 另类天堂视频在线观看| 久久国产精品亚洲77777| 亚洲欧美变态国产另类| 亚洲调教视频在线观看| 一区二区精品国产| 99精品视频免费观看| 亚洲精品永久免费精品| 亚洲黄色三级| 亚洲人成在线观看一区二区| 欧美国产专区| 欧美大片91| 亚洲第一页在线| 亚洲电影在线| 日韩午夜黄色| 一区二区av| 亚洲伊人观看| 欧美一级视频| 久久久精品日韩欧美| 久久久久久精| 六月丁香综合| 欧美精品aa| 国产精品国产三级欧美二区| 国产精品美女www爽爽爽| 国产精品免费观看在线| 国产欧美一区二区三区国产幕精品| 国产精品一区二区久激情瑜伽| 国产精品外国| 黄色资源网久久资源365| 亚洲电影免费观看高清| 亚洲美女中出| 亚洲免费视频成人| 久久精品视频网| 免费观看一区| 99热精品在线观看| 欧美在线视频免费播放| 欧美阿v一级看视频| 欧美日韩视频第一区| 国产乱码精品一区二区三区忘忧草| 国产日韩亚洲| 亚洲肉体裸体xxxx137| 亚洲五月六月| 久久久久久久91| 亚洲福利视频免费观看| 宅男噜噜噜66一区二区66| 欧美中文字幕视频| 欧美精品久久99久久在免费线| 国产精品日韩久久久久| 亚洲黄色成人| 亚洲欧美日韩人成在线播放| 美女久久网站| 亚洲一级片在线观看| 久久视频精品在线| 欧美四级伦理在线| 亚洲福利视频免费观看| 亚洲欧美日韩一区| 亚洲国产精品黑人久久久| 午夜欧美精品| 欧美精品国产精品日韩精品| 国产无一区二区| 在线一区欧美| 麻豆精品网站| 亚洲一区在线看| 欧美日韩国产色视频| 在线观看国产成人av片| 午夜在线视频一区二区区别| 最新国产乱人伦偷精品免费网站| 欧美一级一区| 国产精品乱码一区二三区小蝌蚪| 91久久在线视频| 久久天天躁狠狠躁夜夜爽蜜月| 一区二区三区四区五区精品| 蜜臀a∨国产成人精品| 国产一区二区高清| 欧美一级在线视频| 99视频精品在线| 蜜臀久久99精品久久久久久9| 国产精品美女久久久久aⅴ国产馆| 亚洲免费高清| 欧美国产日韩精品免费观看| 久久国产婷婷国产香蕉| 国产精品欧美风情| 亚洲网站在线| 亚洲欧洲日本国产| 欧美成ee人免费视频| 一区视频在线播放| 久久男人av资源网站| 先锋影音网一区二区| 国产欧美日韩三区| 午夜免费在线观看精品视频| 亚洲日本中文字幕免费在线不卡| 久久综合精品国产一区二区三区| 一区在线视频| 久久夜色精品国产| 久久久久久9| 在线观看成人小视频| 久久综合九色综合欧美狠狠| 久久狠狠久久综合桃花| 国产在线拍揄自揄视频不卡99| 久久激情五月激情| 久久不射中文字幕| 在线成人www免费观看视频|