The fnal word on Direct X

Hi all,

I have been recently trying to export my models/animations in the X format. I have been studying this forum to try and figure it out.

Here is what I have accomplished:

I have successfully exported a static mesh to X format and displayed it in other viewers.

Here is where I have failed:

I am unable to export animations but think it might be because I don’t have all the vertices assigned to a bone.

My models appear hard edges when viewed in external viewers except when I use this exporter
http://directpython.sourceforge.net/exportx.html

This exporter also creates a file way smaller than the 4 other X exporters I have tried but the UV map is always fubared.

Why does the built in exporter(and most others) create such a huge file? I work hard to create a small model and texture for a game and then the size is exploded on export. I don’t like this.

I do not have the understanding of python or Direct X format to figure out what I am doing wrong. It is simple trial and error for me as well as this post. A cry for help!

Thanks,

Andy

At the risk of sounding trite, have you considered attaching each and every vertex to a bone? I dont see the point of saying you cant export animation when you admit you probably haven’t set it up properly.

As for the file sizes it’s becasue the exporter producing the smaller files (by your own admission messes up the UV mapping) doesn’t export the UV co-ords while the bigger file sizes will have correct UV mapping as those exporters have exported all the extra vertex information to reproduce the UV mapping. Yes, the UV vertex info is largely duplication of the mesh data but there you go.

Truth is the DirectX format isn’t very good and the neither are the DirectX exporters. What application are you trying to use them in? Does it handle better formats?


http://www.digital-air.co.uk/

I am looking for answers here not someone who is critical of Direct .x format.

Truth is the DirectX format isn’t very good and the neither are the DirectX exporters.

At the risk of sounding patronizing, please guide me to the light. Which 3d format that supports animated meshes do you prefer? Why is it better? Why is Direct .x format terrible?

If I decide to continue with Direct .x.

Does every vertex need to be assigned to a bone? T/F
Can each vertex be assigned to multiple bones? T/F?
Is the .x format that I mentioned not saving UV co-ords? Why would the UV co-ords increase the file size by 4 times?

Thanks again,

Andy

First I never said it was terrible. I use the best format for the job. In my case that’s .b3d for my own 3D engine, you never said what your final application is or what models they support. DirectX isn’t well supported from within Blender and the format doesn’t support 2 sets of UV co-ords meaning in my application I’d have to run two copies of the model, one for the model and one for the light map.

In my experience with Blender’s built in DirectX exporter, yes.

In my experience with Blender’s built in DirectX exporter, no you shouldn’t do it.

Dunno. Do file sizes really matter that much? How big are the files? Generally game developers are really only interested in the texture sizes as they will end up in the “finite” video card ram where space is at a premium. Best concentrate on getting a decent model exported first before worrying about file sizes. Anyway, Mview (Microsoft’s .x viewer app) can optimise the model to remove any uneeded information (from the MeshOps–>Optimise menu).

Your best bet, if you’re sticking with DirectX, may be to export using either .b3d or .fbx and buy a third party application that can convert to DirectX such as Ultimate Unwrap or Fragmotion.

Or take an interest in the Apricot project which will look to develop the pipeline from Blender to other game engines but will probably involve newer formats such as .fbx or Collada etc.


http://www.digital-air.co.uk/

Hi

Interesting to see your post on this as I have been studying the Blender .X file exporters in the last few days.

I am trying to get an aeroplane mode out of Blender into a flight sim game, but the stumbling block I keep hitting is how to cope with anims.

The two . X file exporters that I have been comparing seem to have different issues to resolve. (I think both of these are in the default Blender 2.45 install, cant recall for certain now)

I am using 3D Exploration App. to view the exported models, this is quite old now but is a really nice 3d Viewer Application (available as Shareware)

Here’s what I have figured out so far

I tested some simple objects with and without Anims

Exporter 1

The model looks OK’ish, texture and geometry look basically correct in 3DE

Noted the following problems

  1. Smoothing groups are lost, all faces appear solid
  2. Vertex count is increased 4 fold or so.
  3. Animation is not viewable in 3DE App. The file with anim in appears as 0 frames total in 3DE

Issue 1)
I dont currently understand how .X files specify smoothing groups, tying to find info on this.

Issue 2)
The script exports vertices from the face list hence duplicates verts. I would need to re-write this to export from the vertex list to fix this problem. (Exporter 2 works this way I think)

Issue 3)
I think I have figured out why 3DE cannot understand the anims. My hunch is that it is the fact that the exporter uses anim key type 4 (16 element combined matrix). To fix this I think it needs a rewrite to use separate key types (Scale, Translate, rotate).

Exporter 2 (DP version)

The model looks a bit screwy on intial viewing in 3DE

Noted the following problems

  1. In 3DE if I flip all face normals, the geometry now appears OK.
  2. UV material map doesnt display
  3. Smoothing groups are lost, all faces appear smooth. This is puzzling as it is the exact opposite problem of Exporter 1 ?
  4. Animation is not viewable in 3DE App. The file with anim in appears as 0 frames total in 3DE

Issue 1)
The face normals appearing the wrong way around, might be easily fixed with a script mod ?

Issue 2)
Dont know why the material is missing, havent investigated that problem yet

Issue 3)
Not figured out how the smoothing groups are specified yet.

Issue 4)
Anims missing is same problem as decribed above, need to not use key type 4

