Sunday, March 15, 2015

Blender Animation, One Mesh versus Multiple Meshes, and Vertex Groups

Ok, so as to hopefully prevent someone in the future the same asspain that I dedicated my entire Saturday to...

I went to learn how to model and animate this weekend, and created a sweet mech model based off of Alimayo Arango's YouTube channel.  He does an excellent job at explaining how to model and rig up a mech, then goes on to show you how to animate it.  By the end of his third mech video, you have a nice mech that runs around Blender.

Since I have game development in mind, I recognized I had a problem at that point however.  Alimayo's method of parenting each mesh to the bone works GREAT for animation, but it won't fly for most game engine applications.  I didn't want 20 meshes floating around, because that would mean 20 UV mappings, 20 textures, and 20 objects in my game engine for each "object".  That would be a big performance hit come action time.

So I had to get my 20 meshes back into 1 mesh, without destroying the animation data, but more specifically, the data connecting the meshes to the bones.  If you select all your meshes and hit Ctrl-J to Join them up, it destroys this relationship.

After trying about 400 ways to do this by randomly clicking shit and hoping for the best, combined with asking anyone I could find on the subject, nobody seemed to recognize my issue, either due to simply not knowing or me asking poorly. 

Then, I strolled across the concept of Vertex Groups.

Essentially, what I had to do was select each mesh I had, one by one, and assign all its vertices to a new Vertex Group of the SAME NAME as the bone that had been deforming that mesh previously.  This kinda "locks in" the relationship between those vertices and the bone, which is essential because when you go to Join all the meshes later back into a single mesh, the only way Blender will know how to move those vertices afterwards is if Vertex Groups are established.

So, I built all the vertex groups, named them to the bones, and Joined the meshes.  You then select your new, single mesh, and apply an Armature modifier to it using your Armature as the Object.  The default settings are fine aside from that.

Voila!  Single mesh now working the same as 20 discreet meshes were originally. 

I think I still like Alimayo's method of splitting up each section into discreet parts, but there are two ways you could approach the issue with Vertex Groups in mind:  

1.  Instead of splitting the mesh into separate meshes to begin with, just assign the sections into Vertex Groups to begin with rather than parenting the meshes to the bones.
2.  Do it as Alimayo's video has you do it, then select each mesh afterwards, assign the vertices, and combine the meshes into one later as I did.

Now to learn how to use the damn animation editor properly....

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.