IMPORTANT QUESTION ABOUT X loading code(blender exporter)

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

IMPORTANT QUESTION ABOUT X loading code(blender exporter)

Post by vermeer »

...talking now with ben, we need to know if it's possible to do the following in irrlicht :

- can you just load an x file , the human character, with all its animations, WITHOUT the weapon mesh nor a weapon bone in it, and then , have the same animation (the idea is delete the character mesh and its armature so to export only the weapon and its armature(skeleton)) but now delete the character, and export only the weapon and its armature?

i mean, would you be able to load then each exported x file, as far as the coords are exported and not changed, and load the weapon "in place" so that it just keeps moving and rotating so that it all the time keeps in place?

this was done with quake 2 and its md2 files and worked perfect, long ago....

It is due to exporter does not support yet several meshes nor sveral armatures in one x file. i even either know if x file format support several meshes and several skeletons,so , by all means, this seems would be a more powerful and safe way, what I am proposing.

need to know if someone have tried this in code in irrlicht and if can work...
Finally making games again!
http://www.konekogames.com
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

hey!

none knows?

:cry: :cry: :cry:

is to give better support to irlicht comunity, others does support this kind of loading... ;)
Finally making games again!
http://www.konekogames.com
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

I don't quite follow you. Are you talking about blending animation and meshes from multiple .X files in irrlicht?

BTW: Are there any tutorials on how to do armature animation in blender? I couldn't even find the command for assigning vertices to an armature.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

nope, not really blending, but... I meant, using two x files together in your code. The animation of the weapon, and the animation of the character, instead of loading several animated meshes in a single file.

While making the weapon animation not loose it's original position so it matches the hand position in every moment of the animation.


About armatures..

with the exporter there way many things to watch so it can export...the author is making now a huge upgrade, though...

to assign the verts of a mesh to the armature:


easy/unaccurate way:

(in this order)select mesh. (shift click now)select armature. hit ctrl+p. choose "create from closest bones" (here the importance of having located the bones in edit (tab) mode...)

that makes a rough weird weights assigning.


a more careful one could start now this way:


-select mesh.
-hit TAB (edit mode) key.
-click on the editing button (F9)
-at the top of the buttons, you have the corresponding to groups. you've already done them with "closest to bones" option. If you haden't, selecting a bunch of vertex, and creating a new group with exactly the bone name (capitols sensitive, and numbers, ie Bone.004 (remember to rename all bones first to not have the "." !!! previous to parenting (ctrl+p)))
But you have, so, the groups are allready created by u.

you now should now you have several ways to select in blender. right clik on a vertex or near it (beware, dragging and clickin again may move it) .Another is quad selecting (hit b key) . another is paint selecting. hit bb (b two times) , u enter in this mode, and can deselect painting with middle mouse button. (alt+left if u have not 3 button mouse) Right mouse button exits the mode, and u wont be able to do anyother thing till u exit!

the fine tunning is made so :
once u select some vertices, you now check you have the bone group you want for those (under "vertex groups") . And ..type a weight u want in "weight" (shift click on the field to type it, or drag the handles...)

set a weight so. hit furiously the "assign" button ;)
(allways in vertex groups buttons)

of course, th tweak will need that not loosing that selection,you drop down the groups list and choose the adjacent bone, and set a weight to it.

I don't remember now if it uses absolute value or normalize it. I think you must put weight to pass over it..like 1.0 and 1.0 will give 50% weight each, but not sure, you test it...

I just use to many bones softwares and tend to mix all...

beware also u can hit a twice, to select all or deselect all. Quite useful here, as usually once u select something u leave selected the previous if u didn unselect all or just right clik on a sigle vertex.

you have a way to select all what is assigned to a bone: choose the bone in vertex groups drop down, and hit select button.

the resulting selection...u can mid button paint with bb to deselect areas u don't want to tweak (usually u tweak the frontier areas, ellbows...)


Other way is vertex painting, but imhow is way less accurate, and anothe rlong explnation :)


selecting mesh, armature and hitting alt p will allow to remove parenting and all assignements.

but please, save very often and with different names.


once weighted, u can go to bones mode ctrl tab, and assign ur ik, rotate bones, etc to make the anim. The x exporter will only work if u later hit i key and hit locrotpos to keyframe in every where you see a dot in a frame in nla window.


previous to all that u need with N key to set mesh and armature to 0,0,0 origin location.

and selecting both, ctrl a.

i sometimes do that last after ading a material as somewhat it fixes exporting problems at the end stages... :?

