Does DirectX import/export even work?

I dont use DirectX i/o, and have no good testcase but ever since Iv been on this thread Iv seen complaints about directX support - and it that it dosnt work.

I also dont want to have to maintain too many of blenders scripts… and since I have absolutly no use for DirectX support Im not the best person to work on it anyway.

If its patchy or broken it should either be fixed or removed.
Like Cal3D, if nobody wants to maintain it, we cant keep broken scripts.

Of course, if somebody wants to rewrite or fix it that would be great.

Low quality scripts are bad since they lower peoples impression of blenders scripts… Iv heard comments like “None of blenders importers work properly” and Id like to change that.

It works for me

Pros:
I am using directx export script to export my models to Quest3D. It works quite well. I must admit that I didn’t export animations yet, but model export works OK. (I exported 40MB model recently without problems!)

Cons:
Some features are missing. There is bug with blender names with dots(mat.001, mat.002…) which causes error in M$DirecX viewer.

I havent answered no more questions(and I check this forum frequently)
about DX in this forum because are repetitive and can be solved searching
in this forum or reading carefully the faq page at
http://xoomer.alice.it/glabro1/faq.html .
But many people doesnt prefer this way… it’s too long…
People who needs DX exporter first of all, must know, how to use Blender
and some basics of DirectX(which is not true because most of them who
experience problems are at the first post here) in order to get good models.

It’s not perfect, has some bugs,isnt user friendly but it works and works well!!!
I’ve used it for many years with good results and know people who have used for fun
and commercial purposes succesfully.
As regarding the DX importer I’ve never considered it a neccessary tool for Blender
(if you check this forum since it has been created there are no more than 5 posts about it)
and I agree with you it’s a low quality script(imports only one mesh)…
I think people who create games needs to export the animated & textured models created in
Blender not to import them.There are other most suited formats to share models
from different tools(.obj for example).Thats the reason most quoted 3d apps
has no good x importers, as I know.
I’ll improve the exporter…when find some time(anyway cannot work anymore on the importer)

Thanks Ben

DX-export works fine for me, too. I’m using it for animated characters with armatures.
As said before you just have to read the docs to get everything working properly.

Can the people who understand the problems with Dx I/O but use it also, make a list of its limitations, or improvements and I can then try address those issues and you can test?

for example Mat.001 makes some app crap out… can re rename to Mat_001?

I am very happy to hear that! Would like to help. I can test it in production…How?
Thank you

Makes requests based on your experence with the script… eg

work with these name, maybe armature modifiers, give a meaningfull error in thie case etc.

upload a blend that should work but dosnt… Whatever seems most pressing,.

Hi All,

The exporter works marvellously! for static and animated meshes (as previously stated the users simply need to follow the rules).

However since users are most likely not always going to follow the rules here is my list of items that I have found:

  1. Try to export a model with subserf, the model exports fine from Blender but in DXviewer it crashes, perhaps the script could inform the user that subsurf must either be applied or removed prior to export.
  2. When exporting animated meshes if you perform the same export twice in rapid succession the output file size grows and the mesh does not work in DXViewer
  3. When you export to DX all the meshes are combined into 1 single mesh, is there any way we could export each mesh seperately while still being contained within the same DX file (Does DX support this?)
  4. When creating new meshes in Blender the double sided option is defaulted on(at least on my install), could there be some sort of warning to the user that the mesh may not display properly if this option is left set (sometimes the normals goes all weird in DX viewer).

I dont use the importer so I can’t help there.

If I can be of any assistance please let me know as I use the DX export script heavily.

it’s an old bug…corrected times before.The script renames directly
mats and bones by removing the point.

The most part of the problems is caused by the double vertices created
by the exporter in order to export correctly UV textures for any face
(fundamental for the who wants to create game models).That’s why the
exported file needs to be saved in DX viewer,to remove double vertices.
The way to fix this is to make an utility which creates a new indexed vetex
list based on their UV coords before exporting.
Anyway who wants to help can e-mail me and I’ll try to inlude their changes
in the exporter.

Ben

My absolute vote here for Ben and his scripts.

been a tester for his scripts since Blender 2.28c or so…Those times the script had more problems than now and I yet could use it.

