NEW: Irrlicht optimized Blender DirectX8Exporter

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

NEW: Irrlicht optimized Blender DirectX8Exporter

Post by jox »

I have modified the DirectX8Exporter python script by Arben Omari to make it work better not only for the Irrlicht engine and also added a lot of features.

Please get more infos and grab it here:

http://www.mindfloaters.de/blender/

I hope it works a little bit and I'd appreciate some feedback!

:)
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

I'll test it at some moment this evening, thanks a load!! :)

lots of additions there, congrats :)

check your PMs... :)
Finally making games again!
http://www.konekogames.com
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

Hi , been testing it a bit.


Ultimate Unwrap flips the skeleton or the mesh in z direction, as u seem to have prevented...but...would be nice a new setting: invert also in ..I think x axe, not sure if is Y...
No, I'm almost sure, it's Blender's X axe.

as it flips back the z to good position, but the character skeleton is facing to his back , though correctly inside the model.

So it be nice also an x flip setting too.

very useful all those settings, they are life saver.

BTW, it did not trigger a graphical UI, I just edited the values in the script in some point where I so them with some values predefined...like invert normals = 0 and things like that. It worked.


It yet does not translate the root movement, but that's a limit in Ben's script, and he though of a workaround...moving the root using ...well, not the armature in oject mode, but in ctrl+tab mode, bones posing mode (bone sturn blue) This mode, when u just select all bones with A key, and hit g (or gx to move in x axe, etc...) you move all skeleton, but not origin!

This clever way allows jumping, crouching straffe jump to the sides, etc..so needed in fps, but also needed in any human animation. Avoids the coder later on trial and error relocate th echaracter, an dusually without the artist help.


Well, I have used it with a complex file I have for hard testing the ben script...

it is an fps model I have, (i terribly weighted it; using only automatic blender weighting, no careful setup, just to test) in which I wanted to use:

-Ik Solvers
-empties that will be used as pinning objects, so I can glue feet to the floor while I pose th emodel in any way.

It works if I just hit a in bones mode and hit i loc rot size , so it skeyframes every bone whenever I see I made a keyframe on f any bone or object in the timeline.

This way, it bakes it all, so though the script can't read ik solvers and stuff, it can use it as I make it.

Well, the fact is thanks to your modification and settings, it seem to load well in deep exploration demo, and...Ultimate unwrap, though a weld model, vertex-only, is needed. Not a prob, any Ultimate unwrap knows how to do it. And happens way often importing x animations.

the only needed thing, probably , in Ultimate unwrap (so to be able to export to several engines from there) is maybe the x axe flipping of..I think the skeleton. Maybe that'll do all.

As i said, I have the work around I explained for any one to use it on the origin (I meant origin, th eorigin of the armature, hope I wrote it well, I'm too tired now, the origin must be in 0,0,0, while you have interest on the armature be jumping and all to make it cool) surely will do the trick, as all other errors I had before seem to have gone away with these complex sample file I made... I guess in Ultimate will only be needed the weld...Ultimate has a normals fix too, but I see you can even recalc normals trough the script, so,perfect.


In conclussion, if u add a flip X axe, it'd be great :) , and in general, this makes Blender+ x exporter, in certain aspect, more powerful than Character Fx comercial tool, as with empties and good knowledge of ik solvers, and Blender in general, you can do some sort of joint pinning, In no way as good as Character stuio's or XSI's one, buit HEY! it can be done and witha free product!

Quite a good news for character animation for irrlicht.

I needda makes some harder test though, today I'm too tired now...
Finally making games again!
http://www.konekogames.com
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

Vermeer, thanx for testing! First, I just released version 1.0a fixing 2 things:

Version 1.0a - September 20th 2004
- Meshes without an armature are now exported properly
(not writing one closing bracket too much anymore).
- Flip faces is now OFF by default.

Hm, the flipping issue... The thing is, that Blender uses a left handed coordinate system. So the Z axis points in the other direction as in the X format or the Irrlicht engine which use a right handed system. So it's gotta be converted somehow.

Ben did it with scaling the Z axis of the whole mesh/armature construct by -1. Actually just scaling the root matrix. This flips the faces so they have to get flipped back.

Ben wrote that this has to be done by the user itself. But I didn't really got it flippin the faces in blender so it gets exportet correctly. So I wrote the vertex reordering.

I also wrote a Z flip function for the mesh that flips the coordinates without scaling. But this leaves the skeleton wrong.
But now I found a better way to really convert also the skeleton from left handed to right handed without scaling it in Z. I will implement it these days.

Mhm, but the X axis flip issue seems odd to me... Can you describe this further to me?

I havn't looked at the animation export that deeply yet, because I'm animating the stuff in realtime in my app. But I might risk glance at it...

Yes, please test even harder! :)
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

