how to handle animated vertices?

Started by
3 comments, last by Morlith 18 years, 12 months ago
hi, i'm about to implement skeletal animation and i'd like to know how you guys handle the vertex data. do you store the mesh in a separate buffer (apart from the original mesh resource) and modify the positions of all vertices before rendering? do i have to touch the position of every vertex or can i solve it using the (recursive) method using only matrix calculations? i'm a noob on this topic and still in learning phase (reading and such), so i'm just curious about how to implement it... thanks a lot, flix
ALL YOUR BASE ARE BELONG TO US
Advertisement
You can do it all in hardware today.

For skeletal animation (MD3 models):
You have transformation (represented as matrix or better quaternion) assigned to each animation frame for each joint in your skelet. While rendering, you perform matrix transformation per-bone.

For morphing animation (MD2 models):
Either use built in functions of OpenGL or Direct3D to blend between 2 (or even more) vertex data streams containing vertex coordinates or use vertex program to blend on your own.

Of course combination of these 2 kinds of animations are allowed.

GL!
Maciej Sawitus
my blog | my games
For the record, MD3 models (Quake 3) actually use the "morphing animation" method as well. There was an MD4 format later devloped for Quake 3 that used skeletal animation, but I'm not aware of how often or even if it was used.

The MD5 models, however, that are used by Doom 3 are completely skeletal based, and actually have a very nice format once you get around a few quirks. (Plain text, animations are stored in seperate files, etc.)

Just my $0.02
// Tojiart
I'd go with matrix palette skinning.

Basically, along with the position/normal/texcoords/etc for each vertex, you also pack one or more 'bone indices' (if more than one, you pack blend weights too).

Before rendering, you put all your bone matrices into vertex shader constants.

The bone indices in each vertex can then be used to index into the constants from within the shader - so you never have to touch the contents of the vertex buffers themselves, saving you any cumbersome lock/modify/unlock operations.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

alright, i think i'll stick with the vertex shader thing...

thanks guys!

flix
ALL YOUR BASE ARE BELONG TO US

This topic is closed to new replies.

Advertisement