This method involes saving clothing geometry in T-pose, or whatever rest pose your rig uses.
In my case, I am generating characters using Reallusion's Character Creator, which alows a character, with clothing to be posed in any position. The rig I am using comes from MocapOnline which has a T-pose rest position.
It is possible to use any pose, if the rig is key-framed before frame 1 and animated to rest position at the start of the clip. There is a step-by-step demonstration of this process by Kevin Ma, which clearly explains what to do.
What I want is to have an agent with multiple shirts, trousers and shoes. A few of each will give a reasonable variety. I plan to vary the shader on each piece of clothing too, but that will come later.
I need to generate a few versions of my character and save out the geometry. Character Creator can output obj and FBX formats.
Here are the variations of my character that I generated:
I will be using shirts from all five but just three trousers and shoes.
I have named these geometry meshes as MALE_01_VAR_01.obj, MALE_01_VAR_02.obj, etc.
We need to skin all this geometry to the Rig. As mentioned, I am using the Crowd Animation pack from Mocap Online. That comes with a rig and skinned geometry.
Here is what the geometry and rig look like once they have been imported into Houdini.
The third picture shows the geometry and materials that comes with the MocapOnline rig. We will not need these so they can be deleted. We will replace the geometry with our own.
Rename the FBX import node as RIG
Now we will create an un-clothed agent:
Inside RIG, Create a geometry node, name it MALE_01
Jump inside MALE_01 and create a file node.
The file node should point to one of the obj files exported from Character Creator, let's say MALE_01_VAR_01.obj
That file will have clothes but we are going to remove those clothes.
Geometry exported from Character Creator has primitive groups, which is very useful in this next step.
We want to blast away all the primitive groups belonging to the clothes.
Follow that blast node with a null.
This is now ready for skinning to the rig.
Jump up one level so you can see the rig and the geometry object.
Select the geometry object and on the Rigging shelf, press the Capture Geometry button.
The viewport will prompt you to select the root node of the rig. Do that and press enter in the viewport.
After a short calculation, the goemetry will be skinned to the rig. Sort of.
If you see this kind of result, it's because the bind is calculated at frame 0, not frame 1. SideFX in their infinite wisdom have made that the default. It's easily fixed, though.
Jump into the geometry node again. You will see some new nodes.
The node called Bone Capture Lines has an option to specify which frame to use for binding the geometry to the rig. Set that parameter to 1. Then, on the Capture Cache node, press the Stash button. You should now have a properly skinned character.
Jump up to the /obj level and make a new Geomotry node.
Jump inside and drop down an Agent node.
The agent should have the Input set to Character Rig and then specify the RIG node with the rig and geometry inside.
You can import clips in the usual way, and then cache out the agent using the AgentDefinitionCache node.
The details of this process are covered in another post, so I will not spend too much time discussing these steps.
Now for the clothing layers.
Jump inside the RIG node again. We are going to create skinned geometry in the same way that we did for the unclothed body.
Greate a new Geometry node. Rename it MALE_01_SHIRT_01
Inside that node, drop down a File node and import MALE_01_VAR_01.obj
We want to delete everything except the shirt geometry, so use a Blast node and in the Group drop-down, choose the primitive group that refers to the shirt and then check the box 'Delete Non Selected'.
Now you just have the shirt. This can be skinned to the rig, as before.
Jump up one level, select the geometry node with the shirt geometry and press the Capture Geometry button on the Rigging shelf.
Again, you will probably have to set the capture frame to 1 and then hit the Stash button, just like we did before.
So you should now have a shirt skinned to the same rig as the body geometry.
We can make an Agent Layer from this.
A couple of critical points to note here:
Do not use a Source Layer. We want the clothing on it's own, without any body geometry. We are adding the clothing to the default Agent layer, which is the body, so we do not want another copy of the body.
Bind the clothes shape to the Root node of the rig. Because the clothes shape is skinned, it will follow the Root node the same way as the body does.
Repeat this for all the clothes layers you need.
Save the Agent definition using the AgentDefinitionCache node.
Bringing the Agent into a new scene and using the shirt layers requires an Agent SOP with the Input set to Agent Definition Cache. The agent will have a default layer and all the new clothing layers ('shirt_01', 'shirt_02', etc).
To have some agents using the default and some using the shirt layers, I have used 2 Crowdsource nodes.
One node is used for the default layer and the other to chose a random shirt.
You can use the wildcard ('*') to allow Houdini to randomly select a shirt with equal distribution, or you can have a more guided selection, allowing you to choose the probability of which shirt is chosen
The clothes should follow the body with any animation clip that the agent is playing.
My skinning skills are limited, which is why there are some areas of inter-penetration, but with more careful skinning these can be fixed.