Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

3 Dimensional Chat / DirectX Exporter for Blender 2.49/2.5

Author
Message
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 8th Mar 2010 09:42 Edited at: 30th May 2013 05:42
Hi all,

This is the official project thread for my DirectX Exporter for Blender 2.49 and 2.6x.

The scripts can be used to export Mesh, Armature, and Empty objects. For more information on the data types that are supported by the script, please check information page for the script you want to use. You can find the information pages below.

This project has come a long way since it started. It has been accepted into the final release of Blender!

Here are links to the current versions of each script:

Blender 2.6x (In the Blender Extensions svn. Save both files into a folder named io_scene_x.):
- Blender 2.6 DirectX Exporter

Blender 2.49:
- Blender 2.49 DirectX Exporter - Latest Version: 2-9-2011

To keep this page uncluttered, here are links to pages with information about each script. Please check these pages for information about installation, use, and anything else.

Blender 2.6x Information (On Blender's wiki. Very detailed):
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/DirectX_Exporter

Blender 2.49 Information (I threw this together rather quickly, sorry about that. Email me if you need help.):
http://talraarchive.webng.com/blender249_directx_exporter_info.html

If you have any questions regarding the scripts, feel free to email me.

Happy blending!

Recent Updates:
Update 5-29-2013:
- Updated links

Update 2-9-2011 for 2.49:
- Brought the 2.49 exporter up to speed with 2.5. Whew!

Update 2-9-2011 for 2.5:
- Added support for engines that don't natively recognize the AnimTicksPerSecond template.

Update 10-24-2010 for 2.5:
- Fixed Full Animation armature support.

Update 8-21-2010 for 2.5:
- Completed implementation of Full Animation. Now works for objects and armature bones.
BMacZero
User Offline
Joined: 30th Dec 2005
Location: E:/N_America/USA/ California/South
Posted: 8th Mar 2010 16:34
Awesome! I need to update Blender and get this .

Duke E
User Offline
Joined: 10th Mar 2009
Location:
Posted: 9th Mar 2010 11:47
Interesting.

I have recently looked in to rewrite the Blender exporter (the 2.42 one written by Arben Omari) it has a flaw in the way it exports to left handed (Flip Z button in the exporter script).

What happens is that when Flip Z is used the bone mesh is inverted This will have a few ramifications when you export it in to DBP (tested some quick fixes with the projection matrix though other things came in between).
The first problem being stencil shadows, where i first noticed this. It will invert the shadow projections. Second problem is if you want to angle a bone in the armature manually in code, I was using MView to weld and optimize a armature model and it altered the bone angle axis setup so X becomes Y.

Will be following this project with interest

Regards
leo877
User Offline
Joined: 6th Mar 2008
Location: san antonio, tx
Posted: 10th Mar 2010 18:54
kira download and gonna give it a try..be looking forward to furture upgrades
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 12th Mar 2010 09:22
Thanks for the consideration, guys.
I'll be home at my dev computer soon enough and things can start up again. Please let me know of any bugs you come across or suggestions you might have.
Madscientist
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 12th Mar 2010 21:46
You should make a good error system so that if the bones are not parented correctly or some else is wrong, it notifys the user exactly went wrong without spitting out some nonunderstandable message or just a "Error, could not export"

If it hasn't exploded yet, I haven't touched it.
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 14th Mar 2010 21:21
I'm back in town now, so development will start up again.

@Madscientist: I'll be sure to add that in. I mean, if for no other reason, it just makes sense that I can only make better what I know went wrong for people.
greenlig
User Offline
Joined: 30th Aug 2003
Location: Melbourne
Posted: 15th Mar 2010 02:26
Very interesting looking, Kira. Will this work with 2.5.2?

Your signature has been erased by a mod as it is far too big.
General Jackson
User Banned
Posted: 15th Mar 2010 02:48
What are the chances you would write an .FBX exporter for Fragmoion? Soooooo many Unity 3d users would be wildly greatful.
At the Moment I can find NO program to export my animated 3d models to .fbx with

Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 15th Mar 2010 03:18 Edited at: 15th Mar 2010 03:19
@greenlig: Thanks Chances are that it will not. The Blender team seems to be rewriting a lot of the Python API, so the program might be broken. I haven't messed around with 2.5 very much yet, but when the beta is released, I will certainly look into updating the script.

@General Jackson: Well, at the moment, not so good. I'm pretty tied up with my current projects. I've never used Fragmotion, and I've never touched the .fbx format either, so I'd have to do quite a bit of research. Sorry. Maybe someday I'll look into it though.

Edit: Though as Microsoft seems to be trying to push .fbx in .x's place, it might be necessary soon.
General Jackson
User Banned
Posted: 15th Mar 2010 04:48 Edited at: 15th Mar 2010 04:51
Ok, cheers

{edit} to inspire you to write one here is some of my Unity game.
I need animated models because ATM I have to only do movements by scripts




And I would be willing to pay some money if it worked

Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 15th Mar 2010 16:10
That looks pretty good. I like the normal-mapping. I'm going to finish at least this project before attempting .fbx, but honestly, I have no use for this exporter. In the mean time, you might want to look over this thread. I think someone's already been developing one, but I don't know how far they got with it. If all else fails, you could try writing it yourself. Python's an easy, beautiful language.
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 21st Mar 2010 13:51
Hey, I'd like to let everyone know that I'm still working on this. I'm having some trouble wrapping my head around the math with armatures, but it's certainly within my reach

I'm also ironing out a couple bugs I found with what I had already, such as a bug that cause textures not to export, and another involving transformation order (Blender transforms coordinates in XYZ order, but to us here in "Y is up" world, This is XZY. Oops )

I'm also working out some issues involving the way Blender does parenting. I've got a long road ahead, I guess, but it's getting done.
entomophobiac
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 22nd Mar 2010 15:53
This is one of the most promising projects in a long time!

The biggest flaw with the TGC pipelines, in my opinion, is that there are none. There are tons of incoherent features, but there's not a coherent ready-made pipeline. Unless you pretend that it works with .3DS as well as advertised, of course.

The first development in a long while that I'll be bookmarking. =)
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 23rd Mar 2010 13:39
Thank you for the enthusiasm!

How do you mean, about the TGC pipelines?
entomophobiac
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 23rd Mar 2010 15:29
The asset pipeline; how you get your model from a creation suite (3D Studio, Maya, Blender, etc.) into the game, including textures, shaders -- everything.

For DBP, I've always had trouble with animations. I've never managed to iron out how to export from any of the tools I've used. Not from Maya when I was in school, and not from Blender, today.

It's just not working as it should -- even for objects that export to .X correctly, DBP/GDK treats it differently.
entomophobiac
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 9th Apr 2010 08:50
So, Kira, making any progress?

I've been looking for a Blender 2.5 DirectX exporter, but it seems that there isn't one at this point.

I'm not sure how the APIs differ, either, but I guess I could look into it in the not too distant future, as it would be neat to move on to the newest version whenever it leaves the Alpha stage.
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 10th Apr 2010 03:16
Yes, but it's been slow going. I'm getting caught up with writing the model in the coordinate system of the target engine instead of writing it exactly as it is in Blender and then applying some kind of transform to correct it. The latter is what the shipped exporter does and alas, if I don't succeed soon, I'm going to head down that road too.

Yeah, I couldn't find any information about an exporter for 2.5 if one exists.

The new API seems to change the way data is accessed, but I think there should be an acceptable substitute for each method that exists in the 2.49 API. Updating my exporter shouldn't be too much of a task. Maybe I should submit a finished copy of my exporter to the Blender team and save them work?

I'm kind of excited for 2.5, but I guess I have mixed feelings what with the UI overhaul they're doing. We'll see.
entomophobiac
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 11th Apr 2010 22:30
I like what I've seen so far of the 2.5 version. It's a huge step up from 2.49, I think. Especially to new users. But it's also got a long way ahead of it, before it's even comparable to 2.49.
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 12th Apr 2010 10:09
I just did a bunch of looking into the new features in 2.5 and I must say, I am very pumped. I can't wait.

On another note, I've solved it! I've come up with a way of converting transform matrices between coordinate systems and it's so much simpler than what I was doing.

What I was trying to do was extract various information out of the matrix (stuff like position, euler angles, scale) and construct a new matrix in the target coordinate system. I had a little function to do this and I must say, I was about to jump off a bridge.

I just had an epiphany and discovered this:
TargetSystemMatrix * BlenderObjectMatrix * InverseTargetSystemMatrix = TargetSystemObjectMatrix

Where TargetSystemMatrix is a matrix that transforms coordinates from Blender's system into something else, like DirectX:
+ Code Snippet
And where BlenderObjectMatrix is an object's transform matrix in Blender's system.

Anyhoo, with this, I am able to take a huge step forward and finally move on with the project! Results soon!
entomophobiac
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 12th Apr 2010 10:58
Awesome! Animation has always been a problem with DBP/GDK, as far as my experience goes. This can only be great news. =)
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 14th Apr 2010 01:01
Alright! Update!

