Topic: Alternate color/alternate costume

Hi! i was wondering recently about how to implement an alternate costume for our characters instead of the color 2 option already in UFE... i was wondering it could be possible if we can load a different prefab as a second out fit, it could be anything from a different mesh altogether to just a mesh with different material and hence a new color.

i know it needs some more work, like for example have the skeleton, the same size, and the very sames attacks, but well, that's the point of an alternate costume right?

my characters already kind of have i similar bone structure, so even in the preview of an animation, the properties of the move works...

so it's a thing about getting it right from the 3d design program.

so the question is? how could it be implemented and what else can be done, like for example changing the prefab dinamically, depending on Move Set, like Bloody Roar, or Sol in dragon install in the new Guilty gear.

http://s5.postimg.org/i4lqul8xj/kitty_alt.jpg

http://s5.postimg.org/yr3b3o1vb/leonidas_alt.jpg

http://s5.postimg.org/kw0f7gi2f/saulo_alt.jpg

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Alternate color/alternate costume

There's still the issue that even the slightest change/difference in the rig dimensions will mean you have different behaviour.  Imagine you have an alt model that has slightly longer legs - now their kicks will reach further; if one rig's rotation is slightly off, you now have a limb that travels on a different arc.  There's just way too many things that can go wrong and essentially ruin the gameplay of your game.  Not to mention that if you're using Legacy, you have to ensure your rigs are completely identical otherwise animations won't work; and hitboxes won't work, even in Mecanim, if you've assigned a hitbox to a transform that is missing.

Of course, if this level of precise gameplay isn't a factor (or rather, it may be intentional to have alt costumes behave differently), then this solution is fine smile.

Probably the safest thing to do is just use alt materials/textures/colors for alt colors.  And for costumes have additional clothing as game objects that are parented to the rig (base rig is essentially naked body).  This way, you don't actually change the base prefab, and you can potentially code this up to work in runtime as well (swapping out parts of the model).

Share

Thumbs up +1 Thumbs down

Re: Alternate color/alternate costume

I can't give you the exact code from a paid asset, but I can tell you the author included a reference to http://forum.unity3d.com/threads/16485- … post126864

He uses a single rig with multiple mesh GameObjects attached to it for shirts, pants, so on and toggles the GameObject.SetActive for the individual item to make it the one that's visible. Since it still tracks back to the shared bone, it still animates.

Share

Thumbs up Thumbs down

Re: Alternate color/alternate costume

YumChaGames wrote:

There's still the issue that even the slightest change/difference in the rig dimensions will mean you have different behaviour.  Imagine you have an alt model that has slightly longer legs - now their kicks will reach further; if one rig's rotation is slightly off, you now have a limb that travels on a different arc.  There's just way too many things that can go wrong and essentially ruin the gameplay of your game.  Not to mention that if you're using Legacy, you have to ensure your rigs are completely identical otherwise animations won't work; and hitboxes won't work, even in Mecanim, if you've assigned a hitbox to a transform that is missing.

Of course, if this level of precise gameplay isn't a factor (or rather, it may be intentional to have alt costumes behave differently), then this solution is fine smile.

Probably the safest thing to do is just use alt materials/textures/colors for alt colors.  And for costumes have additional clothing as game objects that are parented to the rig (base rig is essentially naked body).  This way, you don't actually change the base prefab, and you can potentially code this up to work in runtime as well (swapping out parts of the model).

So what your saying is if you wanted to have costumes such as a original model wears a shirt and pants then the costume version is him in a monkey suite or something it won't work?

Share

Thumbs up Thumbs down

Re: Alternate color/alternate costume

Domainator wrote:
YumChaGames wrote:

*snip*

Probably the safest thing to do is just use alt materials/textures/colors for alt colors.  And for costumes have additional clothing as game objects that are parented to the rig (base rig is essentially naked body).  This way, you don't actually change the base prefab, and you can potentially code this up to work in runtime as well (swapping out parts of the model).

So what your saying is if you wanted to have costumes such as a original model wears a shirt and pants then the costume version is him in a monkey suite or something it won't work?

