You see I'll be doing all the artwork for this, and I'm not terribly quick about making new images. This shouldn't be a big deal since there won't be much to see in this. However, I'd like to animate the character when he moves which means I'll need to draw each frame of him running and jumping. I'm not sure I want to draw all that, mostly because I have a hard to reproducing the same figure. It would look really strange if every frame appeared to have a different character in it.
I hit upon the idea of breaking my 2D character into a bunch of polygons and by moving the polygons around the character would move. This lets me take one image and cut it up into the animate-able parts, so it will always look the same.
Simple enough, this sort of thing has been done for years now. Where I got completely stuck was in trying to figure out how to store all the data needed to accomplish this.
To do this I'll need to save vertexes to describe all the polygons that comprise my character. All the vertices will also need UV coordinates as well. Easy, the OBJ files can hold all this.
Where it gets tricky is when you need to save the animation data. I really don't want that built into the code since that sort of thing always turns into a hassle when you need to change or create new data. I'd like to store it in the file with the mesh data this way any changes to the mesh can be quickly applied to the animation as well.
Now we're beyond what OBJ files can hold. There's lots of 3D model and animation formats out there to use. The problem with many of them is that they aren't human readable, which means I'll need some tool to create the files. I'm not keen on this idea since my skills with 3D modelling software is pretty bad. For now I need a human readable format.
There aren't many that fit into this format, and all of them have structures to support way more detail than I could hope to understand. Creating one of these files would not be an easy task without doing a whole ton of research. I really don't need something this complicated, it will take way to long so suss out the data I need and write a parser for it.
I don't like the idea of creating my own format. It cuts off any possibility of using outside tools to create resources and it makes the associated code very difficult to adapt. On the other hand my requirements have painted me into a very small corner.
Here's what I want in my file format:
- Store vertex and UV coordinates
- Link vertices to one or more bones
- Link these coordinates into triangles to create meshes
- Link triangle vertices to bones
- Define animations as bone movements
Some of these concepts are pretty familiar. Vertices, UV coordinates and the linking thereof into faces and meshes is what the OBJ files did.
This business about bones is all new though. The bones are just like the bones in your body, they provide some structure to the meshes. The meshes are like your skin, they get moved around based on where the bones move. The bones never get rendered into the scene, they only exist to calculate where the triangles should be drawn.
The idea is that you create a skeleton of these bones and animate it. Then you can attach any mesh you want to that and it'll instantly be animated as well. Think of a game where there's space marines up against a variety of humanoid aliens. You create one humanoid skeleton and it can be sued to animate the marine and all of those aliens. This is probably a lot of overkill for what I'm attempting to do, but it will be useful to know how to make this kind of thing work.
That about sums up my initial concept for this format. I have an XML schema in mind to hold all this information, but there's no sense writing it all down since I haven't a clue if it will work at all.
No comments:
Post a Comment