Lugaru character modding in Blender

The place to discuss all things Lugaru.
Guns Are Toys
Posts: 5
Joined: Sun Feb 21, 2010 12:27 am
Location: Canada

Re: Lugaru character modding in Blender

Post by Guns Are Toys » Sat May 15, 2010 7:33 pm

I noticed there's an animation importer for blender, is it possible to view game animations in blender?

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 9:05 pm

Yeah, you can watch the animations applied to a skeleton. The timing doesn't match the in-game timing and you can't easily watch them applied to a character inside Blender though.

Here is a guide on how to import and playback an animation. For that, you need Blender (doh), my skeleton mod tools from http://www.alice-dsl.net/wolf.mathwig/tools/py/, my animation mod tools from the same URL and Python has to work in Blender.

You can also change animations. It's pretty easy. Something that I haven't disclosed is that if you stretch a joint, the associated faces also stretch in-game.

Read through the forum posts I linked on my site to understand what's possible and how to do it. Have fun!

User avatar
PsychotropicDog
Posts: 52
Joined: Fri May 28, 2010 2:39 pm

Re: Lugaru character modding in Blender

Post by PsychotropicDog » Mon May 31, 2010 8:29 pm

Models:
First, I am having a problem getting Body7.solid to import - the head is squashed real ugly.
Other then that ...

What are the models (solids) in Lugaru?
Are they states that the character uses for certain animations?

They seem to be like target blend shapes...

Body
-the standard body

Body2
-tail wag right
-fist clench
breathing in -chest up
-shoulders forward
-mouth half open

Body3
-tail wag left
-fist slightly clenched
-mouth open wide
-eyes half shut

Body4
-eyes shut
-chest bigger expand

Body5
-ears back
-nose slightly back? does not appear so in top/front view, does in side

Body6
-ears slightly back, closer together
-nose slightly forward

Body7 ???
-smashed head - looks like a data / import problem

Bodylow
-low res version; for longer distances I guess.

I am assuming to get a custom character to act like the character in game, it will be necessary to have 7 copies, each with corresponding adjustments as above.

Edge smoothing?
I think I first tried exporting the imported solid to DXF format from blender, then importing into Maya.
I noticed some edge smoothing which does not seem to be present in OBJ version.
I should investigate, but I suppose the question is, how much edge smoothing?

I noticed a belt.solid as well.

Textures
Character textures seem to be 512x512x24 jpgs. I wonder if other formats can be used.

A guess about the shirts and pants .. png overlays that correspond to UV's on the model?

How are the textures associated with the models; what to name them?

David
Project Leader
Posts: 1995
Joined: Wed Nov 19, 2003 10:45 pm
Contact:

Re: Lugaru character modding in Blender

Post by David » Mon May 31, 2010 10:22 pm

It sounds like body7 is correct -- one of the morph targets is for when a character's head explodes :)

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 » Tue Jun 01, 2010 6:22 am

PsychotropicDog wrote: I am assuming to get a custom character to act like the character in game, it will be necessary to have 7 copies, each with corresponding adjustments as above.
To fully understand what each individual Body.solid addresses, it's necessary to look at the source code with that mental filter applied. I haven't done that yet. All I can say is that Body7.solid is for getting a mashed head, Bodylow.solid is for low LoD and that the rest only work nicely if differences between them are minute.

My guess is that the game cycles through Body.solid - Body6.solid.
Edge smoothing?
I think I first tried exporting the imported solid to DXF format from blender, then importing into Maya.
I noticed some edge smoothing which does not seem to be present in OBJ version.
I should investigate, but I suppose the question is, how much edge smoothing?
I don't have Maya, so I can't look into this. But maybe the Blender DXF exporter auto-applies edge smoothing for some reason? Might even be a smoothing of 0.0.

The solid importer doesn't do anything but import verts, build tri structures and set UV mapping.
I noticed a belt.solid as well.
The Belt.solid, its skeleton (Rabbitbelt), the Body meshes and the associated skeletons, are loaded into a player structure upon level start.

I'm not sure what Belt.solid and Rabbitbelt do because again, it would involve digging into Lugaru sourcecode, and I can't do that right now. But I've done a lot of experiments while simply ignoring Belt.solid, that worked out okay.

