Lugaru Model Import / Export scripts for 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:

Re: Lugaru Model Import / Export scripts for Blender

Post by rudel_ic » Tue Jan 19, 2010 9:11 am

Armored_Wolf wrote: What exactly are you doing here?
I have no idea.

User avatar
Armored Wolf
Posts: 1267
Joined: Mon May 25, 2009 7:35 am
Location: In Renegade_Turner's brain

Re: Lugaru Model Import / Export scripts for Blender

Post by Armored Wolf » Tue Jan 19, 2010 10:06 am

Let me rephrase that.

Are you making new models and stuff for Lugaru, or what? I thought it was impossible because the stuff was lost but it looks like you fixed that problem...

(my spellchecker things the spellcheck for "Lugaru" should be sluggard, lol)

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

Re: Lugaru Model Import / Export scripts for Blender

Post by rudel_ic » Tue Jan 19, 2010 12:57 pm

Armored_Wolf wrote:Let me rephrase that.

Are you making new models and stuff for Lugaru, or what? I thought it was impossible because the stuff was lost but it looks like you fixed that problem...

(my spellchecker things the spellcheck for "Lugaru" should be sluggard, lol)
That's exactly right, David's tools for making assets were apparently lost, so I reverse-engineered
- the Solid model format (complete, released a tool for import / export)
- the skeleton format (incomplete, released a tool for merging Body models into skeletons, but ragdoll editing is locked out)
- the animation format (incomplete, tools unreleased as of now)
- parts of the map format, just the things related to placement - making maps in Lugaru is fun and stuff, but it would be cool to be able to place things exactly (incomplete, nothing released)

I started with this in the summer of 2008. When I had a free weekend and nothing else to do, I sat down with a hex-editor-printout of a file and analyzed it, then wrote tools that could translate other model formats into this one (and vice versa).

You can find the current stuff at http://www.alice-dsl.net/wolf.mathwig/tools/py

That's the gist of it.

Edit: And I don't make models currently because I can't make time for it, but I made some stuff around January 09 or so.
Last edited by rudel_ic on Tue Jan 19, 2010 12:59 pm, edited 1 time in total.

User avatar
Armored Wolf
Posts: 1267
Joined: Mon May 25, 2009 7:35 am
Location: In Renegade_Turner's brain

Re: Lugaru Model Import / Export scripts for Blender

Post by Armored Wolf » Tue Jan 19, 2010 12:59 pm

So you're repairing the lost items of Lugaru?... I'm speechless.

But what, exactly, does that mean? Does it mean we'll be able to create new bodies and stuff for say... we could add rats to Lugaru? If your work continues that far?

I know foxes were added, but they were only re-textures in the skins of the wolves. Is what you're doing going to allow us to create new bodies, say, our own fox models?

Sorry if I sound overeager, this would just be a big help to a campaign I'm planning.

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

Re: Lugaru Model Import / Export scripts for Blender

Post by rudel_ic » Tue Jan 19, 2010 1:02 pm

Armored_Wolf wrote:So you're repairing the lost items of Lugaru?... I'm speechless.

But what, exactly, does that mean? Does it mean we'll be able to create new bodies and stuff for say... we could add rats to Lugaru? If your work continues that far?

I know foxes were added, but they were only re-textures in the skins of the wolves. Is what you're doing going to allow us to create new bodies, say, our own fox models?

Sorry if I sound overeager, this would just be a big help to a campaign I'm planning.
Sure, you can make custom characters. viewtopic.php?f=7&t=5660

Be sure to read the thread carefully, watch the YouTube video and don't hesitate to ask questions in that thread if you want to make rats or whatever.

Edit: Be aware though that animations aren't done yet, and I won't get my hands on that until late February, at the very least.

So the sensible thing to do is to model new heads, paws, tail and feet for characters, basically, so that the standard Lugaru animations still work out.

User avatar
Armored Wolf
Posts: 1267
Joined: Mon May 25, 2009 7:35 am
Location: In Renegade_Turner's brain

Re: Lugaru Model Import / Export scripts for Blender

Post by Armored Wolf » Tue Jan 19, 2010 3:11 pm

Awesome. So let me see here, you've finished your own body-constructers, and if you finish animations, we will be able to give them their own attacks and movements?

SWEET!

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

Re: Lugaru Model Import / Export scripts for Blender

Post by Lotus Wolf » Wed Jan 20, 2010 4:28 pm

More or less, yes, but we can't add species, only replace the old ones. I made a rabbot to test things out with the skeleton merger, but I don't really have the time to make a full character anymore.

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

Re: Lugaru Model Import / Export scripts for Blender

Post by rudel_ic » Wed Jan 20, 2010 6:28 pm

That's the thing, it's a ridiculous amount of work, at least compared to the amount of work you have to put into making a weapon. Especially when animation comes into play.