Admittedly, my emphasised quote above implies the clothing is in chunks and doesn't require skinning/weights (like armour).

But it should also be possible to do it with skinned meshes, and it will definitely need the same hierarchy on the rig used.

Again, I would advise to keep a tight reign on the rig used to avoid even the slightest difference in a bone's position/rotation/scale to ensure hitboxes aren't altered for new costumes.

Share

Thumbs up Thumbs down

6 (edited by roswell108 2015-04-12 23:45:35)

Re: Alternate color/alternate costume

YumChaGames wrote:
Domainator wrote:
YumChaGames wrote:

*snip*

Probably the safest thing to do is just use alt materials/textures/colors for alt colors.  And for costumes have additional clothing as game objects that are parented to the rig (base rig is essentially naked body).  This way, you don't actually change the base prefab, and you can potentially code this up to work in runtime as well (swapping out parts of the model).

So what your saying is if you wanted to have costumes such as a original model wears a shirt and pants then the costume version is him in a monkey suite or something it won't work?

Admittedly, my emphasised quote above implies the clothing is in chunks and doesn't require skinning/weights (like armour).

But it should also be possible to do it with skinned meshes, and it will definitely need the same hierarchy on the rig used.

Again, I would advise to keep a tight reign on the rig used to avoid even the slightest difference in a bone's position/rotation/scale to ensure hitboxes aren't altered for new costumes.

That link above IS how to do it. It's a full tutorial, including scripts and explanations.

"Ok, here we go, finally got around to jotting a bit down!

Bones - Just a hierarchy of GameObjects. The transforms are what the system uses
Animation Clips - Collection of vectors to modify transforms. Animation clips reference the bone by name I believe (although I haven't tested this fully, it works in my scripts).

So, you want to stitch some models together to share the bones and share an animation component. Took me a bit to figure this out, then again I'm a bit slow smile"

Share

Thumbs up Thumbs down

Re: Alternate color/alternate costume

Ah, I didn't view it on Youtube, so didn't know it was part of a tutorial wink.

That's good though, as that would be the way to do it.

STILL!!  My point about misaligned hitboxes applies.  Just be careful with how you're skinning and assigning hitboxes and that should avoid any issues there...

roswell108 wrote:

Bones - Just a hierarchy of GameObjects. The transforms are what the system uses

This is true, but it's important to ensure alt versions of characters behave the same as regular versions.  If your costume has longer arms (therefore granting more range), then that costume is always better to pick than the regular one.

I would hope that in most cases, 3D artists are referring the same base rig anyway when creating alt costumes, so that should avoid this issue too.

The only exception to this, is if you actually want the alt costumes to behave differently.  I could see a case for this, especially in a game with a small cast and many costume options that can alter gameplay.

Share

Thumbs up Thumbs down

Re: Alternate color/alternate costume

YumChaGames wrote:

Ah, I didn't view it on Youtube, so didn't know it was part of a tutorial wink.

That's good though, as that would be the way to do it.

STILL!!  My point about misaligned hitboxes applies.  Just be careful with how you're skinning and assigning hitboxes and that should avoid any issues there...

roswell108 wrote:

Bones - Just a hierarchy of GameObjects. The transforms are what the system uses

This is true, but it's important to ensure alt versions of characters behave the same as regular versions.  If your costume has longer arms (therefore granting more range), then that costume is always better to pick than the regular one.

I would hope that in most cases, 3D artists are referring the same base rig anyway when creating alt costumes, so that should avoid this issue too.

The only exception to this, is if you actually want the alt costumes to behave differently.  I could see a case for this, especially in a game with a small cast and many costume options that can alter gameplay.

The "" is how the tutorial starts off. Any disagreement should probably be taken up with the author.

The tutorial provided there was used in Blade NPC and appears to work well. It isn't too hard to add the mesh and textures onto the same rig in Blender. The only reason it wouldn't work would be trying to cut corners by using two separate models.

Share

Thumbs up Thumbs down