xen and jiglibX

May 18, 2009 at 6:01 PM

does anyone managed to integrate JiglibX to Xen.


I'm having problem with my drawing. The mesh only draw when one of them is immovable.

I try to port directly the class form a project where jiglibX worked perfectly but I really don't see where is th eproblem.


If someone has some hints about it or a simple box class it would be very nice. I spent already too much time figure it out what was my problem.

May 18, 2009 at 10:54 PM

What sort of transforms does jiglib output? There shouldn't be any reason why they'd be incompatible.

May 19, 2009 at 1:51 AM

I just check the documentation and it may be something related to my world matrix. I'll look rwrite the code because I can see what's wrong.



May 20, 2009 at 10:49 PM


I finally managed to add jiglibX it was my framework problem.  I've been through your tutorial and I have few questions.

I'm using maya to create animation and I would like to know if we can split animation in few part. Since maya only export take 001, the only way to play the animation is the split in few part.

I4m haveing few problem with the rendering of my meshes. The fist one concern a big mesh which disappears when I'm not looking only its edges. I don't know if it's related to culling but I would like to create a big meshes and keep them in the screen.

the second problem appears when I try to add shadow mapping follonwing your tutorial. The meshes are half transparent but the shadow mapping is applied




May 21, 2009 at 10:45 PM

Are the meshes you have created using a large scale value?
If so, this could possibly be the cause of culling errors. If so, I'd appreciate it you could send me a model which is causing problems.

I'm not really a content person (I never really use maya, max, etc) so I'm not aware of how they export their animations. Although I'd had heard before that some programs simply export a giant single animation.
Is there no way around this on the editor side? If so I'll have a look and see if there is anything I can do...

What do you mean the meshes are half transparent? Are you manually making them transparent? The sample code for shadow mapping doesn't take this into account. I will stress the code was not intended as 'the only way' to do shadow mapping, it was designed to show how certain features can be used to make certain effects easier to implement...

(Sorry if this is a late reply)

May 22, 2009 at 2:45 PM


the only workaround is using motionbuilder(which is expensive) . Maya don't export natively in .X and the exporter aren't updated. So I used to split the animation using a clip player with the model skinned example.

If I could access the frame and set the one I want to play it could be just great.

about the mesh half transparent I solve it. I was my own mistake.


Also I was experimenting JiglibX along Xen and I have a problem figuring out right way to extract the rotation and translation from a single bone.

I got a hacky method (taken from the tutorial) but I still have some error from it. and the other part is I can't transform the bone using jiglibX body porientation and translation. 

                Transform transform = Transform.Identity;

                //create a rotation
                //Quaternion.CreateFromYawPitchRoll(0, this.rotationValue, 0, out transform.Rotation);

                Quaternion.CreateFromRotationMatrix(ref this.world, out transform.Rotation);
                transform = boneWorldSpaceInverseTransforms[spinBoneIndex] * (transform * boneWorldSpaceTransforms[spinBoneIndex]);
                boneSpaceTransforms[spinBoneIndex] *= transform;


Matrix World represent the jigliX body orientation. I still have to experiment but I cant see what wong on this method.


About the model. I'm not suing it's scale but tranforming it using a vector3 (40,1,40). I use a defaut first person camera with a project jection field of view of .55f

There is the link if you want to have a look.


thanks again for your time.



May 22, 2009 at 3:04 PM

You can also manually bake animation takes from several text FBX files into one file using Notepad - Xen recognizes such animations flawlessly. In our production we use homemade utility to do it.

May 22, 2009 at 3:37 PM

You mean by creating a model for each animation I want and then copy and paste it onto a notepad file it will work ? Do I need to store the file into an fbx file?

May 22, 2009 at 3:44 PM

1. Create a separate FBX for each animation (note that skeleton and geometry are to be equal among all these models)

2. Copy animation takes from all FBXs and paste them into the first FBX. Copy/paste only takes, not the whole files. Rename takes from "Take_01" into something more suitable.

You can google this topic for more detailed instructions.

May 24, 2009 at 1:29 AM
Edited May 24, 2009 at 1:31 AM

Thanks for posting the model. I'll take a look at it and see what's up.

The Transform structure can convert to/from Matrix:


Transform transform = new Transform(ref matrix);
transform.GetMatrix(out matrix);

Note that Transform stores a decomposed matrix. It's Quaternion/Translation/Scale (where scale is a single float)

May 26, 2009 at 7:28 PM

thanks for pointing out but I how can I transform a single bone with a matrix ?



May 27, 2009 at 11:58 AM

I'm sorry I'm not quite sure what the problem is, perhaps if you explained exactly what you are trying to do?.

From my understanding, you have Jiglib generating matrices, and you wish to position bones in a skeleton into the positions of those bones?
The method to do this is demonstrated in the manual animation tutorial. However it only directly shows two methods of modifying the animation (directly replacing all the bones and skipping the transform, and the other method (the spin) is modifying one bone pre-transform).

Do you want to replace a bone post-transform? (if so, then assign the transform instead of multiply assign, but do it in the post transform method instead of the pre-transform method):
boneSpaceTransforms[spinBoneIndex] = transform;  (instead of *=)

I can understand it's probably quite confusing. Animation is always very tricky...

May 27, 2009 at 4:04 PM

I guess what I want is more likely pre-transformed.

I tried to transform it again but it don't work. But I guess there is something I'm missing. maybe I should look carefully the model animation example.

Maybe I should stop the animation?

May 29, 2009 at 2:49 AM
Edited May 29, 2009 at 2:53 AM

The distinction between pre and post transformed bones is quite important.

Consider a character's arm. It has a number of bones for the shoulder, elbow, etc.
With pre-transform modification (or replacement) of the transform, you are modifying the local bone transform.
So, if you replace the elbow transform with a world matrix, you may get unexpected results. Because as soon as the shoulder changes (or the character body, etc) then this will affect the elbow as well during the hierarchy transform. (rotate the shoulder, the arm moves)

If you replace the bone in the post-transform, then the bone itself can be given any old world matrix. However, anything connected to it (the hands, for instance) will not be changed in anyway. It's a world-space change, post hierarchy transform.

If, for instance, you wanted to do a pre-transform replacement in world space, then you would need to take into account the world space transform of the parent of the bone. This isn't that straight forward, as you will need to traverse the bones parents, to combine their local transforms, to get the world space transform of the elbow's parent. *then* you'd need multiply your world matrix by the inverse of the parents calculated world transform. Needless to say, it would be tricky to get right (and it would be one of those things that will go spectacularly wrong until you get it exactly right... just like all animation stuff) :-/ 

Does that help? (I hope...?)
Animation is unfortunately one of those annoyingly complex things.