Duh, sorry, the version 1.0a doesn't work at all. It has a stupid typo in it that causes a python error! was a bit too tired yesterday... so get version 1.0b :)

http://www.mindfloaters.de/blender/
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

could it be that the latest 1.0b maybe is not exporting well animation?

as I see that some viewers are not loading the animation...(deep exploration demo and meshview from MS. Ultimate Unwrap loads well the skeleton animation, leaving the origin joint at 0,0,0 while all armature jumps as I animated it. Only think is as I told you, is inverted in z, and though I set invert z, x axe keeps inverted to in relation to the mesh. But yep, I think you told me is it uses right handed or something.I was mentioned by Ben something about this and Ultimate Unwrap...)

Others viewers showed the animation, and served me to test the move all-bones-but-leave origin at 0,0,0 and see that it works. So, jumps and whatever needs armature reloaction , is exported...

But now I can't get meshview to load the anims, only the mesh, is like if it detetcted no animation... Same happens with Deep Exploratuion demo.

BTW, Ultimate Unwrap has that issue I told you; needs a flip in z, but also in x.
Finally making games again!
http://www.konekogames.com
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

vermeer wrote:could it be that the latest 1.0b maybe is not exporting well animation?.
I didn't change anything in the animation part of the script... did you try the older version (1.0)? Does it work better/differently?
vermeer wrote: BTW, Ultimate Unwrap has that issue I told you; needs a flip in z, but also in x.
Seems that some apps don't recognize the left to right hand conversion by mirroring the Z axis... I had a model look ok in DX MEshView but beeing mirrored when loaded by a DX exampe app...

Im working on the other conversion method. I'll make it so the user can specify which axes get mirrored.
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

I've made a significant update to the exporter (version 1.1). It should fix a lot of issues especially concerning export of animations.

http://www.mindfloaters.de/blender/

@vermeer: please test!

The origin animation thing I might take a look later.

Code: Select all

# Version 1.1 - September 23rd 2004
#   - Fixed bug in the armature hirarchy export.
#   - Added real right to left handed coordinate system
#     conversion (as opposed to scaling Z axis by -1).
#   - Added animation speed option. It can be chosen from
#     'DirectX speed' in frames per second (base is 4800 ticks
#     per second) or frame number based animation.
#   - Now periods (".") get replaced by underscores ("_")
#     also in the animation part of the export.
#   - Made file handling saver by always closing opened file
#     even when errors occur.
#   - Switched positions of buttons 'Export' and 'Exit'.
Last edited by jox on Thu Sep 23, 2004 6:09 pm, edited 1 time in total.
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

I'm on it now ! :)
Finally making games again!
http://www.konekogames.com
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

Cool, vermeer. Something just came in my mind. I think I know now what you mean by the X flipping issue... it's not flipped, but in blender the Y and Z axes are swapped. It's like as if it's turned by 90 degrees in the X axis... This means in Blender:

left/right = X axis
front/back = Y axis
top/bottom = Z axis

In DirectX's and Irrlicht's and many other coordinate systems it's like this

left/right = X axis
top/bottom = Y axis
front/back = Z axis

To export things correctly from Blender to X I always used the top view as front view and the side view was always tilted. But this happend naturally since I imported things from Wings3D, and got fixed by itself after exporting it to X.

Is it maybe the point you where talking about?
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

