Skip to main content
GameDev.net gamedev.net
🔒 Locked

Loading X Models

Started by Overdunn Jul 31, 2007 at 2:34 PM 6 replies 1.2k views
Original Post
Overdunn
Overdunn
Hi, I'm trying to program a game with DirectX 8 but I'm having trouble loading x models. I got some free models from turbosquid and exported them with Maya 8.0 into X files using a plugin. I'm using the code library from Jim Adam's book "Programming ROle Playing Games with C++". I took the example where he loads an x model and rotates it on the y-axis and replaced it the model with the motorcycle from turbosquid. However, when I run the exe nothing shows up. My best guess is that the problem lies in the x-file exporter because I have no idea which options to pick so I leave them set at default. Does anyone know what i should do?
Overdunn
Overdunn
Nobody else knows how to load xmodels?
Odiee
Odiee
There should be a simple example in samples directory of sdk, that shows just that. And it is in tutorial section.
And you can check if your models are corectly exported with MeshView tool in DirectX under tools section.
jollyjeffers
jollyjeffers
There are a huge number of examples available online if you take the time to look. Pull out a few key function calls and throw them at your favourite search engine.

The data produced by .X exporters can be hit-or-miss as they're not always well written or supported. In general it's only Direct3D code that uses the .X format and even then it's a relatively small segment of the potential userbase. By and large most commercial outfits will use other file formats (or even their own custom ones) which means that .X is generally a neglected and unloved format.

Simple things to check:

1. Debug output, as Gage64 suggests
2. Return codes - are you getting any errors/warnings?
3. What dimension is your model? A classic screw-up is that a model is too big or too small to see on screen.
4. Change the triangle winding order from CW/CCW to NONE, you might be seeing nothing due to back-face culling.
4. Are you sure the geometry is the problem? Could be your texturing or lighting configuration that is at fault.

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
Overdunn
Overdunn
how do i check the dimension of my model?
jollyjeffers
jollyjeffers
D3DXComputeBoundingBox() is a good start, but it also depends what transformation matrix you're rendering the geometry with. If you're calling D3DXMatrixScaling() at any point you need to consider this as well as the 'raw' geometry.

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
BlindSide
BlindSide
Grab an old DX sdk that has the mView application on it (NOT the new meshviewer, that thing is pretty useless..) and then use mView to resave the X files in ASCII format (Just to be safe). This action usually saves people alot of trouble caused by exporters, and makes sure the model is exported according to MS's (Probably ambigous and random) X mesh standards.

A quick google on "mview download" wont do you bad.

Topic Locked

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

Sign in to reply to this topic.