Sign in to follow this  
StratBoy61

Optimizing animation

Recommended Posts

Hello, Just a quick question : I have a 3D scene that display a hundred of 3D models. They are all the same though, same model, same texture, same animation... I noticed that if I animate the models, I go down to 12FPS. The whole scene displays about 60 FPS with no animation at all. Does it make sense, or could it be something wrong with my animation code ? The animation searches for the current frame, finds the matrix associated with it and updates the model's vertex buffer. Obvisouly, it does this for my hundred models. Is there a way to optimize it, as I am using always the same model --but with different steps in its animation ? Should I try loading in memory all the vertices associated with all the animations, and just switch directly from one vertex buffer to another, without going thru the creation of the matrices ? Does anyone know of best practices ? Thanks in advance. Cheers StratBoy61

Share this post


Link to post
Share on other sites
You are never exactly at the time your frame starts

so you find the 2 frames you are in between and interpolate these frames with SLERP

SLERP == spherical interpolation


You shouldn t use LERP since linear interpolation might/will lead to choppy animations under certain circumstances


lookup SLERP at wikipedia there s a formula right at the top of the page

[Edited by - Basiror on November 8, 2006 6:14:05 AM]

Share this post


Link to post
Share on other sites
I'm not entirely sure what you're doing, but from the sounds of it you're manually animating each model by changing the vertex buffer on the CPU. In which case this would be a perfect place to move the work into a vertex shader - you could use a static (or largely static) vertex buffer and let the graphics card do most of the work for creating the various animation poses.

Share this post


Link to post
Share on other sites
Quote:
Original post by OrangyTang
I'm not entirely sure what you're doing, but from the sounds of it you're manually animating each model by changing the vertex buffer on the CPU. In which case this would be a perfect place to move the work into a vertex shader - you could use a static (or largely static) vertex buffer and let the graphics card do most of the work for creating the various animation poses.

Yeah, it makes perfect sense !
I started working with vertex shaders but I had not made the link with skeletal animation. Just found a paper on the internet that explains all this.
Thanks a lot.
StratBoy61

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this