At current, the script exports any static mesh, including textured meshes, and meshes deformed by an armature. The only thing left to go is animation. So far, object animation is working, but has issues when parenting is involved. Bone animation is not supported right now, but I'm still working at it.

I've redone the UI to add in another option and add an Option Help panel.

Again, to install the script, just drop it into the .blender/scripts folder and restart Blender.

Lemme know what you think.

Attachments

Login to view attachments
entomophobiac
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 16th Apr 2010 20:04
Technically, you don't need to restart Blender. It's enough to go to a Scripts window, Scripts menu and select Update Menus. It reloads the scripts.


Great stuff, anyway! I'm using this as my default exporter at the moment, and it's working out great. =)
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 16th Apr 2010 22:17
That's a good point.

That's great news! I'm glad to hear it.

I'll have animation up and working soon, and then it'll be finally v1.0! Wow, I just realized I've been working at this for about a month and a half.

Anyhoo, I'm all ears for suggestions or bugs.
BMacZero
User Offline
Joined: 30th Dec 2005
Location: E:/N_America/USA/ California/South
Posted: 17th Apr 2010 00:51 Edited at: 17th Apr 2010 00:53
Next model I do, I'll do it all in Blender (as opposed to mesh and some UV in Blender, UV in Lithunwrap, and animation in CharacterFX - whew!). That should be a good test.