Maybe it determines the holstered positions of weapons? Can't say, really. You'd have to either experiment or ignore this solid right now.
Textures
Character textures seem to be 512x512x24 jpgs. I wonder if other formats can be used.
No. Maybe down the line though, when opensource Lugaru has progressed beyond structural improvements.
A guess about the shirts and pants .. png overlays that correspond to UV's on the model?
Correct.
How are the textures associated with the models; what to name them?
Shirts and pants are referenced in levels. What they're called depends on what that level says.

Shirts and pants can be set by the user in debug mode with the "clothes" command. See http://wiki.wolfire.com/index.php/Conso ... Appearance

So you could make your own clothing set for your character, make maps and dress your character up so that he always has clothes of said set on.

If you're modding a character though and want to make it a really robust mod, you might want to mod all related clothes textures that shipped with Lugaru so that they match your character's appearance both in terms of style and UV mapping. The reason for this is that players will play old maps with your character, and these old maps contain references to old clothes.


Thanks for using this stuff. Be warned though: The skeleton import/export path is buggy (vertex groups aren't right). If you want to get a proper skeleton mapping, you can send me your model .blender file, preferably with all joint verts associated with individual vert groups, and I'll reorder the vert groups for you and will give you a working skeleton.
The bug's already fixed locally, but I'm in the process of getting my code to comply with the GPL, and this takes time, and I have no over-abundance of that, to say the least. But this shouldn't stop you from modding. So take advantage of this offer if you want to make custom skeletons for your custom .solids.

WingedWolf93
Posts: 110
Joined: Tue Jan 15, 2008 10:59 am

Re: Lugaru character modding in Blender

Post by WingedWolf93 » Tue Jun 01, 2010 12:23 pm

rudel_ic wrote:
I noticed a belt.solid as well.
The Belt.solid, its skeleton (Rabbitbelt), the Body meshes and the associated skeletons, are loaded into a player structure upon level start.

I'm not sure what Belt.solid and Rabbitbelt do because again, it would involve digging into Lugaru sourcecode, and I can't do that right now. But I've done a lot of experiments while simply ignoring Belt.solid, that worked out okay.

Maybe it determines the holstered positions of weapons? Can't say, really. You'd have to either experiment or ignore this solid right now.
I think i remember some old screenshots of an early version of Lugaru - some characters seemed to wear some sort of primitive 3d belt model. Maybe it has something to do with that? And if so, why did David take this out?

User avatar
PsychotropicDog
Posts: 52
Joined: Fri May 28, 2010 2:39 pm

Re: Lugaru character modding in Blender

Post by PsychotropicDog » Tue Jun 01, 2010 1:22 pm

Thanks for using this stuff.
Thanks for making it!

It should be noted that in game the eyes will blink, independant of what else is going on in Body3. Likewise with the fist clench and tail wag. So I would not expect a simple cycle. I will have to watch your video again rudel_ic (nicely done by the way) but I'll throw another guess out there -
Incidental random animations, such as a blink, reference the morph target (example Body3.solid) AND a vertex group. So, for a blink, if I am deducing correctly here, the cycle would be Body.solid.Sx Body3.solid.Sx Body4.solid.Sx, where Sx is the vertex group for the top part of the head.
The other incidentals would be tail wag, fist clench, ear twitch, ...

The blink seems to be Body and Body3. The Body4 eyes closed is probably for dead rabbits.

5269 is the line the 'morphness' seems to start.

Sadly, the source code has very little clarifying comments.
Here's a snippet dealing with the ear twitch, I added some comments:

Code: Select all

// line 5401, from Person.cpp in Lugaru source code
if(!dead){  
	twitchdelay-=multiplier*1.5;
	if(targetanimation!=hurtidleanim){
		if(headmorphstart==0&&headmorphend==0&&twitchdelay<=0){
			headmorphness=0;
			// start of the animation  (Body.solid)
			targetheadmorphness=1;
			// end of the animation    (Body5.solid)
			headmorphend=5;
			twitchdelay=(float)(abs(Random()%40))/5;
		}
		// ready to reverse the animation
		if(headmorphstart==5&&headmorphend==5){
			headmorphness=0;
			// end of the animation, back to Body.solid
			targetheadmorphness=1;
			headmorphend=0;
		}
	}
The term morph could be interpolation between the start state and the end state, with the current state (displayed) one or the other or something in between.
The other option is just the two states, with a time delay to hold the second.

Anyhow, it does seem to me that the vertex groups are vital to getting a custom character to act properly in game.

Knowing where the joints are placed will make modeling better. I will probably take the skeleton using your scripts, and model a reference skeleton so I know where the joints are.

I have loaded Body - Body7 in the same maya scene, color coded ROYGBIV and grey, slightly transparent, and each mesh on it's own layer, and it is very easy to see what differences there are between the morph targets.

A question for later...
Is each vertex bound to a single joint?

DXF and edge smoothing- artifacts I presume, I reloaded another and the smooth shading was nonsensical. Thus I will stick to OBJ for maya importing.

Belt - I have an urge to kill some wolves and rabbits before I investigate belts.

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 » Tue Jun 01, 2010 2:30 pm

I'll hold my comments on the morphing thing back until I've understood it fully, but you seem to have a pretty good idea what it's about.
PsychotropicDog wrote: Anyhow, it does seem to me that the vertex groups are vital to getting a custom character to act properly in game.
Note that the vertex groups are static across Body.solid - Body7.solid. But you may be right in the sense that maybe, only head stuff gets morphed at some point, leaving the rest untouched. Should be easy to confirm, not sure if it's worth the effort though.
Knowing where the joints are placed will make modeling better. I will probably take the skeleton using your scripts, and model a reference skeleton so I know where the joints are.
You can directly import the skeleton, then you can see where the joints are located. The problem really just is that the vertex -> joint mapping is messed up, meaning it doesn't always match the game's hardcoded order of joints.

So if you make a vertex -> joint mapping and stuff is messed up, just ping me and I'll fix stuff for you and give you a working skeleton. I'll do that as often as you want because it's pretty easy to do, it's just some renaming operations, takes like 2 minutes.
I have loaded Body - Body7 in the same maya scene, color coded ROYGBIV and grey, slightly transparent, and each mesh on it's own layer, and it is very easy to see what differences there are between the morph targets.
Nice. This should come in handy as a reference for the most hardcore of character modders.
A question for later...
Is each vertex bound to a single joint?
To be exact, the vertex -> joint mapping is a function. So each vertex has one or zero associated joints, and a joint can have any number of associated vertices. The joints are represented by the vertex groups.

Image

Edit: It's important to note that weighting is irrelevant. It's binary. Either a vertex is associated with a vertex group (joint) or it isn't.

I think I can't be any more descriptive than that.
DXF and edge smoothing- artifacts I presume, I reloaded another and the smooth shading was nonsensical. Thus I will stick to OBJ for maya importing.
Weird. Good to know. My transfer format of choice is COLLADA, if you're interested.
Belt - I have an urge to kill some wolves and rabbits before I investigate belts.
Kill 'em all.

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

Re: Lugaru character modding in Blender

Post by Lotus Wolf » Wed Jun 02, 2010 11:50 pm

Looks like you found someone smart to talk to about this stuff, rudel. :P

User avatar
PsychotropicDog
Posts: 52
Joined: Fri May 28, 2010 2:39 pm

Re: Lugaru character modding in Blender

Post by PsychotropicDog » Fri Jun 04, 2010 6:22 pm

Well eventually I probably will take you up on the offer Rudel. I'll one day look at COLLADA, apparently open source etc. and there's a collada for maya.

I've noticed a few things such as the skeleton (armature) is not symmetrical. Then I read it in jo-shadow's thread about a custom model. That was looking good too, but nothing too recent - must be exams/ r/l or jo is going to surprise us with a complete mod.

Anyhow, I'll post a pic of my progress so far in another thread. Any relevant questions can get reposted or relinked here.

giggle @ Lotus Wolf.
You don't have to be smart, just slightly experienced :D

User avatar
webhead
Posts: 11
Joined: Sun May 22, 2011 7:28 pm

Re: Lugaru character modding in Blender

Post by webhead » Sun May 22, 2011 7:45 pm

Hey Guys!

I just started doing some lugaru modeling in Blender! this is my first attempt, I put his ears back to give him that mad/cute look :wink: .

Let me know what you think!

Image

Steve
Attachments
Lugaru Ears Back.zip
Here's the models and skeleton if you want to try it yourself.
(168.66 KiB) Downloaded 407 times

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

Post by rudel_ic » Mon May 23, 2011 10:46 am

Obviously, I'm totally into it! Good job!

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

Re: Lugaru character modding in Blender

Post by Lotus Wolf » Wed Jun 01, 2011 10:11 am

I'm glad to see others using the scripts, great job!

Post Reply