Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Now that I'm getting into animating 3D entities in my game, I was wondering what the best approach for this would be. I did some research and came across something called "Vertex Tweening". However, most of these articles (like this one: http://archive.gamedev.net/archive/reference/articles/article2017.html) are from 2003, if not older!

In a DirectX 9 game which makes proper use of HLSL to do its rendering magic, is Vertex Tweening still the way to go these days (anno 2013), or are there other techniques I'm not aware of yet?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Vertex tweening for animation is an outdated technique, and there aren't many good reasons to use it in modern graphics code. I'm fairly certain it isn't even supported at the API level in D3D10+ (although you could always still implement it yourself).

One of the big problems with it is that it requires complete copies of the vertex data for each keyframe, which is very expensive. Furthermore, since the interpolations between keyframe vertices are usually simple linear interpolations, you need quite a few keyframes to have a high-quality animation, especially if lots of rotations are involved.

The current standard technique for animation of 3D bodies as of this writing is skeletal animation. There's a lot of information on this available via Google and even on this site; at the heart of it, you define a simple 3D rig (or "skeleton"), and you animate that by storing a series of transformations to the bones that skeleton. The actual mesh data includes weight information per-vertex that indicates which bones affect which vertex at what strength, and that information can be combined on the GPU or CPU to animate the mesh.

share|improve this answer
    
My models are skeletal meshes, I have all the information I need to move bones (and I can already, by setting the particular frame I want to render). Could you expand your answer with a rough outline on how Skeletal Animation is implemented in a project? How does HLSL tie into this, etc. –  Lennard Fonteijn May 3 '13 at 15:29
    
I mean, the general outline for Vertex Tweening is clear to me: Have a vertexbuffer for each frame of an animation, SetStreamSource for two frames you wish to blend between, give it a tween value and done. I was wondering if you could explain briefly how it works in case of Skeletal Animation. –  Lennard Fonteijn May 3 '13 at 15:32
    
I think that's worth asking as a separate question (and there might be one already on the site). But basically, as I said, you construct a set of hierarchical "bones" that are or have 3D transformations relative to eachother. You weight each vertex to a bone or set of bones. All of that's usually done in the modelling program, and then the data is exported with the rest of the mesh. Your animation is then a series of transformations of the bones, which can be concatenated with other transforms to get the final one, and this is applied to each vertex. –  Josh Petrie May 3 '13 at 17:39
1  
You can do this either on the CPU, directly updating the mesh vertex buffer, or you can do it on the GPU using HLSL (this is usually called "software" or "hardware" skinning, respectively, which may give you some other search terms). –  Josh Petrie May 3 '13 at 17:40
    
Much appreciated, thanks! That should keep me busy for a while :) –  Lennard Fonteijn May 3 '13 at 19:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.