Edit: You should update the original post with the newest version.
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 18th Apr 2010 00:15 Edited at: 18th Apr 2010 02:01
@BMac: Thanks I'm looking for all the feedback I can get, so that would be wonderful. And yeah, I will once I finish up v1.0. Not too much longer. I've finished object animation with parents, so now it's on to bone animation! The final frontier!

Edit: Came up with a little banner
+ Code Snippet

greenlig
User Offline
Joined: 30th Aug 2003
Location: Melbourne
Posted: 18th Apr 2010 03:39
Kira, your work here is really, really good. Thanks so much for the effort you are putting in!! This will make life a lot easier for a great many users, and that can't be ignored.

Good luck with your efforts!

Greenlig

Your signature has been erased by a mod as it is far too big.
haliop
User Offline
Joined: 2nd Sep 2008
Location:
Posted: 19th Apr 2010 12:00
TY! i was looking for a newer one!
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 19th Apr 2010 20:44
@greenlig: Thank you for the kind words.

Things are going more or less smoothly, but I've been having to cope with school deadlines that shorten my available time. Ah well. Updates soon, I hope.

entomophobiac
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 21st Apr 2010 14:26
Keep up the good work, anyway! This stuff is golden. =)
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 24th Apr 2010 09:47
v1.0 is here!