Blender is way complex to handle...
and handling well the exporter, is hard too, trust me...
I just hav not time to mount a good tuts site for show how it it all works since beguining to start... :(

btw, I am moving to xsi I'm buying, is just wanted t ocontinue helping Ben and irrlicht comunity.
Finally making games again!
http://www.konekogames.com
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

thanks

I think what you're trying to do is something like the getMS3DJointNode function except for .X? Maybe I misunderstood you. Anyway, if that is what you're trying to get I already made a function for that, it's on the FAQ forum. Problem is, it seems that niko has a problem in his quaternion rotation and interpolation code. There's a comment in CXAnimationPlayer.cpp that says it's buggy, rotations are mirrored. CXAnimationPlayer::getMatrixOfJoint (used internally by my function) seems to return an screwed up matrix, probably because of the quaternion problems. Unfortunately because I don't really understand quaternions I have not made any progress towards fixing it.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

well I don't know a word about coding, but i think is not that complex...

I mean, is just a matter of loading two x files at the same time, and just pretend they don't get displaced.

I mean the relative position of the weapon skeleton (and skeleton by itself) in relation to the human skeleton, does not change. So when you load it at same time the root bone positions (and so, full thing position) must much in every frame, as they were matching in the blender scene.


Uless x files do not translate world coords, this should be very possible.

Root bone would be at 34, 234, 12, and in according position, weapon skeleton root bone would have another coords... but also refering to same global coordinates, pretending there's a 0,0,0

i don't know if I explained well...

The exporter is now improving quicker than before, it's turning really nice every day for what i am checking :)

important bug fixed, and he's fighting to fix one related with mesh view. Not a bug, but a dx format issue with mesh view.

seems jumps in distance, and in general root movement will be possible, I laready made an anim with it...
Finally making games again!
http://www.konekogames.com
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

rats. I was hoping someone else would be able to help to help you. It's hard to comunicate exactly since unless you know what an irrlicht scene node is I can't ask you if you care whether the two use different nodes and because I'm a very very much a blender newbie I'm not sure exactly how they stay together in blender.
Unfortunately, if I understand you right, oneis nto able to do this in Irrlicht right now. There is a function that should be able to keep two animated .x meshes together but because of a problem in rotation it doesn't work right. I think the bug is something to do with quaternions, but because my quaternion math skills are pretty muchnon-existant I have been unable to fix it. As I will be using animated .x models for the characters in my game, I do plan to work on it eventually (as well as adding other features to Irrlicht .x meshes) but I have made no progress so far.
You are talking about a weapon skeleton that will move with the hand on a human skeleton aren't you? If your not then I misunderstood. Again :oops:


BTW: I did get an armature to deform a mesh. Thanks for the help with that. Sorry I couldn't be equally helpful.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Well I think I just fixed the problem I was talking about, so presuming I understand you right then it is possible.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

sorry, I check too many forums , and lately I do this not so much,(doing some artwork lately ;) ) and sometimes miss important posts here and there...


"rats. I was hoping someone else would be able to help to help you. It's hard to comunicate exactly since unless you know what an irrlicht scene node is I can't ask you if you care whether the two use different nodes and because I'm a very very much a blender newbie I'm not sure exactly how they stay together in blender."

basicly, you link them, as child, or do a copy location/rotation constrain.Anyway, if done so, all must be keyframed, every bone, as ben's exporter yet does not allow ik and constrains. EMpties with ik solvers can cause problems, surely these constrains too. Anyway, the root non moving problem seems have gone away.

The main thing was to load diferent x files and match the whol thing in Irrlicht.

"Unfortunately, if I understand you right, oneis nto able to do this in Irrlicht right now. There is a function that should be able to keep two animated .x meshes together but because of a problem in rotation it doesn't work right. I think the bug is something to do with quaternions, but because my "

Aha, I see.

"quaternion math skills are pretty muchnon-existant I have been unable to fix it. As I will be using animated .x models for the characters in my game, I do plan to work on it eventually (as well as adding other features to Irrlicht "