I have helped in game engine forums a real lot to avoid problems with x format, with this plugin, with this 3d software, but also other tools, and other plugins.Bones and weights formats are problem bringers, and x has special bad luck in game engines; is usually that users don’t know the workarounds, don’t have the patience, or have a mesh that has some serious problems which pas unnoticed with other more tolerant engine loaders…

Common issues are often solved in game engines just opening the file in the free mview.exe from MS (yep, win tool, I dunno if can be used under wine) , as just resaving there, reformats stuff to work better. Probably also does a weld.

Also, there’s stuff than have been in Ben’s docs for years, if I am not wrong (as I was a tester, I dunno what was there, and what is that just i knew from allways of from other formats/tools ) , like: rename bone.001 to bone001 or the like, same with materials…x loaders often dont like those dots. In max x exporters you have another large collection of issues, which I also more or less know…

Basically, there are some things to pay attention to when do game meshes, specially characters: I have been years discovering that ppl with probs almost the 100% of cases are ppl not aware of some general rules.

But yup, if you can help ben in adding features that stop ppl without experience, finding those problems, that’d be great for them.

I my self am a Ultimate Unwrap user, there sometimes I do there extra fixes if some weird engine wont it a or b feature…

All improves are welcome, but wanted to be like a proof that the script works if you know what to do (like anyting blender…er…anything 3d… )

I know about the double vertices, ben and I anttended a case long ago…

yup, double vertices for Uvs are a royal need in games, there’s just allways shortage of texture pixels :wink:

probably…most of the newcomers issues are solved, (as mostly they’re game artists, or coders making art for free, inhouse or low cost engines) with some parsing of the output. Dunno. Because the parsing must be careful to not wreck the 3d data…I am not a programmer of any sort, so I don’t know about that part.

Imo, plugins for formats like x, md5, and the soon-to-be finished (the guy would have some help with something about matrices, I dunno) b3d (allows also lightmapped levels, with latest bake feature of blender) , would be cool to have an stable version of it included in Blender releases. As are plenty the main formats used for more number of game engines out there, free, inhouse, low cost, mid cost, etc.

I have solved many issues with this plugins, of users, and discovered too many times meshes with weird faults, lost vertices, bad namings, zero width faces , non triangulated meshes, etc…

I mean, I see very well your point cambo, an exporter that doesnt work for a user, makes the user think blender is acting badly, but also happens when user doesnt understand bledner UI and think it’s bad… Anyway, if out of this the plugin gets improved for these users…good for me, less questions to answer :wink: (tho lately I dont answer much for being very short of time to be in forums…Here I’ve solved very few, and quite long ago)

Darkbasic users have come here often, for this reason, as well as a big number of Irrlicht ones, even some from Gamestudio, some Quest3d , and some Truevision 3d ones. All these use directx *.x format…and there are quite more. Imo is an important format…

Problems like that of mat.01 , not only with this format, but things like ase or obj, I used to make my parser in an vb like system (yep, till there i can go, but not deeper, in programming…) , or use a text editor with “replace all” feature, as are all text files after all…

Some engines have even problems with the identation, if extra spaces, or certain carriage returns, will wreck it in the engine. this is for loaders being to picky, not exporter’s fault…

  1. Try to export a model with subserf, the model exports fine from Blender but in DXviewer it crashes, perhaps the script could inform the user that subsurf must either be applied or removed prior to export.
    here…is one of the things I was referring to…i rarely have used an exporter, of any format (i’ve used a load, be it vertex animation, or bones and weights, 90% of it for my sort of job during a long time) .rarely a game format, or the engine loader will like the Max stack, or the Blender modifiers, or any other package specific stuff in the export…you need to bake (like constraints, with x) , to “apply” , so to make it mere mesh, bones, weights and standard location, rotation, scale keyframes. Is what game formats, and game engines do understand.
    Never ever , at least with formats that have its age, I hope a non applied subdive, in whatever the tool, will be good food for an engine, an exporter, or even the format alone.

I have have to make this “bake” in many aspects with :

-XSI
-Max (md2, x, etc, etc)
-Blender
-Character Fx (nto a bake, but simply, there are terrible errors, like mirroring a bone, wich will make a full set of animations wrecked, for it messed later on the code)

