Cloth Simulation
Not just for Cloth, it can be anything cloth related, can be used for anything that has constant topology.
For this we'll be using an animation clip from Mixamo. Note that if you will be using an animation that moves away from the root, you'll need to check the setting 'in place' so that it stays at the origin.
For this we'll be using the character 'Survivor A Lusth' (we renamed him to Rudey) with the animation 'Silly Dancing'. Make a folder inside your Houdini project named characters, then another folder inside with the characters name.
Inside Houdini, create a geo node and drop inside. Look for an agent sop (this will automatically do the unit conversions for us so we don't have to change the scale).
Usually you'll bring in a t-pose character, and then bring in animation clips on a skeleton separately, and then hook them up. But with Mixamo we downloaded the fbx animation with the skin, so we're kinda skipping those steps,
Inside the agent node, change the agent name to your character's name, and then change the Input from character rig to fbx. On the drop down below find the path to your character's fbx file. For the 'Current Clip', set it to mixamo.com so it works properly.
If we were to do this with a separate rig and animation files, the current clip would be used to choose the animation clips we wanted to bring in. But since it's included in the fbx, setting it to mixamo.com makes it work (not even entirely sure if you really need this but ok).
To view your animation in real time, click the clock icon on the timeline
Ctrl + up and Ctrl + Down arrow flips between the first and last frame of your timeline in Houdini.
When you click the info icon on the agent node. You'll see it only has 1 point, primitive, and verticies
We need to unpack the fbx so we get the actual geometry. Look for an unpack node and attach it to the agent node. Then attach a convert node
Now if you look at the info on the convert node you'll see you have a lot more points and vertices.
We need to unpack the fbx so we get the actual geometry. Look for an unpack node and attach it to the agent node. Then attach a convert node
Now if you look at the info on the convert node you'll see you have a lot more points and vertices.
Difference between a point and a vertex. A point is used to store the position information. Vertices can store more information. If you have a cube with 8 points, it has 6 faces. On each face, it has 4 vertices to store additional information (think surface normals). So that cube would have 24 vertices. This is more optimized so that the vertices reference the point's position while storing other info.
Change the mode to soft-body deformation and make sure the engine is Unreal Engine. Then find the Output node you made for the character. Click relative path and hit accept.
Note, if you get an error about overwriting vertex attributes uv2, go back to your character, and add an attribute delete node. Find the vertex attributes parameter and delete the uv2 attribute if it has it. Now it should work.
Back into the rop network, you can check if you need to increase the target Texture width under the settings.
Our character has around 6,000 points. If your character has more points, you might need a higher resolution for the texture.
Base the texture resolution based on the number of points, not the vertices. We're animating the points.
To export, go to the export tab, change the export path and asset name as necessary, and hit render all.
When you hit export, like the rigidbody export you'll get a folder for the geo and a folder for the textures.
In Unreal
Inside your project import the geo fbx that was exported. You'll use the same import settings as the rbd import we did last week.
- Vertex Color Import Option: Replace
- Transform Vertex to Absolute: Yes
- Normal Import Method: Import Normals and Tangets
- Convert Scene: Yes
- Override Full Name: Yes
- Material Import Method: Do not create Material
- Reorder material to FBX order: Yes
Note: if you had a high amount of points in your character, you may need to go into their geo settings and find 'Use High Precision Tangent Basis'. You might need to turn it on later. Leave it off for now but if things don't work right try turning it on.
Now bring in your textures. We found out this week that Houdini still has the python script included that automatically changes the textures to the correct settings we need. Right click over the selected textures > Scripted Asset Actions > Houdini Config Textures for VAT (HDR).
Now create your material. This is going to follow the same structure as the rbd material. Turn off the tangent space normals and then have num custom uvs to 5. Look up the soft body deformation materifal function node and hook up the inputs.
Create a material instance, and attach the necessary textures.
You can change the preview mesh to your geo fbx you brought in and your character should be animated.
If your character is exploding then it might mean you need a higher texture resolution for your vats.
Adding Mixamo Textures
This is optional. If you want to get the texture files from the fbx in Houdini, create a new geometry node with a file node inside. Load the character fbx into that file. Houdini will automatically generate a folder next to the character fbx in windows explorer with the textures.
This is how we added it to the material graph. This is more of a brute force way but it works for now
No comments:
Post a Comment