This topic is now archived and is closed to further replies.


dx9-anim. Implementing ID3DXInterpolator for pos-slerp.

Recommended Posts

Hi. Im using D3DXLoadMeshHierarchyFromX to load a "scene" created in Maya. Everything works fine except that the default interpolation (ID3DXKeyFrameInterpolator) is using lerp for the translation keys. This makes my smooth nice camera movement appear jerky compared to how it looks in Maya. I would like to use my own implementation of the interpolator instead. The problem is that i dont really know how to do that. D3DXLoadMeshHierarchyFromX probably uses D3DXCreateKeyFrameInterpolator to create the interpolator either directly or via the animation controller (when creating the animation-sets from file), but i see no real way to force it to use my implementation. Is it possible to override D3DXCreateKeyFrameInterpolator with my own code? Or is there any other way to achive what i want to do? If not i guess i have to revert back to the dx8-way and parsing the x-file myself, something i would like to avoid. Regards, Aron

Share this post

Link to post
Share on other sites
Hi again.....

Don''t know if anyone is interested but here''s how i solved my problem.

First i implemented ID3DXInterpolator and created a version that uses slerp for translation, then after D3DXLoadMeshHierarchyFromX has created the animation controller i do they following:

Repeat for all animation sets:
-* Get animation set (ID3DXAnimationSet)
-* Get all interpolators for set (all keys for one frame in every interpolator)
-* Create a new empty set of interpolator pointers
Repeat for every interpolator:
--* Get name and find the frame it controls (frame has same name)
--* Check if the meshobject in the frame contains skinning information
--* If yes, add the interpolator to new set
--* If no, extract data (all keys) from interpolator, use information to create a custom interpolator and add this to new set.

-* Create animationset from new interpolator set.
-* Remove old animation set from controller
-* Add new set to controller
-* Set track to use new set

This gives me an animation controller that lets the standard interpolator (ID3DXKeyFrameInterpolator) animate skinned meshes and gives control to my own interpolator for animation of static meshes that moves, like cameras, cars etc..

(Only problem now is that i found documentation about changes in the next update of the dx9 sdk and it seems like they will change the way animation works again...)

Aron j

Share this post

Link to post
Share on other sites