Jump to content

General Advise for adding physics to clothing or hair


Recommended Posts

Posted

This is something I've never done before and don't know where too start. I do not know what tools I need. I want to try adding some simple physics to things like hair, skirts, and maybe some equippable static wings swing side to side or something.

 

I intend to keep it as basic as possible to start with. Nothing fancy. And it is entirely possible this is something well beyond me. But, if anyone has any advice on the topic I am all ears.

 

 

I do not have any specific files in mind I intend to do this with yet. No current projects or anything that I'm specifically trying to fix. Just want to look into the topic and guage if its something within my current skill level or something I'm not ready for.

Posted
10 hours ago, Aki K said:

I do not know what tools I need.

 

Outfit studio for building the skeleton inside the nif and skinning the mesh to said skeleton.

Notepad++ or something like it to create / edit the xml which tells your skeleton how to behave.

 

Easiest to do are things like necklaces / earrings, basically 2 bones and no mesh deformation.

Hair is kinda medium, longer bone chains and deformation that requires smooth transition between each bone.

Skirts are a pain in the back. 

 

 

Posted
On 11/16/2025 at 8:51 PM, Vader666 said:

 

Outfit studio for building the skeleton inside the nif and skinning the mesh to said skeleton.

Notepad++ or something like it to create / edit the xml which tells your skeleton how to behave.

 

Easiest to do are things like necklaces / earrings, basically 2 bones and no mesh deformation.

Hair is kinda medium, longer bone chains and deformation that requires smooth transition between each bone.

Skirts are a pain in the back. 

 

 

But it can be done with just outfit studio and a notepad? Interesting. Any very basic examples/instructions you can offer?

Posted
13 hours ago, Aki K said:

But it can be done with just outfit studio and a notepad?

 

Yes.

Most certainly there is other software out there capable of making the whole process a little more convinient, espaically working around in the .XML, but those are perferctly sufficent.

 

13 hours ago, Aki K said:

Any very basic examples/instructions you can offer?

 

You take the .nif you want to add SMP to and load it into OS.

Add a custom bone that is parented to one of the vanilla skeleton bones, if you want to make jiggling parts on a necklace, the parent most likely needs noch be the Neck or one of the Spine bones.

This custom bone is going to be static and will not be affected by physics, these are sometimes refered to as anchor bones, it is merely there for creating an offset and as an attachment point for your physics affected bone.

Add another custom bone which is parented to the custom bone you just created, this one will be driven by physics.

Skin the parts / pieces you want to jiggle to your 2nd custom bone, if it is a solid part skin the entire part with 100% weight to,ideally, a single bone, if you're doing hair or cloth you need to skin it with smoth transition between multiple bones so you wont get hard edges or kinks / weird deformations.

Export your .nif

 

Create an XML which tells your bone(s) how to behave :

 

Spoiler
<?xml version="1.0" encoding="UTF-8"?>
<system xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="description.xsd">

<!-- bones -->
 <!-- static -->

	<bone name="NPC Spine2 [Spn2]"/>

	<bone name="SMP_Necklace_00"/>
	
 <!-- dynamic -->
	<bone-default>
		<mass>1</mass>
		<inertia x="15" y="15" z="15"/>
		<centerOfMassTransform>
			<basis x="0" y="0" z="0" w="1"/>
			<origin x="0" y="0" z="0"/>
		</centerOfMassTransform>
		<linearDamping>0.95</linearDamping>
		<angularDamping>0.80</angularDamping>
		<friction>0.0</friction>
		<rollingFriction>0.8</rollingFriction>
		<restitution>0</restitution>
		<gravity-factor>1</gravity-factor>
	</bone-default>
	
	<bone name="SMP_Necklace_01"/>
			
<!-- constraints -->
	<generic-constraint-default>
		<frameInB>
			<basis x="0" y="0" z="0" w="0"/>
			<origin x="0" y="0" z="0"/>
		</frameInB>
		<useLinearReferenceFrameA>false</useLinearReferenceFrameA>
		<linearLowerLimit x="-0" y="0" z="-0" />
		<linearUpperLimit x="0" y="0" z="0" />
		<angularLowerLimit x="-0.2" y="-1.0" z="-0.5" />
		<angularUpperLimit x="1.0" y="1.0" z="0.5" />
		<linearStiffness x="0" y="0" z="0"/>
		<angularStiffness x="0.3" y="0.3" z="0.3"/>
		<linearEquilibrium x="0" y="0" z="0"/>
		<angularEquilibrium x="0" y="0" z="0"/>
	</generic-constraint-default>
	
	<generic-constraint bodyA="SMP_Necklace_01" bodyB="SMP_Necklace_00"/>
		
<!-- colliders -->
 <!-- static -->

 <!-- dynamic -->

</system>

 

 

Under "static" define your static bones, basically telling SMP which bones it should leave alone entirely,

 

Under "dynamic" you define the property(s) of and your dynamic (physic affected) bone(s).

Even though its counter intuitive, define the propertys, then the bone(s) that should have them.

If you need a longer bonechain to have different propertys along the chain you can just define the new propertys, then the bones that should use these new propertys instead of any previous ones.

 

The contraints are telling your bone(s) what NOT to do or where the limits are.

 

The last generic constraint is the most important one, it "physically attaches" your dynamic bone to your static bone.

In a longer bonechain every bone needs to to be attached to its parent this way.

If you experience stuff falling through the ground or infinite streching of your mesh in the game, this is the part where you fucked up.

 

Colliders are meshes your physics stuff can collide with and cause a change of motion, those meshes should always be rather simple (low poly) ones as caulation of these is somewhat taxing. So don't use the entire rendered version of the 3ba body in here.

 

Finally, attach the .XML to your nif by adding a NiStringExtraData block to the root of the .nif, name it "HDT Skinned Mesh Physics Object" and put the file path to your .XML as the "String data".

This can be done in OS before exporting or in Nifscope after exporting your .nif, whatever you find more convinient.

 

Attached is the Necklace .nif the .XML above belongs to.

In addtion >this< is the outfit the necklace was made for, the skirt of that outfit also has SMP to it but is a little more complex. 

 

Necklace_0.rar

Posted

I appreciate all the assistance. Sadly, my computer GPU seems to have died. So it'll probably be a long time before I can give this a try. Looks like i'm doing a fresh install on a different computer.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...