I mean, sadly it’s about common problems in these formats/tools.

  • With this plugin , if you use constraints, you need to bake the action, or keyframe all bones in every frame, as you prefer.Doing so, works.(to be sincer, dunno if the feature has been added; long since last time I used x format, I went more and more to b3d and md5, merely for the format features, the specs, not the plugins. )
  1. When exporting animated meshes if you perform the same export twice in rapid succession the output file size grows and the mesh does not work in DXViewer
    I must admit I didn’t know about this.
  1. When you export to DX all the meshes are combined into 1 single mesh,
    I maybe wrong, but I have allways had an strong suspect x files can be one mesh only inside them, or if not, that many game engines only eat them well if so…no matter the tool used.

is there any way we could export each mesh seperately while still being contained within the same DX file (Does DX support this?)
MS3d format can do this, I think. Still, by code, if you can do in your engine, you could export from blender 2 animations, ie: animate the buddy with its sword as usual, but at export time, keep a master copy of it, and delete the buddy, export the whole anim then, the reload the master, delete the sword, export the buddy. In the game, load both anims, they match perfectly for the way it is done. This way as allways been done with md2 as the format cant allow two textures in a single mesh…

  1. When creating new meshes in Blender the double sided
    Yup, this is way unfriendly for mesh engines, I recommend all ppl making game meshes ensure first no double sides, and a ctrl+n to recalculate normals outside.Besides double faces are double count of vertices often, and terrible shading for overlapping faces (normals stuff and other issues)

Basicly, what I see is ppl use a highe end tool like blender, with not caring how game meshes must be…so they apply uber sofisticated modifiers and features, or even model with nurbs in other tools, and try to export that directly with no converting to mesh, triangulating etc.
Imo, little to do there. I learn by the “shock with your personal wall” method, never fails :wink: But in all my 3d learning, not only this.

Issues I can remember in a list…is long time since I dealed with x, but let’s try(“*” ones are those I am not sure is blender or any other package which I use, but certainly an x issue that better if avoided, or to avoid to do a cleaner job, or if have probs ):

Partial List

-when exporting, a 3d window must be visible!

  • don’t leave isolated vertices floating somewhere, not even one.
    -material names. Avoid or replace the “.” (no material.001)
    -same with bone names.
    -Unsure of this…i happened to find a prob, in both blender and max…with weight painting…probably for the “too much decimals issue” or certain averaging, the painted weights often force errors later on in engine, leaving verts unweighted, etc.Summarizing, I tend to prefer use selection tools, and asigning by buttons interface an specific value…and yep, in Max too, even tho sounds crazy (there I usually make use of mirroring weights and other helpers, so notlong time in good weighting…I have make some use of that mirror here too)
    -make real, apply modifiers, convert it to mesh.
    -Ctrl+A trick dunno if is yet needed with mesh and skeleton, it was needed in early ben’s versions.Needed to be done before parenting.
    • In other tools like max, a standard material, non multisubobject, does avoid certain probs in certain engines.
      -try to reomve doubles before weighting vertices.
      -constraints will need to bake the action or select all bones and keyframe every frame.
      -* avoid mirroring of bones. (probably no issue in blender, just max and cfx)
      -* Plot curves (in xsi, I post to give clues of the format)
      -* Material names starting with a number no good in other tools than blender (again, a clue for certain engines.)
      -convert to mesh.
      -triangulate.
      -check identation in the exported x file. A comparison of same mesh exported with some other tool, may help you deal with it. Here I admit some glance about this thing could be given, but probably is some game engine being too picky.
      -I tend to prefer to center mesh center, now you can do as well with armature…sort of good idea for game meshes usually…this is mostly a recommendation for games…Also, care about the scale.
      -cant remember if was with x, but several game formats actually do need the texture be applied in the UV editor, not only in the material.
  • parent all chains to one, don’t export independent hierarchies, in other tools and exporters happen this. There must be a root and hang from there. (Just went to the faq now and remembered this)
    -seems Ben also informs about the weld prob I mention above, but gives a full solution:
    “Mview(DirectX8 SDK).Click on MeshOps-Vertex Selection and click over the object to select a vertex.Now click on MeshOps-Weld vertices.In the popup window select “Remove Back To Back Triangles” , “Regenerate Adjacency” and “Apply”.Resave the file.This way will get a perfect DirectX File Format.”