a video capture here (you'll need divx codec, just others did not worked well):

HERE

but consider I weighted it using just pick vertex to closest bones, that is, the automatic weighting of Blender, so it's pure crap weighted, u can't even flex his arms well...

I did so as I only wanted to do a quick rig for test.

That's why u see at th eend of anim the weird, weird polygon in the knees, and many other.

I only needed a weld model push of button in Ultimate Unwrap.But this is common when importing x models in many packages, also ultimate unwrap, so no one is gonna get scared for it. And is th etouch of a button...game artist we are too used to do this stuff everyday.


The flip of handedness is done correctly , I set stuff in the script (heh, that is put 1 or 0 in the values list jox made, pretty straight forward, dumbs proof...;) )

Indeed, now that i exported and checked the file exported from ultimate (Ultimate does not show ever well the anim,it deforms bad, for a graphic glitch, but internal data is treated correctly) the thing is seen perfect, I mean, only having the HUGE errors I made for making a several-seconds-rig just for testing.

Conclussion :
It's working here in any viewer. And as u see , thanks to a tirck that Ben told me , that is, moving(g) all the bones in pose mode (ctrl+tab, bones are blue) allows to make jumps, changes of position.As a matter of fact, this is the only way to do so for an armature if wanna keep the origin at 0,0,0. To avoid problems, I set to 1 the setting jox did put for ensuring origin is where it has to be.

And very, very, very handy all the otehr settings...the timing was needed...some viewers understand in different ways the speed, I guess u have to check with ur engine, in this case, irrlicht.

Congrats here to Ben, and Jox.

Now it's actually possible to do the stuff.. :)


for what I am seing, this works in deep explo demo, mview from ms dx, and ultimate unwrap. Quite a success... :)

Just u need to familiarize with with the settings jox made available, as well as with, of course, some editing in blender, and even more, bones animation.

Two tricks to make really full animations with no limits, as u usually do in games :

