Modern vertex Animation help

Started by
6 comments, last by Digitalfragment 12 years, 8 months ago
Hey guys,

I need to animate lots of characters (about 40 less than 500 polys) at once, I tried doing it initially with a skeletal animation format but with some horrible performance which when profiled was the matrix multiples for all their skeletons. So I came to the conclusion that I need to use a vertex animation format, my understanding is that I have "snapshot" models at each keyframe and interpolate between them over time.

The only formats I know of for doing this are MD3 and MD2 which are kind of dated, are these the best formats for doing this? Is there something else more modern? Should I just write my own?

And finally I need someway to export this kind of stuff from maya 2012 (couldn't find any md2 or md3 exporters that would work ).

Thanks!
Advertisement
To perform animation at the vertex level like you described, you don't necessarily need to switch to a different file format. It sounds like you already have your characters animated using bones, so what you can do is precompute the set of full character poses at model load-time. (depending on how much data you'll be precomputing, this may or may not take too long)

Though, about 40 skinned characters with ~500 polys doesn't sound that much to me. You said you have profiled matrix multiplications, so it sounds like you are currently doing this on the CPU. What you can also try is

1) optimize the CPU-side skinning processing loops. Using SSE is good for this kind of task. Even without SSE, I think it should be very well doable to optimize the code to a realtime level (of course depends on your architecture and performance target, which I don't know).

2) If your architecture permits, use GPU vertex shaders for skinning. Vertex shaders are extremely suited for this task, and if you VS step is otherwise light in the scene, you might notice you'll get the skinning more or less "free", if the processing bottleneck was already somewhere else, like CPU-side frame processing or GPU fillrate.

Trying to do full per-vertex level (morphing/tweening-based) animation on the CPU will very likely be much more slower than using bone animations. The common way to optimize this is to also do the morphing on the GPU, by sending the required start and end poses to the vertex shader.

Perhaps people can give a better estimate if you threw to this thread your system specs, profiling data and/or the code you're using.

As the previous poster mentioned, you probably did something very inefficient in your attempt using bones.

Skinning 100 characters of around 4000 vertices and 237 bones each, on the CPU on a quad core I get over 60 fps.
Doing the same on the GPU goes much faster.

So if you do 40 characters with 500 triangles you should easily be able to do this without problems.
I would have a look at your code again, as you probably do something in a very inefficient way.

Also vertex based animation limits you in some ways, such as not being able to easily do inverse kinematics and other dynamic operations.
I highly recommend having a look at your existing bone-based code again. If you have any questions regarding that, feel free to ask of course.
Thanks for putting it in perspective guys I knew something was wrong with my results,

I don't want to do it GPU side though as shader support will vary in the different platforms im targeting. I was actually using a 3rd party library for the animation system, but I will be writing my own based on the MD5 format with quaternions.

Thanks Again!

So I came to the conclusion that I need to use a vertex animation format


You came to the wrong conclusion. Modern GPU's can chew through hundreds of thousands of skinned verts no problem.

I don't want to do it GPU side though as shader support will vary in the different platforms im targeting.

Are you sure about that? What platform would that be? I thought hardware skinning (by sending the bone matrices for each frame of animation embedded into a texture for the vertex shader to access) was the status quo now. Sources tell me this was done in like shader model 3 which only <5% of people don't have?

I don't want to do it GPU side though as shader support will vary in the different platforms im targeting.

Are you sure about that? What platform would that be? I thought hardware skinning (by sending the bone matrices for each frame of animation embedded into a texture for the vertex shader to access) was the status quo now. Sources tell me this was done in like shader model 3 which only <5% of people don't have?

[quote name='narpas' timestamp='1313870660' post='4851708']
I don't want to do it GPU side though as shader support will vary in the different platforms im targeting.

Are you sure about that? What platform would that be? I thought hardware skinning (by sending the bone matrices for each frame of animation embedded into a texture for the vertex shader to access) was the status quo now. Sources tell me this was done in like shader model 3 which only <5% of people don't have?
[/quote]


Along with PC (which is what I was testing on..)
Older iOS devices, android, etc.


Along with PC (which is what I was testing on..)
Older iOS devices, android, etc.


Older iOS devices are going to struggle no matter what you do, they really aren't that powerful. For those devices, you may need to consider either using a lighter weight scene, lodded skeletons, or constraining multiple models to using identical animation frames while CPU skinning.

We've well passed the point where writing code once and expecting it to work on all platforms is a valid strategy. The vast difference in architecture between the PS3 and 360 have proven this, especially if you have ever had to dev for the Wii or handhelds at the same time.

This topic is closed to new replies.

Advertisement