As you see, it is: welding the double vertices, removing double faces that ended with normals pointed opposedly, (the third thing, I dunno if is for respecting normals and crease seams, and stuff…I usually use other converters and tools, tho that mview tends to fix all.Rarely not.)

-hey, seems ben added a lot of options in the GUI. So now, several issues I know of A or B engine, can be fixed at export time. Like swap zy axis (this is for most 3d tools and engines have y up, and bones and weights meshes are often a prob to rotate, is not as easy…)
-speed.This allows to solve the issue in some engine of displaying to fast or to slow. happens in more tools.
-two new normals buttons, which can only make life easier (but as I say, I exported quite a number of meshes at times therent even ui. Is more like features for those not knowing how to do that in blender…I suppose…)
-Flip normals is cool: several engines have strange loaders that invert normals.
-flip z. A pair of cases where I found that.

OH, btw.Am OIN at blender org…in case you have read the faq where ben gives thanks to me 8)

“None of blenders importers work properly” and Id like to change that.

I understand your point :cool:

BTW, Am using a lot OBJ import (I model in Wings) solution in Blender, and works like charm…

Feature request:

  • Multi UV texture layers(at least two) in export. In that way I can export texture and “lightmap” texture (for example).

whatever you do with the .x exporter don’t get rid of it. blender is used by a lot of dark basic programmers, and dbpro only rilly has good support for .x format. until someone codes a plug-in that will import .blend directly into dbp the direct x exporter is absolutely necessary

is there any way we could export each mesh seperately while still being contained within the same DX file

I know that .x files imported into dbpro can have separate limbs. I found this out wen I started messing around with the trial for dbpro and ms3d.

well I use the 3impact engine which has a physics engine built into it. The problem I have with the exporter is that it always splits the individual polygons appart. The engine determines things like mass and colisions based on the models closed hull design. the problem is that even if you make a sphere the exporter splits the polies when exporting. This means the model is no longer closed hull, and the alograthims to form the physics fail and crashes the engine.

Simularity if I make a simple plane that I want to use to make dynamic water waves in the engine I can’t because none of the polies are connected and the wave alograthim that moves the models vertices end up ripping the model apart instead.

this to me is THE number one problem with the exporter. However some support is better than nothing, do not remove it please…

Honestly I would really like something like panda exporter thats for 3d studio max in blender. But like that will happen overnight. :slight_smile:

(and this is just a very small sample of the tons of developers of other engines out there using x and blender :wink: )

I’ve used it succesfully many times…there’s allways a workaround for all engine related probs…

@Ouch

I forgot 3d Rad and 3Impact engines…they also use x files…

You seem then to be on Windows. You can use then for example Mview from Ms, (I have it and can upload to a free temp vault if you need it and i see this thread again in time) so to weld vertices after you have exported, it leaves the anim just the same…
This you could do as well with Ultimate Unwrap (which I used in the past for blender->x->any game engine ) , but is comercial, 50$.

mview is free.

Any chance we could get the Export script to export an animation set per action, I need to be able to have multiple animation sets per .X file so I can have an action for idle, walk, run etc…

Please forgive me for asking a stupid question, but I’ve managed to put some fixes into the .x exporter script, and I’d like to know where I can post it for review and possible inclusion in the next release of blender. To be specific, what I did was:

  • Fix up Frame and Material names that contain spaces, periods or start with a digit. (Not legal in Names in a .x file.)
  • The above was done in a single function, with all names being routed to the function, so that when maketrans and translate are in the python core supplied with blender, the funtion can be updated to map all illegal characters to legal ones.
  • Corrected a comment that is written to the .x file.
  • Removed some duplicated code.

post/link it here and Ill review- otherwise you can use blenders patch tracker.

Thanks for the prompt response.
Unfortunately, I can’t attach the .zip file to this post, and the file is too big to post.
If you send me an e-mail (mine is dteviot.at.iconz.co.nz, making the obvious substitution for at) I’ll post you the file.