I've updated the original post. Check it out!

Ultimate_H
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 25th Apr 2010 22:32
Not sure about anyone else, but for some reason your most current version no longer works, all I get is a blank file.

The previous version of your script exported the model, so i'm not sure what happened.

Using Blender 2.49, and trying to export a simple cube doesn't even work anymore.

Much Appreciated
-H

Check out my tutorial on how to make windows, and make them work with DarkGDK
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 25th Apr 2010 22:49 Edited at: 25th Apr 2010 22:56
*facepalm* Sorry, I forgot to uncomment the call to the export function after I was done debugging.

You can change it yourself if you want to by uncommenting line 64.

Otherwise, I'll have the fixed version up in a couple of minutes.

Sorry about that.

Edit: There, I've update the original post. Thanks for telling me.

Ultimate_H
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 26th Apr 2010 00:31
Sweet, it's working now.

Tried exporting a model with an animation and armature, and works beautifully.

Many thanks
-H

Check out my tutorial on how to make windows, and make them work with DarkGDK
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 26th Apr 2010 00:44
That's excellent news!

Thanks for testing it.

entomophobiac
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 26th Apr 2010 12:51
This IS excellent news. =)


I'm likely to move on away from the GDK in the upcoming future, but I'll be hanging on to this exporter. Great work!
Ultimate_H
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 26th Apr 2010 21:31 Edited at: 26th Apr 2010 21:53
So, I did a little more testing, and found something weird with the UV exporting. for some reason, some of the UV's look fine, while others are getting butchered. I added a zip file with a box that is UV mapped and textured with some numbers, also added a blender file that shows the box with the correct uv's.

It looks like some of the faces are being flipped, while others are not.

[edit] oh, one other thing: I noticed that the whole UV coordinates were flipped upside down, and after a quick cross reference to the old exporter, i changed + Code Snippet to + Code Snippet and that flipped the whole thing the right way (about line 589)[/edit]

Many Thanks
-H

Check out my tutorial on how to make windows, and make them work with DarkGDK

Attachments

Login to view attachments
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 26th Apr 2010 23:58
Weird. Thank you for pointing this out. I don't really understand why the V coordinate needs to be flipped, but using your edit only solved half of the battle. I then reversed the winding order on all faces when exporting to left-handed systems, and that seems to have fixed it. However, I caught a bug that caused right-handed systems not to export correctly that I would've overlooked had you not said anything. You can find the updated version now in the top post. Thanks again

Ultimate_H
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 27th Apr 2010 04:41 Edited at: 27th Apr 2010 04:42
tried the updated version, and its still giving me issues, I tried copy/pasting a good set of UV's into the .x file, and it looks exactly the same, something tells me its actually the way the verts are being positioned. it's like some verts are being rotated two positions counter-clockwise (see image below). What's strange is that it does it to some faces, and not others.



Hope that makes sense
-H

Check out my tutorial on how to make windows, and make them work with DarkGDK

Attachments

Login to view attachments
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 27th Apr 2010 04:54
*facedesk*

Sorry, I forgot to uncomment the line that controlled the face winding order. I really need to start checking these things before posting

The version that's up now works for me. I hope this is the solution

Ultimate_H
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 27th Apr 2010 05:01
Works perfectly now, thanks for fixing it so quickly!

Have to say, this "little" project of yours is a God-send for me, cause I had been worrying about the .x exporter for blender, and this is a ton better.

Many thanks for the quick updates, and the awesome exporter. Definitely gonna use it for a long while.

Much appreciated
-H

Check out my tutorial on how to make windows, and make them work with DarkGDK
Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 27th Apr 2010 05:07
No problem at all

I'm really glad you find it useful! Please let me know about any other issues that come up so I can take a look at them.

Good luck

Duke E
User Offline
Joined: 10th Mar 2009
Location:
Posted: 28th Apr 2010 01:41
I have to say great work on this, many thanks!

