Lugaru character modding in Blender

The place to discuss all things Lugaru.
User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Lugaru character modding in Blender

Post by rudel_ic » Sat Nov 14, 2009 5:21 pm

Hi,

You can get the scripts in a ZIP archive right here: viewtopic.php?f=7&t=5620&p=232622#p232622
(Used to be http://www.alice-dsl.net/wolf.mathwig/tools/py/ -- not anymore though)


Before you do anything, backup your Data folder.


Overview
  • lugaru_skel_import.py imports a skeleton and its ragdoll into Blender
  • lugaru_skel_merge.py writes the vertex groups of the selected Object into a skeleton
Here are the Skeleton-Solid-pairs:
Basic Figure: Body.solid-Body7.solid
Basic Figurelow: Bodylow.solid
Basic Figure wolf: Wolf.solid - Wolf7.solid
Basic Figure wolf low: Wolflow.solid

Skeleton Import

Basic principle

Skeletons in Lugaru consist of vertices.
Each bone is represented by a pair of those vertices.
All vertices of the Body mesh that's animated via a skeleton are associated with some bone.

What I've done is I made it so that each bone is represented by a vertex group.

So if you import a skeleton into Blender, select the skeleton, go into Edit Mode, deselect all vertices, choose one Vertex Group and click Select, you'll see which bone is which vertex group.

Automatic generation of vertex groups

If you have imported a Body.solid into Blender of which you know that the skeleton you're about to import references its vertices, you can select that Object before importing the skeleton. If you do that, vertex groups are automatically generated for you.

So if you've imported Body.solid, go ahead and select it in Object Mode, then choose "File>Import>Lugaru skeletons...". Then choose "Lugaru/Data/Skeleton/Basic Figure".

The skeleton and the ragdoll should appear; the skeleton should be inside the Body mesh, the ragdoll should be located a bit to the right of the Body mesh.

Now, select the Body mesh and go into Edit Mode. Deselect all vertices.

In the Buttons view, choose the Edit panel. You should see something like this:
Image

Choose some vertex group, let's say s0. If you now click "Select" in the Vertex Groups buttongroup, Blender will choose all vertices that are in s0. By default, that's the head of the rabbit.
Image

Skeleton Merge

To merge a Body into a skeleton, select the Body mesh in Blender.
Then, choose "File>Export>Lugaru skeleton merge..."

Choose an existing skeleton from the File system. You should of course choose a skeleton that matches the solid you're modding. See the list above for figuring out which skeleton matches which solid.

I HIGHLY recommend always choosing the original stock skeletons that came with Lugaru. So choose them in this file dialog. As soon as you've got a skeleton that isn't similar in structure to the stock skeleton, you may run into problems in the merging step.

As soon as you click the "Merge with Skeleton" button, the program goes through all vertex groups of the selected mesh and writes the vertex indices inside them into the appropriate bones.

It writes these values into a copy of the skeleton you chose. That copy is named FILENAME_merge, where FILENAME is the name of the file you chose.

All that's left then is exporting the Body, overwriting the Body.solids and the skeletons in your modding Data folder and trying it out.

Making a Body.solid from scratch

The first thing to do is building your mesh in Blender.

Then, DESELECT the mesh in Object mode. You don't want to automatically assign vertex groups.

Import the skeleton.

As you should know by now, the skeleton has vertex groups s0-s14, where each vertex group represents a bone.

Select the skeleton in Object mode. Choose vertex group s0. Do not type it in the box, that would rename the vertex group; pick it from the select thingie (the two arrows left to the textbox).

Switch to edit mode. Deselect all vertices. Click "Select" in the "Vertex Groups" button group.

The bone associated with s0 should light up.

Exit Edit Mode. Select your mesh. Go into Edit Mode.

Make a new vertex group by clicking "New" in the "Vertex Groups" button group.

Name the vertex group s0 by clicking into the textbox and typing it in there.

Select the vertices that should be moved by the bone s0.

Click "Assign" in the "Vertex Groups" button group.

Exit Edit Mode. Select the skeleton. Switch to vertex group s1. Switch to Edit Mode. Deselect all vertices. Click "Select". The bone s1 should light up. Exit Edit Mode. Select your mesh. Enter Edit Mode. Make a new vertex group s1. Select appropriate vertices. Assign.

And so on and so forth.

Once you're done with s0-s14 for your mesh, make sure you haven't forgotten any vertices (go through s0-s14 and click "Select" each time, then choose "Select>Inverse" from the Edit View menu -- then just look at the upper right, where it says how many of all vertices are selected).

If you've assigned all vertices to appropriate vertex groups, you're done.

Go ahead and delete the ragdoll and the skeleton in Object Mode.

Select the mesh in Object mode.

Click "File>Export>Lugaru skeleton merge..."

Choose the skeleton you worked with, click the button.

You're done! Your Body should now work as expected in Lugaru.

So replace the skeleton with your merged skeleton, replace the associated bodies with your new mesh and start the game to test it out.
Last edited by rudel_ic on Thu Jan 08, 2015 8:17 am, edited 2 times in total.

User avatar
Lotus Wolf
Posts: 2218
Joined: Sun Aug 31, 2008 6:03 pm

Re: Lugaru character modding in Blender

Post by Lotus Wolf » Sun Nov 15, 2009 12:30 am

On my first read-through, I struggled to wrap my head around this, but upon reading it again, I understand it. It's just like manually rigging a skeleton in Blender. I'm glad you've gotten this far, and it's amazing for sure. You are still working on the animations editor, right? And once that's done, will you be attempting to figure out how to make custom skeletons for our custom models?

Anyway, this is awesome, and I'll test it out after I finish the two weapons I'm working on.

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Re: Lugaru character modding in Blender

Post by rudel_ic » Sun Nov 15, 2009 2:16 am

Lotus Wolf wrote:On my first read-through, I struggled to wrap my head around this, but upon reading it again, I understand it. It's just like manually rigging a skeleton in Blender.
Pretty much.

For anyone who hasn't fully grasped how to get stuff done with this, I recommend trying a hands-on session, with the stock Body.solid and the stock 'Basic Figure' skeleton. Go through my post and validate what it's saying.
I'm glad you've gotten this far, and it's amazing for sure. You are still working on the animations editor, right?
Sure. It's nearly done. It's nothing fancy though.
And once that's done, will you be attempting to figure out how to make custom skeletons for our custom models?
Well, I'm going to enable changing the skeleton vertex locations, certainly.

Stuff like a ragdoll editor, an editor for making new bones and whatnot won't come from me though in the next months. Maybe someone else is up for it - the sourcecode of the scripts details the formats, so it's not much work. The big part is the reverse engineering stuff.

So if you want to animate the individual fingers of your human's hand or something freaky like that, right now, that won't be possible. The amount of bones is fixed, and concerning my efforts, it'll stay that way until animations and maps are handled.

This is all generic, so it should be easy to work with for a coder. And I definitely encourage anyone to change stuff around or enhance these scripts. Maybe there are even still errors in there.

I'd appreciate it if changes would end up in this thread.

User avatar
Lotus Wolf
Posts: 2218
Joined: Sun Aug 31, 2008 6:03 pm

Re: Lugaru character modding in Blender

Post by Lotus Wolf » Sun Nov 15, 2009 2:22 pm

Cool, you're awesome my friend. :)

User avatar
Lotus Wolf
Posts: 2218
Joined: Sun Aug 31, 2008 6:03 pm

Re: Lugaru character modding in Blender

Post by Lotus Wolf » Thu Nov 26, 2009 2:03 pm

Created a rabbot to test things out, and it works. However, I rigged everything perfectly, but some of the bodyparts behave like they are controlled by the wrong bone.
Attachments
rabbot2.jpg
rabbot2.jpg (41.1 KiB) Viewed 20511 times
rabbot.jpg
rabbot.jpg (120.02 KiB) Viewed 20511 times

User avatar
blood-shard
Posts: 499
Joined: Mon Oct 20, 2008 5:31 pm
Location: in a house in a heartbeat 28 miles away 28 days later

Re: Lugaru character modding in Blender

Post by blood-shard » Thu Nov 26, 2009 2:34 pm

As usual Lotus will allways be the first one too learn these advanced things xD this is gonna be awesome when someone figures out perfecty how it works ^^ i love modeling and ive allways wanted to make other race's like cats for lugaru xD

User avatar
Lotus Wolf
Posts: 2218
Joined: Sun Aug 31, 2008 6:03 pm

Re: Lugaru character modding in Blender

Post by Lotus Wolf » Thu Nov 26, 2009 3:16 pm

make a cat model, and if you can't figure this out, i'll try to rig it. :)

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Re: Lugaru character modding in Blender

