Help with UDK skeletal Mesh

Hi, fellow blenderheads.

I know that blender support for UDK is far from stellar, but I know there is people actually getting it to work. I have succeded at exporting static Meshes (using the collada exporter in Blender 2.5) but have found serious problems when doing the same with Skeletal Meshes.

I first tried with a simple example: a spinning cube. It worked just fine so I got excited. Then I proceded to try one character I had done days ago. But this time I wasn’t successful. I get to export the armature and mesh, I don’t get error messages, but when i Import the files into UDK my mesh looks totally deformed, like if the armature had been moved from its position.

I followed all the instructions on the readme file. There is only one mesh, one armature. I don’t know what else to do.

Any help you can give me will be greatly appreciated.

Why use collada? I believe there is a specific exporter for the UDK and UT3 which was created recently for blender 2.5. I don’t have a specific link but it was on this forum so it shouldn’t be hard to find.
I tried it when it first came out and I had no problem exporting a shotgun mesh which was animated with bones.

I use collada because I tried all of the scripts for Static Meshes and all of them had some problem with smooth groups. Some of scripts showed my meshes totally smooth, don’t matter if I had separated my vertices correctly, some other scripts showed my meshes totally faceted. Besides, if collada works just fine, why don’t use it?

Now, the skeletal meshes. I’m using the latest script made for Blender 2.5 and I’m still having the problem you can see on the pic I uploaded.

hi,
you can find the import/export unreal here:
https://svn.blender.org/svnroot/bf-extensions/contrib/py/scripts/addons/
I realize these scripts have limitations.
It would be good for some people to help getting these scripts more functional.
darknet is often in irc #blenderpython so you could contact him there.
thanks.

Did you search about this in the UDK forums? I think I saw a post about this problem in the script’s thread:
http://forums.epicgames.com/showthread.php?t=602953

Yeah, I’ve been there before. That’s where I downloaded the script.

I’ve come to think that I have a problem with my rig. I read all the instructions again, slowly. There are some parts I don’t understand, so maybe some of you can help me:

  1. The Armature bone are working for PSK and PSA. The bone are base on the head bone position when exported to psk.
    I don’t know what he means by this. “The bone are base on the head bone position when exported to psk”. Please, some one can explain to me.

2. The Animations are working from different bones rotation when the amature is build. The Mesh and Armature must center the pivot point together else you will get some offset when the animation is export.
I’m not really sure what this means. Both my mesh and the armature are centered to the center of the screen. Is there something I’m missing?

Someone mentioned this, when commenting on someone having problems with bones
offset when exported to blender (similar to my problem):

That looks like it’s a bone rotation issue. I don’t know if the following is still a source of issues when exporting rigs but… How have you got the mesh set up in Blender? Does it face forward in ‘front’ (Num 1) or ‘side’ (Num 3) view? Also, check that it’s not necessary to ‘Apply Rot’ etc. to the rig in order for the bones to have the correct orientation relative to the direction the rig is facing, that used to screw things up when exporting.
What can you get from this?

Here the video of the blender for blender to unreal.

Try to not to rush it there are video and links about and. from blender sites.

The problem with this I assume is that blender’s editbone mode doesn’t support rotations.

If you import a PSK file to blender, you’ll get distorted skeletal mesh. More likely, the skeleton will be pointing down along some axis. That is because UDK/Unreal only stores the offsets of the skeleton’s bones and quaternions for the bones rotations.

Bones in blender’s edit mode only have offsets, so if you shape the skeleton to look like what it looks like in UDK anim editor, you’ll be messing with the offsets. This lead to character distortion as seen in your screen shot.

The solution for this would be to import the skeleton with the correct offsets into blender, then pose it according to the quaternions (rotations) in pose mode and perhaps use apply (if it doesn’t mess with the offsets). After that, you should make the bone weights according to the reference pose set by UDK. That should be the default pose for the model.