You have to
- Model a character
- UV-map it
- Texture it
- Provide clothes textures others can mod
- Map skeletons
- Repeat the above for the low resolution version
- Make all animations (just have a look at how many there are in Data/Animations/ that don't belong to the wolf)
- Test everything out, fix details

That takes a few days.

User avatar
Armored Wolf
Posts: 1267
Joined: Mon May 25, 2009 7:35 am
Location: In Renegade_Turner's brain

Re: Lugaru Model Import / Export scripts for Blender

Post by Armored Wolf » Wed Jan 20, 2010 7:25 pm

PLus the fact that I don't know how to do any of that might add a couple of days.

User avatar
Johannes
Posts: 1374
Joined: Thu Dec 18, 2008 1:26 am
Contact:

Re: Lugaru Model Import / Export scripts for Blender

Post by Johannes » Sat Feb 06, 2010 5:59 am

Hey rudel, been doing a good bit of work using your blender plugin, and it's been great so far.

However one thing I find a little annoying is that the rotations of objects are off when you import them, or at least unintuitive, as can be seen here:

Image

I realize the game requires the models to be oriented this way, but you already scale them when you import/export a model based on their type, so why not automatically rotate them to a more intuitive orientation as well when you import, and then automatically reverse that rotation back to the original when you export?

I humbly request that you add the following to your code:

On import rotate:
Immo
• 180° around the X axis (so their 'top' is facing 'up', in the +Z direction)
Weapons
• 180° around the Z axis (so their tip is facing 'forward', in the +X direction)
Body
• 90° around the X axis (so their 'top' is facing 'up', in the +Z direction)
• -90° around the Z axis (so their 'front' is facing 'forward', in the +X axis)

And on export undo these rotations, so:
Immo
• 180° around the X axis.
Weapons
• 180° around the Z axis.
Body (done in reverse order of import)
• 90° around the Z axis.
• - 90° around the X axis.

Note:
- The axis and colors I chose for reference are based on those used as default in blender, please see the image I provided.
- The angles are given based on the right hand rule

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

Re: Lugaru Model Import / Export scripts for Blender

Post by rudel_ic » Sat Feb 06, 2010 9:22 am

I'll apply your suggestions when I get around to it; there's other things in the pipeline as well though, so it might take some time.

However, if you want to apply the fixes yourself in the meantime, here's what to do:

1. Open solid_import.py in the script editor inside Blender

2. Apply the following changes (new lines are marked with a "#<<" comment):
- Import the math library (we need pi for the rotations)
Image
- Set the appropriate rotations for each type where it's being differentiated, a rotx of pi corresponds to 180°, for example (I just copied your suggestions here, you might have to alter this)
Image
- Apply the rotations when the object is being built
Image
NOTE: "mobj = scene.objects.new(mesh)" is an altered line! Don't forget this one.

3. Press ALT-S for saving this. Press ALT-P for running this altered script.

Sorry that I can't upload this fix myself, I'm currently working on other stuff and have no time to check whether this works out right, and I'd have to change other things as well.

But what's nice is that you don't have to change the exporter - these rotations are relative, meaning that they're not exported. Just don't apply the rotations :)

Let me know how this works out. Thanks for the suggestion!

Edit: You'd still have to rotate your weapon, immo or character as usual though when you're exporting it the first time, and you'd also have to apply the rotations. Don't forget this one.
Only the first time though.

User avatar
Stromboli
Posts: 95
Joined: Mon Dec 29, 2008 10:11 am

Re: Lugaru Model Import / Export scripts for Blender

Post by Stromboli » Sat Feb 06, 2010 11:45 am

rudel_ic wrote:That's the thing, it's a ridiculous amount of work, at least compared to the amount of work you have to put into making a weapon. Especially when animation comes into play.

You have to
- Model a character
- UV-map it
- Texture it
- Provide clothes textures others can mod
- Map skeletons
- Repeat the above for the low resolution version
- Make all animations (just have a look at how many there are in Data/Animations/ that don't belong to the wolf)
- Test everything out, fix details

That takes a few days.
I could probably model a character in a few hours, and UV it in a few more. I don't know much about the rest.

User avatar
Johannes
Posts: 1374
Joined: Thu Dec 18, 2008 1:26 am
Contact:

Re: Lugaru Model Import / Export scripts for Blender

Post by Johannes » Sat Feb 06, 2010 2:10 pm

Thanks for the quick reply!

Image
Ahh, much better :)

=EDIT= I had a long post here about what I wanted you to add, but I went and added it myself, see post below =)
Last edited by Johannes on Sat Feb 06, 2010 9:18 pm, edited 16 times in total.

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

Re: Lugaru Model Import / Export scripts for Blender

Post by Lotus Wolf » Sat Feb 06, 2010 2:18 pm

Hey Stromboli, if you can model/uv a character I can do the rest for you.

User avatar
Johannes
Posts: 1374
Joined: Thu Dec 18, 2008 1:26 am
Contact:

Re: Lugaru Model Import / Export scripts for Blender

Post by Johannes » Sat Feb 06, 2010 5:40 pm

Though I don't have much experience with python, I had a go at modifying the script to allow the user to choose if they want to have the importer and exporter automatically rotate the objects

Image

The buttons on the left do what it originally did, importing the files as-is.
The buttons on the right rotate the model to a more intuitive orientation on import, and reverse that rotation on export.

How to use it:
• If you have old custom models, or don't care about rotation just use the original buttons.
• If you want the orientation to be more intuitive use the buttons with '_Rot' both when you import and when you export. ( If you don't use it for both it won't end up oriented correctly in-game )


Since now the user can choose if the mesh is automatically rotated I changed the code to actually rotate the mesh data, and not just inside the blender world.

Code-wise, I added a global variable 'rotfix' which is set true for the buttons on the right.
Then I'm using mesh.transform(Matrix) for each axis, where the matrix is calculated with Blender.Mathutils.RotationMatrix().
since RotationMatrix accepts degrees I don't need pi anymore =)

The parts I modified from the original script are all marked with #<<, in-case Rudel wants to modify/change it.

Also changed it to say 1.2 (eventhough the last version was 1.1 it was still listed as 1.0 in the interface)

Please try it out:
solid_imex_1_2.zip
(7.05 KiB) Downloaded 1017 times
Last edited by Johannes on Sun Feb 07, 2010 2:31 am, edited 1 time in total.

Post Reply