Post by rudel_ic » Thu Nov 26, 2009 4:04 pm

Lotus Wolf wrote:Created a rabbot to test things out, and it works. However, I rigged everything perfectly, but some of the bodyparts behave like they are controlled by the wrong bone.
Could you upload the skeleton and the SOLID in a ZIP so that I can take a look at it?

User avatar
Lotus Wolf
Posts: 2218
Joined: Sun Aug 31, 2008 6:03 pm

Re: Lugaru character modding in Blender

Post by Lotus Wolf » Thu Nov 26, 2009 8:54 pm

Here it is.
Attachments
Rabbot.zip
My Messed Up Rabbot
(25.21 KiB) Downloaded 497 times

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Re: Lugaru character modding in Blender

Post by rudel_ic » Fri Nov 27, 2009 12:54 am

Well, the associations don't seem to be right. When I select vertex group s11 in the skeleton, it's the right hand of the skeleton, but when I select vertex group s11 in the mesh after mapping the skeleton to it, it's the right foot of the mesh.
I've attached a fixed version, that should work. I made this exactly as I described above.

Edit: Huh, Lugaru crashes with that. Must be a fault on my part. DL removed to avoid confusion.
Last edited by rudel_ic on Fri Nov 27, 2009 1:22 am, edited 1 time in total.

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Re: Lugaru character modding in Blender