If anyone can explain how the .X file format is meant to handle smoothing groups that would be appreciated as I cant find anything so far on the web ?

Regards Geoff

It would be nice if one of the experts would write a tutorial on exporting using this format. I know it is an old format but I believe it is still widely used.

Here are a few issues that I have come across for exporting:

  • only one armature

  • mesh must be parented to armature, not using modifier stack

  • only one bone in armature with no parent (master bone) so no control bones or IK

  • no envelopes or weight paint. vertex groups only.

  • each vertex can be assigned to only one bone.

  • every vertex must be a member of a vertex group.

  • delete everything in the scene except the mesh and armature before export.

Thats all I have for now. I have managed to export a mostly working animated mesh so I am making some progress. Like I said before, trial and error. If I ever get this thing figured out and no one else has stepped up I promise to write a clear and easy to follow tutorial for blender artists who are not programmers!

Also, if someone could send me a link to the microsoft .x viewer I would love to have it! I have found the source code and I believe it is included in the direct X SDK, but I’m only after the viewer.

DirectX exporter documentation:
http://xoomer.alice.it/glabro1/faq.html
The microsoft .x viewer:
http://xoomer.alice.it/glabro1/mview.zip

Ben

well the problem with blenders .x exporter is that it tends to split each poly apart and then save it . so like the default box for instance has 8 vertices right? well after saveing it has 36.

this means it not only creates vertices not linked to stuff, it also makes real time deformations in another engine impossible because of this.

this is my major gripe about the .x exporter. I can deal with the other issues to some extent, but this is the main reason why 3D studio max v6 with the panda exporter plugin is still in my workflow.

Hi Ouch

Regarding the exporter increasing the verts count on the cube.

This happens because that specific exporter dumps verts from the face list, so you would get 6 * 4 = 24 verts rather than 8

Try using the alternative X exporter, (the direct Python one suffix _DP) this code dumps verts from the vertex list, so you only get 8 verts.

Regards Geoff

DirectX exporter documentation:
http://xoomer.alice.it/glabro1/faq.html
The microsoft .x viewer:
http://xoomer.alice.it/glabro1/mview.zip

Ben

Thanks Ben,

Your example files work well so I should be able to get my own.

well the problem with blenders .x exporter is that it tends to split each poly apart and then save it . so like the default box for instance has 8 vertices right? well after saveing it has 36.

When I use Bens script on a cube I get 12 faces and 24 verts. After welding the mesh in MS MView, as described in Bens tutorials, I end up with 12 faces (12 triangles makes sense) and 14 verts. The nice thing about this is that the UV mapping and animation remain the same.

Thanks

@ ouch, hi, slightly off topic but…
is there a difference using the panda exporter with max & the panda exporter for blender?
https://sourceforge.net/project/showfiles.php?group_id=184266
just interested to know why you still use max when blender should be up to it.
m.a.

It’s not so simple! The reason why the exporter increases the vertices number,
is to mantain all the UV texture coordinates(very important for game models).
If you have different texture coords for every face you need the vertices counted
any time its changes.Getting only 8 vertices in the cube may loose the texture.

Ben

Hi

I can’t get any files I export to view at all!
Using Blender 2.45 and trying to view them with DXViewer
All other x files I have work fine but not Blender exports.
As far as I have been informed the text file MUST be save as a DOS unformated.
This should also apply to exporter script.
One thing I did try with a simple cube was
1: open the x file in notepad.
2: select all the text and CTRL C
3: close notepad
4: create a new txt file and paste CTRL V then save the file
This was able to be viewed by DXViewer but it was not a complete cube.

Alex

Hi alexedwin

Can you post a link to your .X file that doesnt display in the DX viewer ? Shouldnt be too hard to spot the problem if it is as small as just a single cube.

  Geoff

Hi Geoff

I finally got it to do what I need.:cool:
There still may be other issues with the script, but I got around the problem
I needed to set UV mapping ON
But it still don’t explain the reason why it would not work without texture.
Alex

Also, Is it possible to make seperate animations in Blender and then combine them into a multiple animation somehow? I thought maybe you could do it in DXViewer but I have not figured out how.

THanks

I just use it for viewing and I think that’s all it does

By the way, in response to my own question, you can the way to combine single animations into a multiple animation is
to export each one individually in blender, open up the .x files in notepad, and find the “animation set” sections of the x-file and paste them all in to one single x-file.

But also in response to the above:

  • only one bone in armature with no parent (master bone) so no control bones or IK
  • no envelopes or weight paint. vertex groups only.

I use weight paint all the time and it works fine for exporting animations.
I also use IK all the time and it works fine (although I have trouble getting the IK to do what I want it to do, it always twist my model around wierdly).
Instead of control bones, you have to use an empty object. For a good example of this see Example 3 from http://xoomer.alice.it/glabro1/python241.html

dus .x support wated veracy’s? if i try to export a mesh with veracies wated other than 1 it comes out as a complete mess. even after following the advice here. it is completly imposable to produce acceptable deformations without vertex wating. short of asigning every single vert to its own bone.

Hi

Just for info

The link to the MS DX viewer given earlier in thread is a dead link.

Took me a while but found a live alternative

http://files.wildspad.com/afecelis/irrlicht/files/MView.zip

just tinkering with it now, looks rather neat !!

  Geoff