Half-Life: Alyx

Half-Life: Alyx

Not enough ratings
How to Make Cloth Physics in Source 2
By Komegatze
This is a steam version of SD's Cloth Proxy Sim discord thread made into a Steam Guide.
Link to sfm discord: https://discord.gg/h9wxPmwPgd
link to original cloth proxy sim thread: https://discord.com/channels/225224650899193859/700816580287791116/923626172003262525
   
Award
Favorite
Favorited
Unfavorite
Tools of the Trade
You'll need Blender 2.93 (The Blender Source Tools addon works best with this, but its not required)

the Blender Source Tools
This is a modified version where vertex groups tend to work better
https://github.com/Moonded/BlenderSourceTools

and Modeldoc
Blender
Starting with Blender (You will need some basic knowledge)

1. Import mesh in Blender
















2. Seperate mesh into parts that you want to do cloth sim with












3. Duplicate it and add "_proxy" at the end of it (or anything really, as long as you know it's a proxy mesh)




4. Now for the longest part. You're gonna have to retopologize the mesh to be one sided ONLY
DO NOT LEAVE ANY INNER FACES
REMOVE ANY FACES/VERTS THAT CREATE ANY SORT OF DEPTH. If you end up with holes in your mesh. select the edges and press Alt F to fill. Keep the beautify option checked
You must make this mesh as flat as possible















In order to know if there are any inner faces in the mesh, enable backface culling. Only the outside faces should be visible










Side note: S&box guide recommend to make their proxy mesh out of quads, but that is not necessary

Originally posted by John Co:
it's worth mentioning that it generates a cloth bone for every vertex of the proxy mesh, so if its comically high poly it might be worth doing a bit of decimate to the proxy

5. Select the proxy mesh and go to scene properties. In the "Source Engine Export" tab, select DMX and set DMX version to Binary 9, Model 22









Afterwards, in the "Source Engine Exportables tab". Float maps should be visible











In the float maps section, click on the + button to add these 4 required vertex groups
cloth_enable
cloth_goal_strength_v2
cloth_collision_radius
cloth_ground_collision
Feel free to experiment with the other float maps


6. Check the vertex groups on the proxy mesh and check if everything is there








7. Go into edit mode and select the polygons you want to simulate on your mesh










8. Select the "cloth_enable" vertex group and click "assign" to assign the selected polygons to the vertex group








9. Stay in edit mode
Invert your selection with Ctrl i
Select the "cloth_goal_strength_v2" vertex group and click "assign" to assign the selected polygons to the vertex group. This will tell modeldoc that these polygons will not be simulated.

CTRL A to select all the polygons and assign them to "cloth_collision_radius" and "cloth_ground_collision"
10. Transfer the "cloth_enable" vertex group from the proxy mesh to the cloth mesh
What I usually do is add an empty vertex group on the cloth mesh
select the proxy mesh and shift select the cloth mesh
Afterwards, go into weight paint mode
Select transfer weights










Blender will automatically "paint" the verts from the proxy mesh onto the cloth mesh











Rename the "group" vertex group to "cloth_enable"

NOTE:
Any adjustments from here will require a repeat of step 10. Just delete the vertex group and reapply
11. Go into object mode and finally export your meshes
Modeldoc
12. Import your mesh(es), Give it a basic dev material, and import an animation (reuse the mesh)






NOTE:
Disregard the warning(s), what matters now is getting this to work
13. import your proxy mesh with "ClothProxyMeshFile" in modeldoc



once imported, check off these options






Compile, press the play button, and enable cloth sim













It will look very droopy by default
14. Right click "ClothProxyMeshList" and click on "Add ClothParams"








15. For now, set "extra iterations" to 20. The more iterations, the better the simulation, the worse the framerate gets




Not so droopy












Scroll down the list and check off these options and adjust "minimal bend" (I personally prefer .75). It helps to minimize the lack of self collision (If it exists, I don't know how to enable it)

NOTE:
Minimal bend also impacts the simulation performance along side the extra iterations









The simulation should be good now
Finally
16. Add cloth collision shapes in ModelDoc





For this example, im only adding it to one bone, im not setting up the whole thing here
Move around and mess with the radius's till you're satisfied. it will update in real time, or it will spaz out, It usually fixes itself once compiled






Often, you'll end up with a complex setup once completed. You can add more than one shape to a bone















From this point on, this little rushed guide is over
The cloth sim will vary from mesh to mesh
You will end up with problems
My suggestion is to try and try again till you end up with something you will like
Adjust the cloth settings in ModelDoc till you find what suits your preferences
2 Comments
V3_True 27 Oct @ 9:03pm 
peak male preformance
tokN 22 Jun @ 2:01am 
Hey!

I am making a cs2 map and i want a banner hanging from the wall that have some motion in it, do you know if this is possible?

I have tried but can not figure out how to do it