Anyone familiar with .x files?

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Kernozenko
Posts: 14
Joined: July 28th, 2016, 3:37 pm

Anyone familiar with .x files?

Post by Kernozenko » February 18th, 2017, 10:46 am

Hey,

I have been following some tutorials on loading 3D models from .x files, using D3DXLoadMeshFromX and D3DXLoadMeshHierarchyFromX. These tutorials provide the files to load and they work no problem. However I wanted to mess about and practice with other models. So I downloaded some from various sites.

The problem I ran into is that most of the ones I downloaded do not work. The LoadMesh\MeshHierarchyFromX functions fail. The values of mesh, materials, animations are all NULL. Everything I downloaded was free(such as from TurboSquid) so I could understand some not working but I did not think so many would not. Many of the files I downloaded were also not in .x format and I ended up using greentoken.de(again free) to convert them. Perhaps that causes a problem?

Anyway, my thinking is that there is something not quite right in those files. And that perhaps I could alter them to work. I understand a little bit of what is going on in there but not enough to know what to do. Does anyone know? Or am I completely wrong with my reasoning? And it is something different entirely causing problems? It does not seem like there are any alternative functions to D3DXLoadMeshFromX and D3DXLoadMeshHierarchyFromX. Unless perhaps making your own but I wont even attempt that!

I realise that this is probably a very broad question/subject so I do not expect any comprehensive answers. I'll appreciate any help or pointers in the right direction.

Thank you in advance.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Anyone familiar with .x files?

Post by chili » February 18th, 2017, 4:04 pm

D3DX function are all deprecated now, meaning you should not be using them anymore for writing new code. I think the .x format is dead now (maybe somebody else can confirm/deny), so if you wanna do 3D look into manually loading mesh data into vertex buffers. The .ojb format is pretty popular, as is .fbx, so you can find open source libraries for that stuff that will make your life easier.
Chili

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: Anyone familiar with .x files?

Post by MrGodin » February 18th, 2017, 4:11 pm

The X file has gone the way of the dodo bird, just ask David Duchovny. haha
Curiosity killed the cat, satisfaction brought him back

Kernozenko
Posts: 14
Joined: July 28th, 2016, 3:37 pm

Re: Anyone familiar with .x files?

Post by Kernozenko » February 18th, 2017, 5:24 pm

Nice MrGodin, I like it!

Ok so that's a bit of a problem... Any chance you could do a video on manually loading mesh data into vertex buffers just for me Chili? :lol: No? Didn't think so...

On a serious note, I will be looking into that but any helpful hints or tips on how to get started? That sounds quite advanced. Let's assume that I only know what you have covered from your tutorials. Original Beginner to the current 3D. Is that enough knowledge to do that? I guess my question would be, what do I need to learn to be able to achieve this?

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Anyone familiar with .x files?

Post by albinopapa » February 18th, 2017, 7:28 pm

Open up a .x file and see how the data is laid out, some .x files if not all are are in text format so should be easy enough. You just need to learn to use the file streaming (ifstream) api to be able to read in the data. OBJ files are also in ascii text format, and are pretty easy to read.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: Anyone familiar with .x files?

Post by MrGodin » February 18th, 2017, 8:03 pm

There are some .obj parsers on Github that work. I assume you are working in directX 9 if you are trying to load .x files. I have a model/mesh class and obj loader kicking around that loads a mesh into DirectX 11 vertex and index buffers, it's a bit janky but it easly loads single meshes.
I've posted a solution that has the loader in there
http://forum.planetchili.net/viewtopic.php?f=3&t=3726
It is directx11, but you can take a look at it
Curiosity killed the cat, satisfaction brought him back

Kernozenko
Posts: 14
Joined: July 28th, 2016, 3:37 pm

Re: Anyone familiar with .x files?

Post by Kernozenko » February 18th, 2017, 8:56 pm

Thanks albinopapa! Yeah I was afraid that would be what I'd have to do... I think I'll give up on the .x files. I don't even know where to start with them but the .obj files look a lot more organised and much easier to read from. So I'll get on that and no doubt I'll be back here asking stupid questions in no time! And thanks again!

Kernozenko
Posts: 14
Joined: July 28th, 2016, 3:37 pm

Re: Anyone familiar with .x files?

Post by Kernozenko » February 18th, 2017, 8:58 pm

It is Directx9 yes, MrGodin. That's great! I will definitely look for the parsers on GitHub and look at your loader. That is fantastic! Thank you very much!

Post Reply