One possibility would be to tweak the import script to import the PSK file into the blenders bone system, then take this into account when exporting it. I dunno, but maybe the object variables in blender 2.5 could be used to save the information from the PSK during working for the export in the end.

http://forums.epicgames.com/showthread.php?t=722541
and join up in the blenderpython channel.

@Darknet, visit the irc channel sometime :wink: I’ll probably be idling there

I looked at your work on youtube and I understand that I am working on top of the script that youve created. It seems to work quite well, but the biggest problem is with importing the UDK base skeleton. You seem to have created the models and animations yourself, but I think it would be good if we could tap in to the animations created by Epic as well (they updated their license lately to allow us use anything expect the actual skeleton meshes provided with UDK). Taking advantage of the premade quality animations would be nice.

That part I know. But the bone format is different from other 3d modeling. But it just the same format. But it is hard to tell to know where the bone direction is pointing. I been trying to create the default bones for unreal character but no luck. But seen some one done in blender. But can remember it.

The offset problem that I haven’t fixed. Since there are two objects that have different pivot points. If they are off by it location (0,0,0). It will give the offset. It deal with matrix math. So I don’t know much of the math.

I haven’t gotten my head around the quaternion math either. But do remember that the rotations should be done in quaternions, not in matrices. I believe that matrices will cause the distortion when exporting. Don’t ask me why though.

BTW, the rotation in UDK. Is the rotations pivot in head or tail of the bone?

Your script works correctly. It reads the bone offsets correctly, but it just doesn’t rotate them. Blender cannot rotate in bone edit mode, so we must rotate them in the pose mode. I am not sure if we can apply those poses to the edit mode to serve as the rest pose, since that might change the offsets. And if we can’t apply the pose, can we create the bone weights?

Good job so far :slight_smile:

Ok, what I get so far, is that the script has some flaws that can be overcome with creative rigging. I’m I wrong? So to overcome this I have to rig my character in a different way to make it work on UDK because a standard rigging won’t cut it.

Now my question is, can someone tell me how the UE3 rigs are done, because I’ve downloaded some rigs made for Unreal Tournament 3 and they are pretty weird (they put bones on each joint, instead to putting the along the arms, legs, etc.).

I’ll continue making tests. I’ll make incremental rigs until I get to the point where my mesh is all messed up, but if someone can give me some pointers on rigging for UE3 I’ll appreciate it.

Armature bones is different. Since it has the two point to make one bone. The head deal with the position. The Tail deal with the rotation or direction. Plus there is the roll. That make up quat.

By Armature bones, are you talking about Blender’s armature or UE3’s armature? When you say that the head deal with the position and the tail deal with the rotation or direction, are you talking about UE3 and that when it comes to bones it is different that blender? In that case, what would be the correct way of rigging, say, a complete body? I ask because the videos I find on Youtube are about cubes rigs, which are pretty simple.

BTW, I kept making tests:

  • I tried rigging a single cube with a single bone and then animated some actions: success.
  • I rigged a cube splited by the half (simulating a joint) with two bones and then animated some actions: success.
  • I rigged a pair of stiff “legs” (they where very simple for test purposes) and then animated some actions: success.
  • I rigged a pair of articulated legs: success.
  • I modeled a simple body, used a rig similar to the one on the legs and added the arms: Bones offset. I wonder if the fact that the upper half of the bones (torso and arms) were extruded from a bone pointing up and the lower half of the bones (hips and legs) were extruded from a bone pointing down, has something to it.

By success, I mean that I exported the armature to UDK and the animation and model showed just fine.

Thanks for your interest in my problem.

Do you mean that the UE bones would be rotated from the tail pivot?

On possibility that was brought up on IRC yesterday is to store the imported quaternions in bone’s custom properties. Then pose the model and when exporting, the exporter would look at those values instead of the actual values inside blender.

The example rig I saw was supposed to be used as a custom character in Unreal Tournament 3, using all the default set of animations of the characters in the game, so I suppose that’s explains the weird rig. In case you wanna take a look, you can find it here: http://code.google.com/p/steam-punk-pirates-mod/wiki/CustomCharacter

