Jump to content
  • Advertisement
  • entries
  • comments
  • views


Sign in to follow this  


I posted this in the DirectX forum as well...I'd really love to find a solution to this problem so I can continue on with my magnificent game lol. I've been working on this issue in one form or another for about 2 days now...and about 20 hours. I've gone through about 10-15 potential solutions, and I got NOTHING! AHH.

I've recently ditched my own 3d model loading/animation class in favor of D3DX's implementation. I've had some pretty good results so far, though as soon as I try to animate the models (in my game), everything blows up.

I first created my own SkinnedMesh class roughly based off of the Direct3D skinned mesh samples included in the SDK. I got it in-game....and un-animated meshes were displayed fine, though when I tried to animate the model, it just disappears or blows up into a bunch of random triangles.

After trying to find the error for a few hours, I just copied/pasted the sample code right out of the SDK in hopes that I'd done something stupid....though the model still blows up as soon as I tried to animate it.

Next I referenced the tutorial here on GameDev by Jason Jurecka ( CLICKY ) and tried to implement his code...still the model isn't displayed as soon as I turn animation on (In my game). This tutorial was quite useful because he based it off the same DXSDK code I based my SkinnedMesh class off of.

The weird part is that both of these programs display the animated .x model perfectly when I run their app, but as soon as I try to put it into my game it blows up. Specifically as soon as I call the SetTime() function of the D3DXAnimationController associated with the model, and pass in anything other than 0.

I'm using Visual Studio 6.0, and one of the first versions of the DX 9.0 SDK. Which just adds to my problems. The SetTime() function of the animation controller class has been taken out (a few years ago :-p) so that could have something to do with it. Though everything works perfectly in Jason's example and the example from the (older) DirectX SDK, which both use the SetTime() function.

I can't use a newer verison of the DirectX SDK because:
- They don't support Visual Studio 6.0 anymore
- I can't seem to get my exported animated .x files to work in ANY of the DirectX sample programs, or in the MeshViewer program included in the newest versions of the DirectX SDK.

I have two working examples that compile fine, and display my animated .x file perfectly...though as soon as I try to implement those classes into my app....the animation doesn't work.

Some other notes:
- When I pass 0 into the D3DXAnimationController->SetTime() function, the first frame of the animation is displayed correctly, anything higher than 0 blows up, only in my game though.
- The number of bones loaded is correct.
- (To those familiar with the example code that I'm talking about) I've done a lot of debugging of the problem, and it looks like the contents of the "ppBoneMatrixPtrs" member of the D3DXMESHCONTAINER_DERIVED class are getting set to some crazy values right after the first UpdateFrameMatrices() call...I don't understand why this doesn't happen in the two examples I mentioned previously. I stepped through the samples and as soon as I hit the first UpdateFrameMatrices() call, the values are a lot different than in my game. They get initialized to the same values but after that first call the matrices look a lot different.

I've isolated the model rendering code as much as possible, commenting out every code path that isn't necessary to display the model, and get input from the keyboard...and it still blows up. I've tried setting the same RenderStates as the examples and that didn't help.

I'm about to start with the Direct3D skinned mesh sample and slowly phase MY game code into THEIR sample app and check it out at every stage to see when the animation stops working...this is driving me crazy...I've been working on this for a few days, and I need to find a solution. Any help/suggestions would be GREATLY appreciated.

- Dan

Here is a screenshot of what I do have in-game though...too bad the damn animations don't want to work...

Sign in to follow this  


Recommended Comments

Have you tried moving from VC6 to Visual C++.NET 2005 Express? It's free, and would allow you to use a more recent SDK.

Share this comment

Link to comment
Guest Anonymous Poster


sorry, no idea what goes wrong, but some thoughts:

yes, you can try what superpig wrote

but it is possible that the new vs und new dx sdk will break other things, because ms like to simply change stuff without a thought on existing code

"I can't seem to get my exported animated .x files to work in ANY of the DirectX sample programs, or in the MeshViewer program included in the newest versions of the DirectX SDK."

it this not a good reason NOT to use the .x stuff!?

so it seems not only the code is broken when using newer version of the dx-sdk, also ms broke the datafilefomat

is there a reason why you don't further use your own stuff and only wrote the new render/shader code?

Share this comment

Link to comment
The reason I want to use MS's .x stuff is that it supports vertex weighting also, the file format I was using (.ms3d) does not support vertex weighting at all :-( I was hoping to cure the stiffness of the player models by using the D3DX code.

Upgrading to VS .Net 2005 was one of my "solutions"...it CRASHES as soon as I try to install it!! I tried porting to VS 2003 and it blew up, and the .x files won't load on newer versions of the SDK...it would be a lot easier for me to just get this working in VC 6.0...and there's really no reason it shouldn't work :-(

Share this comment

Link to comment
Alright I fixed the problem!! mcguile25 mentioned something to me about the order I call the GetElapsedTime() function and the SetTime() function. I switched the order of the two and now it works, that makes sense.

I was jumping through hoops to fix this problem...I'm so relieved it finally works!

Alright...back to work!

- Dan

Share this comment

Link to comment

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
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!