Some reflections after re-exporting my game models, maybe it can help some fellow Blenderites that have used the old (inferior exporter)...

This script is more picky about the animation links than the old exporters. I have to say this is a good thing though.
I had some console errors when first trying to export a previously working rigged model. Was able to narrow the error down to the mesh itself. The armature parented to another mesh (used a sphere) exported with no errors. But the mesh itself would not export with another simple armature.
Seems i had link errors in the mesh itself the old exporters failed to catch. Was unable to find the error in the lna or action editor. Append/link did not work as Blender saves this information with the mesh itself. I exported the mesh (used Collada 1.4) and re-imported it then appended the original armature.

And what was good with this? I gained performance, quite noticeable too.

The exported armature bones have perfect rotation, no inverted bones. So shaders should not have any problems with vertex normals now.

DBP animation frames starts at zero on model exported with this script. Started at one with the old exporter, so i had to adjust some animation frame ranges one step back in my code.

It is necessary to apply a material and manually add the texture in the material editor to a mesh prior to exporting. Old exporter only needed the texture applied in the UV editor, no material was needed.

Thank's again, Kira.

Regards
Lemonade
User Offline
Joined: 10th Dec 2008
Location:
Posted: 28th Apr 2010 06:39 Edited at: 28th Apr 2010 06:46
Awesome! I don't know how I didn't see this before. Now get it to work with version 2.5, please! I've been wanting something like this for ages.

Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 28th Apr 2010 07:59 Edited at: 28th Apr 2010 08:01
@Duke E: Thank you for your feedback. I would be interested to see the .blend files that caused the console errors, as I should try to write in a good error handling system. As for materials, yes, this was intentional.

The frames starting at 0 was also intentional, as I wanted the exported model to loop smoothly with the loop object command without using a different start frame. I think I'll add in an option to set this later.

Your feedback is valuable to me, and can only make this script better. Thanks

@Lemonade: I certainly hope to in the future. Also, as Blender 2.5 doesn't currently have a DirectX Exporter, I think I might touch it up (More than a touch-up. I'll have to rewrite the entire thing using the Blender 2.5 API and Python 3.1.) to be more applicable to other engines and begin the process for getting the script into the final distribution of Blender. That would be pretty cool

Edit: Just noticed. Thanks for spreading the word, Lemonade!

Lemonade
User Offline
Joined: 10th Dec 2008
Location:
Posted: 29th Apr 2010 08:22
Np.

Does the script export settings like smoothing? I imported an object from blender 2.5 into 2.49 (that could be the problem), and when I loaded it into DBP it looked like there was no smoothing.

Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 30th Apr 2010 01:52
The script should export normals exactly as they are in Blender (2.49). I'm not exactly sure of what you're saying. You exported an object from 2.5 and loaded it into 2.49? Which format did you use? After that, you exported the same object using my script and loaded it into DBPro?

Ultimate_H
User Offline
Joined: 11th Mar 2009
Location: A place that is neither here nor there
Posted: 30th Apr 2010 02:32
Sometimes when you export an object (depending on the exporter/format) the faces all get split up, so if there's a corner where four faces meet, instead of having one vert there, there are four.

I've noticed this happen usually when I exported 3ds files from Anim8or/Truespace and imported them into Blender.

Hope that makes sense
-H

Kira Vakaan
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 30th Apr 2010 08:57
Another bearing the banner!

I think that's pretty common. That's what my exporter does, along with the old exporter. I know that there is a VertexDuplicationIndices template for the .x format, but I haven't done much looking into it. DBPro splits everything into separate triangles anyway.

Chris66
User Offline
Joined: 12th Aug 2009
Location:
Posted: 30th Apr 2010 12:01
Thank you Kira for this great exporter script... definitely a must have !

Login to post a reply

Server time is: 2016-05-26 20:19:48
Your offset time is: 2016-05-26 20:19:48