Actor Fashion, Gear, Armor - How To

Given the exp I’ve gained using P3D thus far, I decided to drop the app I was working on. I want to start another one which I have the idea for, but don’t know how to go about doing this -

I want my actors in the nude, so I can attach armor/clothing to them as needed. Given P3D’s structure, I’m not sure on how to go about doing that.

The Armor/Clothing would need to deform with the mesh, according to the skel data. So far, I have only been able to get parts exported as Actors (apart of actor) to deform with the skel data (animation data).

I know Drwr ‘texed’ that getTransform or getNetTransfrom (something like that) along with setTransform (or setNet) could animate a non Actor mesh.

I wonder if that function/method would be the foundation for accomplishing what I want to do?

or

Would I have to somehow Tag Armor/Clothing etc so I can access it on the sub level (if only I could do that) and maybe force it to hide or something…but that would mean every piece of equipment for an Actor would have to be loaded up as apart of that Actor.

I would rather not go there.

I would rather just attach clothing to my Actors and see that clothing deform along with it.

Modeling with Blender 2.4b

Can’t you just use reparentTo? For example, in a project I’m working on, there’s a racing car. The four wheels are loaded separately - and then reparented to the car. So where the car moves - they move - but I can spin/turn them each independently (child node does not effect parent node, parent node does effect child).

Failing that - why not load everything at once? It needn’t be that bad. Set default textures on clothes etc. to transparent… leaving your nude model. Then just texture swap as needed to clothe etc… Again, on example given, I do a similar thing. Above a certain speed I swap the textures on each wheel to a ‘motion blurred’ version.

Cheers,
~G

Since I need deformation, your idea two sounds better, but still off. The problem with that is, the geometry. Low polygon modeling is what I’m aiming for, so loading up all armor/clothing geometry would defeat that purpose. I also need clothing to deform with the Actor.

Drwr, how can I make this happen?

You can have more then one mesh/geom in an actor, they all just need to be in one ‘Dart’ group in the egg file, then you need to tag (name) the meshes so you can find them in code to show/hide.
You can have all the cloths, weapons, hand held items etc in one egg file and have the unneeded parts hidden by default (there’s an option for that, no need for alpha textures).

I don’t know how the Blender exporter works but if the 3dsmax exporter can write multi-mesh actors then chicken should as well…if not… well you can always hand edit the eggs and/or use egg-optchar (just make sure it didn’t eat any bones).

If you plan to change textures in code later and have different textures for each part then I’d suggest to rename the texture stages. The max exporter names them Tex1, Tex2 etc so with 5 or 6 models it’s hard to tell if Tex7 is the normal for the shirt or the colour for the pants.

I am yet to get the hang of egg-optchar. It always destroy my animations by forgetting some bones. I haven’t tried Drwr’s suggestion, which was to add -keepall to the egg-optchar command in order to ensure bones are not lost.

I will test that, because I would love to have control over Actor subobjects.

What I thought of for the clothing issue is this -
Create cloths/armor that do NOT pass over an Actors joints. In other words, create armor/clothing which I can attach directly to an Actor’s bone, that does not need to bend; it would just have to stay in place on the Actor. Example: Armor Chest Plate; I could just attach it to the Actor’s upper body bone. It would not have to deform, just move with the Actor.

The downside to creathing clothing/armor that way is the fact one would be limited in creations. If I do really need pants on my Actor, I could always swap out the texture mat for an identical one that has clothing on it that needs to deform with the Actor. In other words, textured based clothing.

It looks like those are the only options with P3D’s current APIs.

I strongly recommend trying out egg-optchar with -keepall and naming your subparts with it. It works for me.

I’m using it like this:
egg-optchar -o char_final.egg -flag plaszcz01=duster char_wip.egg

Then in code pc_actor.find("**/duster").show()
I also put visibility { hidden} so the default state is hidden.
Works like a charm (well apart from some artefacts where the shirt is visible through the duster, but that’s just poor rigging).

