Skip to main content
gamedev.net
🔒 Locked

Problem with loading skinned .x models

Started by Programmer101 Feb 25, 2007 at 9:53 AM 8 replies 2.7k views
Original Post
Programmer101
Programmer101
I have been loading a skinned .x model into my game that I generated in milkshape. When I use one exporter it works but when I use the other it fails at loading. Also when I use the exporter from Jim Adams' book "Advanced Animation in DirectX" it fails. The only difference i see between the model that works and the ones that don't is that the root bone is locked in the working one. Does anyone know why this might be happening? BTW: I'm using the directx sample code "Skinned Mesh" to load the model and the sample won't load these either but the "Load Mesh" utility will.
Asesh
Asesh
Are you trying to load that skinned mesh using ID3DXFile or IDirectXFile interfaces? Even I am having problems loading meshes with ID3DXFile. CreateEnumObject will return an error code indicating parsing error (D3DXFERR_PARSEERROR). It won't load any of my meshes (neither skinned nor non-skinned meshes) and neither Dx SDK's tiny.x. But you can load your skinned mesh using D3DXLoadMeshHierarchyFromX. I have the latest SDK (Feb. 2007) installed so maybe it's because of a bug in their API. Good luck :)
Programmer101
Programmer101
No, I'm using D3DXLoadMeshHierarchyFromX. I tried the other way but could not get it to work either. I have the December 2006.
JakeM
JakeM
Post a link to the DirectX file that won't load.
JakeM
JakeM
Well, first of all, you're missing some DirectX templates, so what I would do is make
sure you export the full set of templates. Or just find the full set and copy and paste
them into the X file.

Secondly, if you succeed in loading it into DXViewer.exe, the animation is going to
play extremely fast. To play your animation at normal speed, copy and paste this:

template AnimTicksPerSecond { <9E415A43-7BA6-4a73-8743-B73D47E88476> DWORD AnimTicksPerSecond;}AnimTicksPerSecond { 30;}


That should do it.
Asesh
Asesh
Guys can you tell why ID3DXFile::CreateFileEnumObject won't even parse tiny.x file? Here's the process to call it:
D3DXFileCreate(...)
pD3DXFile->CreateEnumObject(filename, ...);

It won't even parse any of my meshes not even tiny.x. It will return an error code indicating parsing error but DirectX viewer loads it correctly. Try loading tiny.x and let me know. Thanks
Programmer101
Programmer101
Alright. Thanks everyone! Where would I find the templates?

Also the December version of viewer throws an error when I run it with or without a model file but an old version works.
JakeM
JakeM
Sorry, I see your error. It's not exactly missing DirectX templates, it's bad ones.
Replace your templates with these:

xof 0303txt 0032template XSkinMeshHeader { <3cf169ce-ff7c-44ab-93c0-f78f62d172e2> WORD nMaxSkinWeightsPerVertex; WORD nMaxSkinWeightsPerFace; WORD nBones;}template VertexDuplicationIndices { <b8d65549-d7c9-4995-89cf-53a9a8b031e3> DWORD nIndices; DWORD nOriginalVertices; array DWORD indices[nIndices];}template SkinWeights { <6f0d123b-bad2-4167-a0d0-80224f25fabb> STRING transformNodeName; DWORD nWeights; array DWORD vertexIndices[nWeights]; array FLOAT weights[nWeights]; Matrix4x4 matrixOffset;}



Somebody put in a CSTRING where it should say STRING, I think.

If you want more DirectX templates anyway, just look at the Media samples
that come with the DirectX SDK, or grab a DirectX file from the web.
They are all listed in the SDK docs.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.