// Management · RimWorld Mod

Physical Hair

*machine translate* Physical Hair Make RimWorld hairstyles go Duang~ Duang~ Physical Hair adds dynamic mesh effects to pawn hair.

*machine translate*

Physical Hair


Make RimWorld hairstyles go Duang~ Duang~
Physical Hair adds dynamic mesh effects to pawn hair. Hair will sway with inertia during movement and naturally swing when turning direction. It creates subtle hair variations when pawns move, turn, and stand still, making characters on the map more lively.


Inspiration


The config menu was inspired by the AE plugin AutoSway. The code structure was learned from the Terraria mod Celeste Hair. That is an excellent mod; I merely imitated it and barely replicated a portion of its effects.


Main Features


  • Mesh-based dynamic hairstyle deformation.
  • Built-in CPU simulation and Shader simulation modes.
  • Default uses Shader simulation mode, which has lower performance cost and softer effects compared to CPU simulation.
  • Supports configuring hair parameters for four directions: east, south, west, north.
  • Supports grouping, fixed points/fixed lines, bone connections, collision volumes, and rigidity zone settings.
  • Supports automatic segmentation and gradient rigidity zones.
  • Supports automatic generation of dynamic meshes that better conform to hair strand shapes based on texture transparent regions.
  • Supports debug menu for real-time preview and adjustment of hair performance.
  • Supports saving debug-adjusted parameters back to hair XML, making it convenient for hair authors to create compatibility patches and for players to fine-tune deformation effects of some hairstyles.

In developer mode, selecting a pawn will show a Hair Debug button for opening the debug tool.


Debug Window Real-Time Adjustments


  • Hair mesh density: Controlled by modifying mesh row and column counts. Higher density means higher performance cost but also higher mesh deformation quality.
  • Swing intensity: Affected by multiple parameters, but overall swing intensity can be adjusted in the Shader tab.
  • Root and tip rigidity: Rigidity makes the mesh harder to deform. If it's hard to understand at first, try experimenting with different rigidity zones and rigidity strengths.
  • Fixed points and bones: Used to control which regions are more stable and which regions can swing freely.
  • Collision range: Used in fewer scenarios; can be ignored in most cases.
  • Shader tab: Adjust global parameters such as swing, inertia, turning impact, and idle fluctuation. Most of the time adjusting here is sufficient; Shader mode is superior to CPU mode in almost every aspect.

The left preview area directly displays the current direction's hair dynamic mesh, fixed points, control connections, and rigidity zones.


Usage Tips


Players only need to subscribe and enable. Recommended load order is lower, at least below hair mods and Gradient Hair.

Recommended Tuning Workflow


  1. First confirm that the hair texture and mesh boundaries fit properly.
  2. Adjust Mesh Rows and Mesh Columns to make the mesh fine enough to show hair detail without over-subdividing and affecting performance.
  3. Use fixed points or fixed lines, adjust coverage range, to prevent unwanted mesh regions from deforming.
  4. Many short hairstyles need extra attention for the south direction. I recommend using line-mode rigidity 1 to directly cover the entire "south" direction mesh area, or separately adjust the "south" direction's automatic rigidity gradient options to make the upper part rigidity 1 and the lower part rigidity 1.
  5. Finally adjust movement intensity and Shader parameters to make the sway natural but not excessive.



Compatibility Notes


  • Theoretically automatically compatible with all hair mods.
  • For some hairstyles with additional rendering layers(I made this feature, so I might try updating the auto-patch.), only the hair itself will be dynamicized; extra rendering layers cannot be covered.
  • Compatible with Gradient Hair.
  • Shader simulation is almost entirely superior to CPU mesh simulation.
  • CPU mode is mainly retained because fixed points, bones, and collision body debugging are more intuitive. If you encounter bugs or performance issues in CPU mode, please do not report them, thank you~




PS: Welcome to leave bug reports and suggestions in the comments, and please rate up, thank you~

26.06.23 Update: Changed the patching method for hairstyles worker and the debug menu to Harmony injection; most alien races should now be supported as well.
26.06.30 Update: added renderQueue in debug menu, for transparent hat like PAH Pillbox Hat from Ponpeco Accessories. you need to change it to lower. like 1000.