If I find the time (unemployed and seing I'll maybe be moving away to other town some time soon...) and once the exporter gets a bit more functional, or, even better, I finally get it to work in most environments, I should be able to do a tut , even a brief one, to tell the main steps.

There are things to strongly avoid, like letting the default bone names like Bone.001, but is quick to rename all with a trick inside Blender.

My whole interest these days in Blender exporter is help Irrlicht comunity, continue helping Ben, and also provide so a free character exporting of animation for many other x based engines, like dbpro, TV3d, Urgh engine.

".x meshes) but I have made no progress so far.
You are talking about a weapon skeleton that will move with the hand on a human skeleton aren't you? If your not then I misunderstood. Again"

yup...I was thinking of two armatures, one for the weapon, one for the human...

actually, this way one could make the weapn fall in death animations...if not falling, heh, one can just extrude(e) an extra bone from hand, and rig it as rigid every part in the following bone chain.

What is more...What I don't know is if x files will be compliant with this, nor if the exporter will be able to do so...there's a real need of making constrains and ik solvers work perfect in the exporter...let's see if Ben can solve it....

as if it ended up working, only one skeleton needed. Just that you interrup the armature building once reached the hand, and get out edit mode, get into again, but instead of selecting the hand joint to extrude from that joint, you put the cursor a bit near it using several views or just rotating to position the cursor well (just left click with the mouse) and hit space ..."add" ..."bone".

this way you create a bone of the same armature, only that is unconnected to the mesh...but till today, unconnected bones seem to be neither suported by the exporter...SO, yep, probably is better to have two skeletons support, loading each anim as each one x file.....


"BTW: I did get an armature to deform a mesh. Thanks for the help with that. Sorry I couldn't be equally helpful."

Do not worry. I am usually explaining stuff, but i know Blender , even for the quck task a game developer wants to do (no need learn whole blender fo rthat) would be ideal a tut with graphics like I say. If my situation allows in the fture, I'll do...now I'm doing some graphics to fill a tiny bit my very weak bank account... ;)

You already help a lot with projects like the visual editor, I think will be one of the greatest things for irrlicht, :)


"Well I think I just fixed the problem I was talking about, so presuming I understand you right then it is possible."

two skeletons, two anims...and load them in irrlicht so they match :) If that's possible, weapon falling to the floor is possible. Or getting and object and dropping it later on in the floor, table, etc. :)

many old modders would say here most fps games just never let their model loose the weapon from the hand...yep...but I like when this details are possible :)


So , for what you say, it's possible now in irrlicht, and I already was answered is possible in db pro...great then...most likely is gonna be possible in every x importing engine. :)

I'll be probaly using XSI x export, though, not surely if will do an irrlicht project, as I don't really mind much about the engine...my engine game coder friends tend to like to do it all of their own (I told em to use irrlcht, but they like doing things from scratch) BTW, Irlicht is getting really good, imho :)

The visual editor is sounding very, very well. :)
Finally making games again!
http://www.konekogames.com
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

You already help a lot with projects like the visual editor, I think will be one of the greatest things for irrlicht,
lol. I think your confusing me with someone else. I think etecaptor's doing a visual editor, but not I.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

oops..

it beguins also with an "e" and ends with an "o" somewhere...:D


well, anyway, every coder here is helpful ;)
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 »

Just a quick note. I havn't read all of this thread yet, but I got some news. I recently put in some time and effort into changing and optimizing the blender x exporter python script for irrlicht (not only). I got this list of additional features so far:

# It has the following changes:
#
# 1) Added a configure Screen with these options:
#
# - Inverse Normals (inverts the direction
# of the vertex normals)
#
# - Flip Faces (flips the faces by reversing
# the order of the face's vertices)
#
# - 'XSkinMeshHeader' (if active then the
# The 'XSkinMeshHeader' block doesn't get exported. It can
# prevent the DirectX Mesh Viewer from loading the File)
#
# - Animations (Supress export of animation)
#
# - Flip Z Axis
#
# - Recalculate vertex normals
#
# The settings are remembered througout the Blender session.
#
# 2) Changed the format strings to use '%f' instead of '%s' to export floats
# because it would sometimes write floats in the 'exponent mantissa' form
# (like '1.2e-005' instead of '0.000012') which makes it impossible to load
# it for example into the DirectX Mesh viewer.
#
# 3) periods (".") in names of materials and bones are converted automatically
# into underscores ("_").
#
# 4) Meshes without an armature now get exported as well.
#
# 5) Texture mapping gets fixed by adding appropriate additional vertices.
# Mesh coordinates, normals and weights are adjusted

Mh, maybe its not totaly up to date...

After some cleanup it can be released. Still gotta contact Ben about this... Also there are still some issues...

Ok tired gotta go to bed now :)
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

sweet. Are you going to put the file up somewhere?
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

Fantastic!

I think there is some very useful work...very good for the plugin.
I have already emailed Ben to se if he can contact you so you speak about it...
About that, Jox, Please check your PMs, as I have written you about that.

There are very interesting features there...

[ Seems Blender is giving mores steps in game field lately, thanks to collaborators...

-Der_ton md5 updated to doom3 oficial format... (for be used with a patched blender 2.34, not with the oficial)

-ideasman creating now a lightmap script (while is not totally automatic) .Seems a kind of baking to texture channel1, so no need of a second channel (of course that has its disadvantages, but Blender has not yet two channels. Is kindda render to texture using vertex colors and radiosity, I think.)

-and now seems you are polishing it a bit more for irllicht users problems to load an x file...great!

IMO, Blender can end up finally being the free tool for game engines...

I have XSI, as I'm "power hungry" in character animation, but Blender is getting very serious... ]
Finally making games again!
http://www.konekogames.com
Post Reply