Sign in to follow this  

Skeletal animation question.

This topic is 3296 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I use Tom Miller book "Kick Start" and downloaded the updated code for the his examples from thezbuffer.com I have the problems with skeletal animation. I use updated code for 13-th chapter to load two models from *.x file The first model is skeletal mesh(soldier) and the second is just static mesh(gun in his hand) I have the error in private void DrawMeshContainer(MeshContainerDerived mesh, FrameDerived frame) { .............................. else // standard mesh, just draw it after setting material properties { device.Transform.World = frame.CombinedTransformationMatrix; ExtendedMaterial[] mtrl = mesh.GetMaterials(); for (int iMaterial = 0; iMaterial < mtrl.Length; iMaterial++) { device.Material = mtrl[iMaterial].Material3D; device.SetTexture(0, mesh.GetTextures()[iMaterial]); mesh.MeshData.Mesh.DrawSubset(iMaterial); // here my program crashes ((( } } } Program crashes when I try to draw the gun. Microsoft.DirectX.Direct3D.Direct3DXException was unhandled Message="Error in the application." Source="Microsoft.DirectX.Direct3DX" ErrorCode=-2005530516 ErrorString="D3DERR_INVALIDCALL" StackTrace: at Microsoft.DirectX.Direct3D.BaseMesh.DrawSubset(Int32 attributeID) at Chapter13Code.Form1.DrawMeshContainer(MeshContainerDerived mesh, FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 279 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 180 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 187 at Chapter13Code.Form1.DrawFrame(FrameDerived frame) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 192 at Chapter13Code.Form1.OnPaint(PaintEventArgs e) in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 162 at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at Chapter13Code.Form1.Main() in D:\Source\MySource\LF\SkinnedAnimation\Form1.cs:line 440 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() I don`t understand why it happens as there`s a texture loaded and mesh data, though DrawSubset provokes such error. When I comment the drawing of standard mesh then skeletal mesh is rendered without problems. Or when I comment drawing of skeletal mesh then standard mesh is rendered without problems. I use VS2005, DirectX SDK August 2007. Could you please help me or at least give the idea of such strange behaviour. Thank you.

Share this post


Link to post
Share on other sites
Enable unmanaged debugging for your project, make sure the debug Direct3D runtime is installed, and run your application again and look in the debug output window for information from the runtime on why your call is invalid.

Share this post


Link to post
Share on other sites

Thank you very much for feedback and your attention, as I`m debugging it nearly for a week and really appreciate the help.

I have DirectX SDK August 2007 installed I think it should include all I need.

I enabled unmanaged debugging for my project. And run debug,
this is what I have couple of times:

Managed Debugging Assistant 'LoaderLock' has detected a problem in 'D:\Source\MySource\LF\LostFuture\LostFuture\bin\Debug\LostFuture.exe'.
Additional Information: DLL 'C:\WINXP\assembly\GAC\Microsoft.DirectX\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

Then I see the error I already noted previously.

I could load skeletal mesh and static mesh from different classes but I have two meshes in single *.x file, and the problem arises when I try to load skeletal and static mesh from the same .x file.

Any example I found has the drawMesh method in the windows form that the mesh is displayed on, but im trying to create a class that i can use to load and draw any of my meshes.
I take Tom`s 13 chapter as foundation for this class

If my explanation about what I`m doing are insufficient I`m ready to provide correspondent information.

Thank you very much for your attention.



Share this post


Link to post
Share on other sites
I also have that book and have also had that error. It occurs when you try to load an *.x file that does not include animation data. If I can remember right, it has something to do about the MeshData not been set. What you can do is during the creation of the mesh in the AllocateHierarchy class, check if the mesh has skin information. If it is present you can use that routine, otherwise you should draw it as a normal mesh.

Share this post


Link to post
Share on other sites

This topic is 3296 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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