{"id":90,"date":"2013-11-08T15:46:23","date_gmt":"2013-11-08T15:46:23","guid":{"rendered":"\/\/3dbym.ru\/2013\/11\/attaching-the-mesh\/"},"modified":"2013-11-08T15:46:23","modified_gmt":"2013-11-08T15:46:23","slug":"attaching-the-mesh","status":"publish","type":"post","link":"https:\/\/3dbym.ru\/2013\/11\/attaching-the-mesh\/","title":{"rendered":"Attaching the Mesh"},"content":{"rendered":"
When your joints are animating smoothly, it is time to attach the mesh. The mesh is what makes up the shape of the model. It is a group of vertices and triangles that help the model have volume and detail. Without the mesh, a skeletally animated model would simply be a<\/p>\n
<\/p>\n
skeleton. Each mesh vertex stores an index into the joint array to signify that it is attached to a certain bone. Now, the way the joints were stored determines the method of transforming and rendering these vertices.<\/p>\n
If the joints are stored with each having its parent index, and you have already gone through and calculated the final absolute matrices, attach\u00ading the mesh is simple. Each vertex must be transformed by its joint\u2019s absolute matrix. Be sure to store your transformed vertex in a special place; do not overwrite your original vertex. This is done because in most formats, the boneframes are not cumulative. Each frame stores the rotation and translation of a specific joint from the starting point. If you do not go back to the original vertices when calculating new vertex positions each time, the model will behave erratically. Figure 5.8 shows what it means to attach individual vertices to a joint.<\/p>\n
\n <\/p>\n Figure 5.8 Attaching vertices to joints.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n <\/p>\n Now you are probably thinking to yourself, \u201cwell, I can animate a model\u2019s vertices, but what about triangles, normals, and texture coor\u00addinates\u201d? This is where skeletal animation really starts to shine. Each model contains just one set of texture coordinates and triangle infor\u00admation. Just because the positions of the vertices change does not mean the triangle indexes and texture coordinates have to. This means you don\u2019t have to worry about them once you set them up.<\/p>\n Normals are another story. Because the orientation of the polygons and vertices change, so will the normals. If you are using just face normals, you need to recalculate them manually every frame before sending them to the renderer. However, if you calculated vertex<\/p>\n<\/p>\n normals at the beginning, you are in luck. Vertex normals do not have to be completely recalculated after transformation. They can be transformed by the same matrix as the vertices were. The only differ\u00adence here is that you do not take in account translation. Using the Transform3() function of the matrix class will rotate your vertex normal, while still retaining its original magnitude.<\/p>\n If the joints store child indexes and you are pushing the current transformation matrix onto the stack using glPushMatrix, rendering your model becomes really easy. In this case, it is not necessary to transform each vertex before displaying it. No changes are necessary for rendering anything. Everything you render now will be trans\u00adformed properly, even face normals. Another issue to consider is how vertices are attached to more than one bone. In this case, each bone will have an assigned weight that tells you how much it will affect the joint. The final transformation is the weighted average of all of the transformations of the attached bones.<\/p>\n","protected":false},"excerpt":{"rendered":" When your joints are animating smoothly, it is time to attach the mesh. The mesh is what makes up the shape of the model. It is a group of vertices and triangles that help the model have volume and detail. Without the mesh, a skeletally animated model would simply be a skeleton. Each mesh vertex […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/90"}],"collection":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/comments?post=90"}],"version-history":[{"count":0,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/90\/revisions"}],"wp:attachment":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/media?parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/categories?post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/tags?post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}} |