• Mesh and Skeleton Pipeline from 3D Package to OpenGL (C++)
    7 replies, posted
One of the things my groupmates and I want to implement into our game is a skeletal animation system equipped with vertex weighting so our characters can properly deform. While it was technically a feature requirement our games this past semester, not one single group out of the fifteen in my program had it. All of our animations were done as keyframed OBJ files with a morphing algorithm to interpolate between them. Although this produces decent results if done with enough care, it doesn't compare to a real joint structure. Enter problem 1: I have had no luck finding a method to export vertex weights from Maya 2012 into a format that we can parse into our program. Enter professor prescribed solution: "Pinocchio" [video=youtube;dVTfAKwk6Io]http://www.youtube.com/watch?v=dVTfAKwk6Io[/video] What this software does is automatically compute bone weights for a given mesh, which you can then apply a skeleton to. Attempting to use the results of this program only led to more and more problems as it's extremely limited in terms of actual functionality (only supports skeletons of 17 joints). Not to mention the results it gave us were shoddy at best. Problem 2: Currently stuck with BHV files for animations. While easy to parse and export from Maya, they didn't play nice with the Pinocchio rig/mesh No current solution for this. What I'm basically looking for is some sort of pipeline solution to get my Maya (preferably, but I'm willing to be flexible) modelled characters, complete with joint structure and vertex weights into a format that we can parse into our program. Does anyone have any resources/recommended reads/insight on this? It would be greatly appreciated.
I have yet to directly do this, though I have tinkered and thought about it. Assuming you don't want the ill-documented .x format (Which OGL doesn't provide a loader for anyways (to the best of my knowledge)), you could go with .fbx - Autodesk provides a fairly well documented FBX SDK which includes an FBX Loader - It even has an example of animation and rendering using OGL (Located in: C:\Program Files\Autodesk\FBX\FbxSdk\2012.2\examples\ViewScene) Looks like: [img]http://i.imgur.com/oEkby.png[/img] The one downfall to FBX is you have to merge animations manually, which isn't a big deal for a test demo (Open an ASCII FBX File, copy/paste animation into main FBX file), but could be troublesome for a full game (Eg; Magicka ended up making a tool to merge it for them). .OBJ doesn't support bones, etc. .Collada could be another choice, though I hear it's sometimes difficult to load because the format is so generic.
This guy sells a FBX parser for $20 which seems promising. I might bite. [video=youtube;FVUfSX_RLGs]http://www.youtube.com/watch?v=FVUfSX_RLGs[/video]
I've recently implemented skeletal animation using .md5 (Doom 3) model files in OpenGL. You should be alble to export to that from most modelling packages and the format is pretty simple to parse. If you are able to use [URL="http://assimp.sourceforge.net/"]Assimp (open asset import library)[/URL] in your project, it supports bone weights for md5 and a few of the more tricky formats. You may find these articles helpful if you choose md5: [URL="http://3dgep.com/?p=1053"]Loading and Animating MD5 Models with OpenGL[/URL] [URL="http://3dgep.com/?p=1356"]GPU Skinning of MD5 Models in OpenGL and Cg[/URL]
[QUOTE=dvondrake;33586966] FBX sounds promising, but a bit complicated. Not entirely sure what you mean by merging animations, but I feel that if there's setbacks like that then it'd probably be better in the long run to make my own exporters. [/QUOTE] Basically with the .FBX format you can either export a mesh or an animation, and you can only export one animation per *.fbx file (to the best of my knowledge). However, the actual FBX format has support for multiple animations inside a single FBX file. Because of this, you can just copy them into one file. Pretend a FBX file is like this: [Header] [Mesh/Bones] [Animation] Now you'd make the one with Mesh/Bones your 'main' FBX file, and then you'd copy the [Animation] section from each exported FBX file into your main one. The reason for this is that FBX isn't designed as a final format, those are usually engine specific, thus exporting FBX's one at a time makes sense.
I can't say I've ever actually gotten around to implementing skeletal animation, but I think you should take a look at the IQM model format. It's very straightforward and easy to parse, includes skeletal animation, and the example source code contains working reference implementations for both hardware vertex-shader based animation and software animation.
I wrote something that does just this for a game I'm currently working on. Here's the source for my project: [url]http://dl.dropbox.com/u/39921754/WorkingTitle1_Project.zip[/url] Not sure what version that is, but the skeletal code should all be there and working. (That was me covering my ass if parts of the project are broken/shit). Some information: it uses bvh files and a modified obj format I devised myself. In my version, at the end of the obj file is rigging information; vertex weights. I had to modify the obj export script to do this, but it's just simple mapping of vertices to bones with respect to weight. I'd give you the script, but I use blender so it won't help you. So, use this as a example, or pull some code if you like, hope it helps.
Sorry, you need to Log In to post a reply to this thread.