- IK SOLVERS are n ot supported. Using an Empty as an ik solver , so that if u move the empty, all the leg chain will react "obeying" the empty. Same way, if u move all armature (picking all bones in pose mode) the foot will be glued to last position empty has. Not perfect, but quite average solution for Blender not having yet proper joint pinning(like XSI or Character STudio have). For this to work, is important that : each leg is a separate chain (not a new armature!! And make the spine chain parent of the legs chains.It's well read by x viewers and exporters, no probs. I realize u need to know VERY well how to animate characters in blender(I am not a good animator in blender, but the tool is complex) to not get frustrated... ) As I said, ik solvers are not supported by the x exporter. Workaround that Ben did thought of, was selecting all bones every where you see an empty (nla editor, for example) or an IPO keyframe, in whatever the bone or empty, you go select all bones, and hit "i" keyframe SizeLocPos. This way u "bake" the ik solving and constrains, to just the rotation and position each bone is having. Do so only in the frames that have the tiny quad of a keyframe in the time line. I mean, avoid doing it in ALL the frames, as doing so ur overloading the file of data to be processed later for the engine, and I guess you don't want that.

As u see, another issue that is not found in packages like Max, where in the x file it gets only keyframed what changed, doing files mor eoptimals...wether if this impacts something in todays hardware...just I don't know.

But hey, Blender is free, not 3500 $ , LOL.



-Second important trick, jump, crouch. What i explained before. Go to pose mode(select armature, ctrl+tab)... [ select the ONLY ONE armature for this (you didnt do two armatures; u made the spearate leg chains just entering again in edit mode,(with armature only selected) and instead extruding an existing joint of a bone, you just position the cursorwhere u want to start the leg chain (near the hip, I suppose) and hit "add" then "bone", this understands is in the same armature, just separate. U need to parent later it to the spine, as is the rest of the skeleton, don't forget.) ] ... hit "a" key, so to select all (it actually toggles) , and when it all is light cyan instead of blue, hit G (or gx, gy, gz, to do in axes directio only, unless ur already in side, front , top view (1,3, 7 etc) which I recommend) so to drag and move all the skeleton while this indeed is not moving away origin from 0,0,0 . So is the only way to go with the exporter.

pant.

I could write hamlet twice to tell all what is involved to teach the bit of blender I know...and I'm a newbie...

So, you must actually know at least strongly the basics of blender, and bledner animation of bones (of course, weights) If not, u'll be lost. (there's nice doc online, the only way for not very experienced 3d users.)


Oh, last thing...my interest, if ever do something not in xsi in x, but do in blender, was in ultimate unwrap, that works..so i checked better now in mview...U perhaps (it sometimes depends on the model, but seems these work) would like to try these settings first, as if I am not wrong, should work in most situations with mview, is what I used, and opened totally perfect the whole thing in mview (BTW, jox, I change the settings in that part of the text script (I don't see any gui when I hit alt+p) if it is changed in other area, please, tell them ;) (the fact is that this works, just set the values like that bellow)) :

(oh, and btw, the original object was imported as OBJ with the ideasman script, I don't model in Blender. )


# Configuration default settings
INVERT_NORMALS = 0
FLIP_FACES = 0
EXPORT_XSKINMESHHEADER = 1
EXPORT_ANIMATIONS = 1
FLIP_Z_AXIS = 0
RECALC_VERTEX_NORMALS = 1
RESET_ORIGIN = 1
EXPORT_DX_SPEED = 1

# DirectX speed values
FRAMES_PER_SECOND = 25
DIRECT_X_TICKS_PER_SECOND = 4800

# left to right hand conversion
if FLIP_Z_AXIS == 1:
ZMUL = -1.0
else:
ZMUL = 1.0
Finally making games again!
http://www.konekogames.com
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

sorry, jox, was testing in blender as was writting th epost, to stages, so didnt see that last post.

yep, that I mentioned, that blender has different axes set for scene...

but...dunno if that was the problem, as..well, my mind is confused now. The fact that I care, is that I don't know what you did, but it works now setting flipping z... :) I leave as is that othe roption about handedness...I guess it does it.

In conclussion :

All works now. Al lwith its particular workaround, but i am too used to find this -even at jobs- to be very scared about it ;)

And anyway, the path is done for the next people to come.. ;)
hehe

Now hoping at some point Blender gets a better way to pin joints...well, anyway, many indy artists don't care about it if a foot sink a bit on the floor, or slides...But i really do. ;)

SO, the tricks are told. With some blender knowledge, all above should be doable for anyone with that little knowledge.

anyway, you or Ben, whatever the improve comes (if u see any, and u feel in the mood, u could be adding it to this irrlicht customized one...or whatever the solution is prefered ) will be welcome.

In general, a very good news for blender-irrlicht users :)
And poor(but patient) people ;)
Last edited by vermeer on Thu Sep 23, 2004 7:08 pm, edited 1 time in total.
Finally making games again!
http://www.konekogames.com
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

vermeer wrote:(BTW, jox, I change the settings in that part of the text script (I don't see any gui when I hit alt+p)
Huh?! What OS are u using? How do you run the exporter? What do you mean by alt+p?

I use windows and if I choose File->Export->DirecX8 then a little context menu appears in which I can choose between:

- "Export to DX8 file format"
and
- "Help & Configuration"

Is that not what you experience? :?
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

hehe, Jox, this is very curious...


Here's happening something strange.

I just pick your *.py file. Open it in text editor. (blender text editor, you know) And once in the text, I hit ALT+P, as is the way you always execute an script in Blender, of whatever the thing. Python script are executed so there...

The fact is before 2.34 , the dx8 version was not included in the export dialog, so I had to run the script as I told you, indeed I do so with ideasman OBJ import script, and with many others... :)

I guess what you are doing is simply replacing the script that comes with 2.34 distribution, with your version, is it so?

i should have thought before. Maybe that's whty i don't see an UI where i can change the settings, anyway I don't mind to control it by text, I like it too :)
Finally making games again!
http://www.konekogames.com
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

huh

maybe I don't have the good python version (2.3.4 I have, and blender 2.3.4)
and that's why I see not the settings butttons. But I told you I just edite the text i ndefaults setting section and works.
Finally making games again!
http://www.konekogames.com
Post Reply