DirectX X 3D File Format
Simple facts to generating a complete x-file set of loader's and container
classes for use in all your gaming needs. As the DirectX .x file format
can accomodate all your 3D gaming needs, from simple mesh's to complete bone
animation characters.
|
Understanding the DirectX X File Format Layout
|
|
Well its always best to see how it ticks inside before writing code....well
take a few seconds to go through how the .x file format lives and breaths.....as
its a complex beast beneath its thin outer shell.
Just for references purposes, I've included the .doc version of a .x file
format spec that I found on the net... which is great to look at while your
writing your .x file format parser/loader. Official File Spec Document.
|
Using DirectX API's to Load/Parse our .x File
|
|
Lets grab a compiler and code this baby!... and lets read this information
into our code...so we can actually make it work for us.
Prt-1- Loading the Mesh's
Prt-2- Applying Frame Hierarchy (Bone Structure)
Prt-3- Animation
|
Writing a Custom .x Loader/Parser
|
|
Who needs the DirectX API's? Well we can write a parser/loader that
will read in our X file format 3D data just as good! And it gives us a
greater understanding of how things work - and for those new to things like
skinning...bone animation...mesh hierarchy.... well its a great way to learn and
apply your knowledge. You have to be patient with these tutorials - as
they start of simple...and get harder and harder and harder - but believe me,
the end result is well worth it.
Prt-1- Starting that 1000 mile journey
Prt-2- Picking out the data
Prt-3- Adding extra's
Prt-4- Binary .X File Format Parser
Prt-5- .X Binary Parser GUI Dialog Dump
Prt-6- 3D Max MaxScript Exporter
(.ms) Binary
|
Demo Programs - Rendering/Loading of X Data/Files/Characters
|
|
Well I thought I'd write some demo's which will implement a loading and
rendering of various .x files - some of the demo's include full character
animation, others are plain loading of a mesh and rendering. But hopefully
they will be of some benefit.
|
Full Skinned Character Animation |
Source Code |
Executable Demo |
|
|
DirectX 9.1 .x Loader 2008 Version. I
sat down and totally re-wrote the parser/loader so it can cope with more
cases and is well more structured and simpler. Demo here lets you drag
and drop .x files into the app. |
Source Code |
Executable
Demo |
|
DirectX X Direct X Direct-X- X File Format X DirectX X
File File File X .x x parser x loader DirectX API X File Skinning X Animation X
File Mesh X API
|
Simple Models - 3D Max to .X |
|
I know how hard it is to find some simple .x character animation models on
the net, so I did some simple mesh animated models in 3D Studio Max 6, and
produced the corresponding .X 3D file - which includes a basic run animation.
You can use these models to test your .x loader code as you go along, or see
just how easy it is to generate mesh characters with 3d max.
Description |
3DMaxFile |
.XFile |
ScreenShots |
A simple...I mean very simple example of
character creation, using a block man and character physique tools. |
BoxMan.max |
BoxMan.x |
|
|
|
|
Homer...our lovable friend from the Simpsons.
I've not done homer justice in this small 3d model - but its a fun example.. |
Homer.max |
Homer.x |
|
|
|
|
I took the simple rabbit mesh from one of the
.max demo's, and added bones and some animation. Still needs a bit of
work with the texture mapping etc - but its a cool 'Alice in wonderland'
rabbit ;) |
Rabbit.max |
Rabbit.x |
|
|
|
|
Fantastic professional level model - low poly
and is very eye catching. I've only put basic bone linking and the run
animation, but is a great example of character animation. |
WispModel.max |
WispModel.x |
|
|
|
|
|
|
|
|
|
|
|
I used the PandaX Exporter which you can download free on the net. I've
only done a simple run animation for the models, but you should be able to
easily add other animations....as all you need is the run and stand animations
for you to do a simple test level of a game :) And believe me, with homer
running around your own little level is sweet....but I'm sure you could do loads
of other cool models.
|