Post by rudel_ic » Fri Nov 27, 2009 1:21 am

Okay, here's the _really_ fixed version. My fault before was that I didn't merge with the stock Basic Figure.
Attachments
Rabbot_really_fixed.zip
lol
(25.32 KiB) Downloaded 522 times

User avatar
Lotus Wolf
Posts: 2218
Joined: Sun Aug 31, 2008 6:03 pm

Re: Lugaru character modding in Blender

Post by Lotus Wolf » Fri Nov 27, 2009 2:38 pm

Cool, it works. So what exactly did I do wrong?

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Re: Lugaru character modding in Blender

Post by rudel_ic » Fri Nov 27, 2009 2:50 pm

Lotus Wolf wrote:Cool, it works. So what exactly did I do wrong?
I can't really tell. You mixed up some stuff, that's all I am sure of.

I'll do a quick video so that you can see how I imagined the workflow. I think my communication skills aren't up to the task of teaching this, so it makes sense to demonstrate it. It's a real easy process once you know what to do.

Give me an hour or two, then I'll upload a howto.

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Re: Lugaru character modding in Blender

Post by rudel_ic » Fri Nov 27, 2009 6:05 pm

Here's the promised tutorial video:
http://www.youtube.com/watch?v=FHADuHyDIl8&fmt=22

It's an HD thing, but the quality isn't perfect; I reduced the bitrate so that the file to upload wouldn't become too big. You should be able to read the important parts perfectly though.

User avatar
rudel_ic
official Wolfire heckler
Posts: 2193
Joined: Sun Aug 28, 2005 11:19 pm
Location: Hamburg City
Contact:

Re: Lugaru character modding in Blender

Post by rudel_ic » Sat May 15, 2010 1:10 pm

There is a bug in my joint order code, I didn't catch it before. I'll submit the fix together with the transfer to GPL soon. I would advise against building custom characters in the meantime.

Post Reply