It’s just that I saw a similar rig to the one in there so that’s what confused me.

Hey guys. I’m sorry to bring up this old thread, but I haven’t been able to solve this problem yet(3 years from the original post). I’ve looked everywhere and I mean everywhere. I tried exporting a makehuman model with the custom character rig on code.google tutorial that busaiku posted.

Like VeliV, I also believe that we should make use of the given UDK animations as much as possible, since polished animations are extremely hard to do. It really is a very valuable resource.

Anyway, I have also tried both the .psk/.psa exporter and the .fbx exporter, having more success with the .psk exporter using the custom character rig from the tutorial(code.google) and partial succes with the .fbx exporter using a rig that I made with the same bone names and similar sizes.

The problem with the .FBX exporter: If I used the custom character rig from the tutorial(code.google), having the vertex groups correctly assigned to their corresponding bones, the result was completely messed up. Like this:

Although, I believe that the result is like that, because the code.google rig is itself weird. When I used a regular rig that I made myself(using the original UDK rig, which I exported to an .obj, as a reference - UDKrig.zip (23.5 KB)), the result was more “regular” looking:

A much better result. Still there’s lots of stuff wrong with it. I believe it has to do with Bone Roll in Blender(something like what VeliV and Darknet were talking about?). I remember messing around with Bone Roll and exporting to UDK and having partial success. The problem was that I was always guessing the Bone Roll and never actually had a reference to start from - apart from the end result.

So if a custom armature is to be built for a character, I believe this is the correct path, because the only thing you need to do is name the bones correctly. - IF the Bone Roll problem is solved, of course

The problem with the .PSK exporter: It only works with the code.google custom character rig. Every other rig produces pretty much the same result as the .FBX exporter with the code.google rig(first picture)… The problem here is obvious: you can only use a certain rig, which is pretty useless unless for exporting purposes.

So what I did was, I made a custom armature character rig, that had the UDK bone hierarchy(b_Root->b_Hips…) and was relatively normal.

  1. I would import a MakeHuman character
  2. I would parent the character mesh to the code.google rig with empty vertex groups so that the mesh would get all of the necessary vertex groups assigned, without actually affecting it’s bone weights.
  3. I would position my custom armature character rig to the character mesh in edit mode, like it’s normally done when rigging.
  4. I would un-parent the character mesh from the code.google rig and delete the armature modifier that was created previously
  5. I would parent the character mesh to my custom armature character rig with automatic weights, to get the correct bone weight values.
  6. I would position my custom armature character rig in pose mode as close to the code.google rig as possible
  7. I would un-parent the character mesh, applying the transforms that were made in step 6
  8. I would parent the character mesh to the code.google rig, using only the Armature Deform option
  9. Export using the .PSK/.PSA exporter

Result:

The problem here was that the character mesh had to be relatively the same scale and shape as the code.google rig. It becomes apparent if you look at the hand test I did. The left hand had to be scaled quite unproportionally to the original right hand. It was about as big as the character’s face, which looked very weird in some animations.
In Blender:

In UDK:

By the looks of it, the more that the character mesh conforms to the code.google rig, the better are the results. This is relatively obvious, but it also means a big restriction: almost all characters using the rig have to have hands that are the same size, arms that are of the same length, legs that are the same size, etc… a pretty big restriction.

Anyhow, I’ve been battling with this problem for quite a while now and gave up once, a few months ago. It’s frustrating me that people who have 3ds max or maya have no problems doing this kind of stuff, only we do.

This is as far as I got. I hope any of you have had more success than me and can tell me or others about a solution to this problem.

Here is my last attempt: UDKTry.zip (1.4 MB)

I though Blender came with “official” PSK/PSA exporter :confused: Last time I tested it, it worked just fine.

I’m not sure if you actually read the whole thread, but the problem lies with UDK and Blender handling bones differently. The problem arises when you’re not using animations that you have created, but want to use the animations that come with UDK.