img441.imageshack.us/img441/6751/noduster.jpg
img847.imageshack.us/img847/2430/dustera.jpg

Are those hidden vertices still calculated in the deformation? They aren’t exactly detached from render; they are in render, by being apart of the character, but are hidden, which would mean all those extra animated vertices (not seen) will still be transformed, but not sent to the graphic card.

I moved from my 64 bit windows 7 (AMD Nvidia) to my Vista (intel 32 bit ATI). The project I was making at the time looked different on the 32 bit Intel with ATI; even the speed of playback was different. It was unstable even though the fps was still good.

Higher end systems can really fool you when it comes to performance, so I’ll be using my 32 bit PC for development and really watch my Actor’s vertice count. P3D is fast enough, but that depends on the type of game you’re making and how good you are at low poly modeling.

I just made another Actor that finished around 1300K vertices, which works best with P3D (especially if you need a lot of Actors on screen like I do for this new project). I would rather not have hidden vertices so I’ll just try my idea I mentioned in my earlier post.

Hiding a GeomNode prevents it from animating its vertices needlessly.

David

Very useful thread.

I’m starting to do this now. (use multiple parts on a model which can be hidden/unhidden by the player to customize their character).

2 questions:

  1. Is there an easy way to hide all the parts in the model by default . I know it says to use visibility { hidden} above, but this would take a while in a model with lots of parts. Is there a flag in egg-optchar or some other way to do this programmatically.

  2. Is related to 1. I haven’t used node.find() a lot yet - is there a syntax for wildcards?
    If I wanted to hide all parts that start with “c”, how would I do it? I tried:

self.model.find("**/c*") 
and
self.model.find("**/c")

but it didn’t work

whereas if I call 1 part by name, it’s fine:

self.model.find("**/cape")

I bet you’d prefer to have all the clothes and armor be individual files, to be more extensible. Another method is to make each of those its own actor, and then have them positioned and animated in sync with the actor for your character. Export each of these with the same base skeleton bound onto it; since the joints will all have the same name, you can apply the same animation onto them at the same time and it will look just like they’re part of the same model.

This might sound inefficient at first, because you end up with multiple skeletons moving around on top of each other instead of just one. However, moving joints around is cheap; it’s the skin deformation that’s expensive and you have the same number of vertices moving around in either case.

And it makes your workflow much much easier. You do still have to weight the individual clothes properly, but you will always need to do that no matter what. I usually start by just transferring the skin weights from the underlying body mesh onto each piece of clothing; in many cases that’s actually all you have to do.

Thanks for the reply. We have already done what you suggest with some items , mainly weapons. It works well, though it does require about more code. Long term we do plan to use that approach for weapons that are picked up, wielded., etc.

However, the extra parts in the character mesh is a bit easier for us workflow-wise. Less work to line things up and we are doing stuff with texture mapping and shared animations that also lead us to prefer hiding/unhidibg certain things on the model.

I’m the coder, by the way, not the 3d artist, so I’ve probably explained the above all wrong :slight_smile: in any case, is there a wildcard syntax for find()?

Or even maybe a method that returns a list of all the parts defined in the model? I could then parse it myself?

I was trying to do that with the cape, but my horribly inept coding “skillz” meant that it didn’t really work.
If we can have the “external” models spoken of here rather than building everything into the one model it does mean that we could make more costume parts addable a bit more easily than our current re-export the massive multi-model again.
It does have that downside of exporting lots oftimes rather than once.
Maybe we can do both internal and external costume parts models, since external is what we plan for the weapons.
Start with the big all-costumes-in-one-model, and then have any subsequent costume parts addable as separate models, provided the costume/weapon code is flexible to allow both?

Yes, since the weapons at least will be external models, I think I can make the code flexible enough to allow additional parts to be added that way as well.

I still would like a way to get a list of the parts that egg-optchar has “named” in the egg file, though.

What I was looking for was simply: findAllMatches("**")