Making a clothing system?

As a proof of concept, I’m designing a simple action-adventure game with some rpg elements, most specifically a clothing system.

I’ve got the system sketched on paper and I’ve written down how I would imagine it would work. It includes having two layers of clothing (three on the torso) and spots for armor pieces that either replace some clothing or are placed the clothing. For example, you have three layers of clothing on the torso. The shirt, undercoat, and overcoat. You can also wear light or heavy armor on the torso. Light armor would replace the undercoat and the heavy variant would replace the overcoat.

Now how would I model the pieces of clothing? How would I make them so I can display a partially transparent coat above a shirt but still keep all the detail and keep the performance cost at a minimum?

And how would I implement it in a jMonkeyEngine game? An in-depth answer would be appreciated, and please don’t direct me to the manual, it doesn’t have what I’m looking for.

Um… I won’t point you at the tutorials (even though they have EVERYTHING you need for the basic understanding of how to implement this).

But I will say, this is a game engine (programming required). This sounds like standard OOP stuff + the basic understand of JME Graphics/Model/Animation handling.

I’m not trying to be offensive, but saying “an in-depth answer would be appreciated” is like saying… “If you would program out my design, I would appreciate it”.

Hopefully for you someone has the hours it would take to explain this in full, but maybe asking more pointed (focused) questions would get you a helpful response.

Well I would use a shader that combines the different cloth layers accordingly

Maybee a vertex shader, taht moves a few vertices a bit to allow different contours.

I didn’t ask for anyone to write out any code. I need someone to explain the workflow of creating clothing pieces and I want the name of the method you would use to make it work in a a game. Sorry if that was unclear.

What you describe is just “hide” clothes you don’t want to be visible according to some rules.

THIS is what you want : Parts Files - HEWIKI

Too bad jme is not so advanced.

Sure thats possible with jme3, check out world forge.



@aevun said:
I didn't ask for anyone to write out any code. I need someone to explain the workflow of creating clothing pieces and I want the name of the method you would use to make it work in a a game. Sorry if that was unclear.

Here we go:

A Clothing System :
1) Exchangable (of course) : Player can dicide what they wear
2) Fit-able : Even if you player model are tall or short, the Clothes shall fit!
3) Ani-able: Clothes can have their own animation, ( different from what just attach to an Arm)
4) Physics : Clothes have physic bound and collision

Assume that you making model in an 3DModeler like 3dsmax, maya or Blender, here Blender is our choice for FOSP
1) so start with Blender:
2) Separete your models into : player , hermet , gloves, dress, boots, backpack. But all should have a same bones. Save them into separate *.blend file( as much of separation as you can handle and exchange purpose )
3) Save a text : filename, name, type, physic-type of the parts then load it in your game engine.
1) Exchangeble feature can solved with attach() and remove() Node;

2) Fit-able : I'm not sure JME3 have built-in solution for this, but as when the structures of body part and clothes part are the same, you can do the translate computing ( translate/scale/rotate) to make them sync again). I don't really sure about this, so @nehon or @momoko @normen can tell him!

3) Ani-able : Add extra bones if need but add them after your sync the fit-able bones

4) Physic-able: Gererate boundVolume for part, solid or soft?

Thanks. Theres also the thing about cloth-physics. Any idea when that will be possible within the JME?

To make them able to collide is already in. What do you want for physics?

Well I don’t really need or want cloth-simulations for each cloth piece to simulate wrinkles, so the logical answer would be for capes and waist-cloths and long coats. To be able to have them wave and fall behind while the character is running without having the need to animate the specific motions by hand for every cloth piece there is and for every action the player is able to perform.

So you want a clothsystem ( Cloth in the mean of “cloth” not “clothings” ) and a simple wind system based on entity movement?

Write a clothsystem and its available to jme. Its possible already, just not implemented.

At times I forget how much I will benefit from the open-source aspect of JME when I get started. (<- Always good to have. :smiley: )

Bullet has it implemented, maybe one can port it?

1 Like

Softbody physics is planned for our native bullet implementation. For now I suggest using bones and physics joints, similar to the RagDollControl.

There are several ways of doing this.

First you can use an attachment node (see SkeletonControl.getAttachmentsNode), this is useful for things such as weapons, hats, maybe shoes as well.

For clothing you need it to follow the model exactly, so you may have to animate it separately for each character that you have in the game. For that you can add the animated geometry(s) onto the model node, and then re-attach the skeleton control. The clothing MUST use the same rig as the original model for this to work.

Another way of doing clothing is through textures, you create several layers in e.g. photoshop on the character’s texture. One layer is the character without clothing, then each additional layer can introduce a certain garment like a shirt or pants. You then change the texture at run-time based on the clothing the character should be wearing.

In the ideal case, you combine all 3 techniques to get the desired result.


For that you can add the animated geometry(s) onto the model node, and then re-attach the skeleton control

I'm trying to make a nice Equipments System for my game, read back this topic and I still don't really know what you mean by "re-attach":

Current I sync the few AnimControl to make the equipment go together but still It can become a big troubles when the amount of equipments rising.
Now I tried to make an exported blender model, animated three mesh with the same armature, so they are have extractly the same skeleton. Then converted to J3o, which structure like this:
---Armature (Node)
Body (Node)
Body1 (Geometry) <= Animated
Dress (Node)
Dress1 (Geometry) <= Animated
Hair (Node)
Hair1 (Geometry) <= Animated
============================== Code =====================================

Node models = (Node) assetManager.loadModel("Models/MainCharacter/girlFight2 fix.j3o");
Node playerModel = (Node) getSpatialByPath("Armature/Body", models);
Geometry dress = getGeoByName("Dress1", models);
Geometry hair = getGeoByName("Hair1", models);

control = playerModel.getControl(AnimControl.class);
Skeleton skeleton = control.getSkeleton();



Option A: Contruct a new AnimControl from Skeleton, NPE right away!
control = new AnimControl(skeleton);
\Option B: ... Just add the Control again, Like doing nothing, the Body Geometry got Animation but others still don't!
AnimChannel feet = control.createChannel();
//AnimChannel leftHand = control.createChannel();
//AnimChannel rightHand = control.createChannel();

Oh, how stupid I were, you told us to re-attach the SkeletonControl, which I mistaked to AnimControl …Get It done! Anyway, the SkeletonControl is deprecated, can I ask what solution will replace it?

@atomix no, the SkeletonControl is not deprecated, only the SkeletonControl(Mesh[] targets, Skeleton skeleton) constructor is.

Use the SkeletonControl(Skeleton skeleton) constructor

1 Like

@nehon: Thank you for the infos!

Another quick question regarding the CinematicSystem, as I want my particle made from Spatial not a billboard, I want to extends Cinematic to work like an Timer helping the AdvancedParticle (Placing, Spawning, and control the rate, life, color by curves…). What do you think about it, in fact i have some tests run of the draft system already, and find it very cool, help us make a lot of complex effects!

Have you looked at the various videos, etc CCP have released for Incarna/World of Darkness?

They have some very impressive clothing simulation going on but also comment on just how tricky it is. Things like having a long flowing robe with someone walking under it deforming the robe and never poking through etc.

1 Like