Jump to content

Hi There

Welcome to Klub Exile. If you happened to make your way to the site either from Lovers Lab or a Search on Google, we are glad you found us.  To unlock the entire site you will need to have a account registered.  Don't worry it is free but in the mean time you can read up on why we made the site and other little tidbits.  Feel free to join or Discord Server also if you have any more questions.  Thanks for stopping by and See You on the other side.

admin admin
Creating a Blog? Don't Forget the Feature Photo!! ×

Hairworks masterclass


vi363R

837 views

I'm planning to work out the real deal with Hairworks. It is nice creating them in Blender, but the part where the data needed to be pasted in the apx file has always intrigued me and left me wondering there was more to it and I'd like to be in control of the collisions and anything else there may be to control.

So here I am, installing 3DS Max with hairworks plugin 121 and a whole lot to learn 😉

  • Like 3
  • Thumbs Up 6

28 Comments


Recommended Comments



  • Administrator

I have done it before.  I will say this...you have way more control of styling in 3DS Max compared to Blender.  I just could not figure out how to export it correctly so I gave up.  Good luck.

  • Thanks 1
  • Agree 1
Link to comment
6 hours ago, HDiddy said:

I have done it before.  I will say this...you have way more control of styling in 3DS Max compared to Blender.  I just could not figure out how to export it correctly so I gave up.  Good luck.

Thanks, my first impression yesterday is similar, I had a first test hair ready in no time, which was surprisingly easy. Getting it to show up in the game however seems to be the tricky part indeed.

It looks like a new period full of trial and error lies ahead. Luckily nowadays there’s AI to the rescue, although it still remains to be seen how much it has been trained in that discipline… 

In case you should still have any details about what you tried already, that would perhaps be helpful and save me some trials.

Worst case I’d try to use it to modify the collision boundaries only…

Link to comment

I've posted the details on how to do the collisions already in the past, and there should be easy to write a script to create both obj files and invoke the apx converter for you.

I had this in my plans to do, but I stopped working on it.

I'm switching to Unreal so don't really know if I should invest time in Hairworks, the main difference between usual workflow from blender/alembic/groom system and Nvidia hairworks is that the hairworks is a bit more constraining, because it forces you to grow your hairs from vertices locations while everyone else would like to grow it distributing across the faces of the mesh, not just from the vertices location.

There are some plugins for Blender that allows you to port probably 95% of daz hairs, but so far didn't decided how to "snap" the growth positions to the vertices required by hairworks. However I've implemented some code to re-approximate curves, so you could go from 9 segments to 15 segments or from 99 segments to 15 segments or whatever number to whatever number.

Unfortunately, I procrastinate a lot, so like I've said there is no code to do the auto-matching from surface to the vertex location. I was looking to port that library with 500+ hairs, but left those for better days. I'm still sad/upset myself on this. 🙂
 

Link to comment
20 hours ago, HDiddy said:

I have done it before.  I will say this...you have way more control of styling in 3DS Max compared to Blender.  I just could not figure out how to export it correctly so I gave up.  Good luck.

Did you ever succeed to get anything showing up in the game from Max? this is where I am now after several attempts. this is with an edited version of female body dae, left armature intact because the bones are required in Max, only edited the mesh (basically only left the scalp)

then resized x100 but that seems to be too much because in pass I had to resize to 0.4..

and other issues still remaing (why the hair goes through the ceiling is still a big question to me)

2023-11-30 23_44_10-The Klub 17.jpg

Link to comment

almost there!!

already found out a lot

now i need to solve the scaling and orientation issue

image.jpeg

  • Thumbs Up 2
Link to comment

the hair is on the model! Making progress here, finally, just at the point where i was about to take a break from it. After 2 long evenings of trial and error, generated dozens of test files, blend, dae and max, finally found a combination of armature and mesh that works. still a few rotations are required to get it right, but that's only a minor thingy and an easy one-time adjustment in pass file, perhaps i'll look some more after that, has to do with rotation of the axis in blender, or during export to dae, or export to apx who knows. the 72 degree rotation is what keeps me wondering, maybe because of the rotation of the head bone in the armature.. anyway

scale is right (x40) which allows all values in pass to be default (0 for offset and 1 for scale) and that's most important to me at the moment.

in the current phase, the exported apx can go straight into the activmod folder, doesn't need any modification. rotations are saved in pass. didn't have to adjust any setting to hairworks in max btw.

looks like i'm going to spend some time now on making a more detailed scalp mesh and then it's ready for some real styling!

2023-12-02 15_09_00-The Klub 17.jpg

2023-12-02 15_20_54-Greenshot.jpg

2023-12-02 14_31_51-Greenshot.jpg

  • Like 1
Link to comment

and an improved growthmesh. with this one I'll start experimenting with collisions in 3ds max hairworks and then some styling with longer hairs... fingers crossed!

2023-12-02 16_40_58-Blender_ [C__Users_wimdm_Downloads_hairworks_grow limited vertex groups arm x40 .png2023-12-02 16_41_21-Settings.png

  • Like 2
  • Thumbs Up 1
Link to comment
On 11/30/2023 at 3:45 AM, HDiddy said:

I have done it before.  I will say this...you have way more control of styling in 3DS Max compared to Blender.  I just could not figure out how to export it correctly so I gave up.  Good luck.

YES working hair collisions!!!

OMG I had to re-parent armature bones, rename bones, vertex groups.. what a ride. but I think I'm almost there. LOL

if I am, I will make a tutorial about it - this is soo cool

screenshot_23_12_04 14_24_51.jpg

  • Like 3
  • Thumbs Up 1
Link to comment

It seems the split between left and right really needs to be there, to prevent wrong interpolations. without the split, the only wat to get the hair in the right shape is by increasing the clumping scale but that has disadvantages too.

2023-12-05 21_40_28-new orientation trial with body and split.max - Autodesk 3ds Max  2014 x64.png

screenshot_23_12_05 20_59_18.jpg

screenshot_23_12_05 21_54_06.jpg

  • Love It 2
  • Thumbs Up 2
Link to comment

You always need to split/cut the mesh where you want the hair to take a new direction otherwise it will just interpolate.

  • Thanks 1
Link to comment
1 hour ago, hfg2 said:

You always need to split/cut the mesh where you want the hair to take a new direction otherwise it will just interpolate.

Yes I was about to experiment with splitting the mesh in blender instead of creating a visual gap, and see what the result is, if it makes any difference at all. Unfortunately that will have to wait a little, thanks.

 

Link to comment

Not sure if it works, but if for some reason you don't want to split/cut the mesh (I do have a ton of personal reasons not to do so) then you can try to Edit -> Edge -> Mark Sharp, then stack an Edge Split modifier (check only Sharp Edges) on the growth mesh and see if it helps.

  • Thanks 1
Link to comment
On 11/30/2023 at 2:45 AM, HDiddy said:

I have done it before.  I will say this...you have way more control of styling in 3DS Max compared to Blender.  I just could not figure out how to export it correctly so I gave up.  Good luck.

On 12/4/2023 at 1:28 PM, vi363R said:

YES working hair collisions!!!

OMG I had to re-parent armature bones, rename bones, vertex groups.. what a ride. but I think I'm almost there. LOL

if I am, I will make a tutorial about it - this is soo cool

Our in-house master hairdresser is onto something. Brilliant. Super exiting stuff!

I'm also MAX user so I'm super happy you've managed to crack it. I've tried to do it in Blender but I just HATE its interface. I guess I'm too used to MAX's.

Defo make the tutorial. Maybe I could become a hairdresser too

  • Thumbs Up 1
Link to comment

the last issue i'm still trying to solve it that the orientation of the individual bones seems to differ. as a result, the hair needs to be rotated around 28 degrees. this seems to correspond with the orientation of the head02 bone. so next thing iI'm going to try is to rotate all the individual bones in blender, and then import in 3ds max and see if it makes any difference.

this orientation also seems to matter for the collision spheres.. I noticed that if I apply any offset in the collision spheres from the original location, that they are shifted on another axis in the game.. which is kind of annoying to finetune them.

Link to comment

Yeah the hair sucks - that's no what this picture is about. I finally understand how the orientation of the collision spheres is set! OMG

So..  i had to start all over again, new armature, different bone orientations, but good news:

  • no more rotation required in pass files. everything now lines up nicely without any adjustments
  • i was able to fix an issue where some orientations where different in 3ds max and game, turns out every single bone can be rotated with a 'roll angle' in blender. eg right shoulder had a roll angle of 90 and I changed it to -90, basically inverting the offset i'd give in 3ds max. now when I lower the right shoulder collision sphere in 3ds max, it is actually really going down in the game (before it was going all over the place)

so that's good

with that knowledge I'm going to call it a day - need to sleep. to be continued.. pieces of the puzzle are falling into place, thing I'm almost there now..

2023-12-13 23_52_58-Greenshot.jpg

Link to comment

After two long evenings I’ve found a workable orientation for 7 out of the 10 bones so far.. that’s 30% to go.. really hard times with a lot of trial and error, but gone too far now to let it go 😉 it’s the last hurdle to overcome for getting the most out of hairworks.

  • Thumbs Up 1
Link to comment
On 12/15/2023 at 9:53 AM, vi363R said:

After two long evenings I’ve found a workable orientation for 7 out of the 10 bones so far.. that’s 30% to go.. really hard times with a lot of trial and error, but gone too far now to let it go 😉 it’s the last hurdle to overcome for getting the most out of hairworks.

update: 10/10 bone orientations are workable in XYZ, actually they are good to go now, but still looking for a few degrees offset for the breasts and shoulders... damn man would be nice of shoulder bone could be used to extend for upper arm collisions.

Link to comment

In hairworks you can make your spheres as big as you want and connect the cylinders the way you want, so I doubt there is a situation where you can't block the hair.

Link to comment
21 minutes ago, hfg2 said:

In hairworks you can make your spheres as big as you want and connect the cylinders the way you want, so I doubt there is a situation where you can't block the hair.

Yeah I’m struggling with the orientation of the bones.

there seems to be a difference between blender, max and the game in orientation and I’m having trouble lining everything up.

At this time I have control over the spheres in xyz direction where the visual situations in max correspond with the game. Now struggling to get the upper arms working. Orientation of the shoulder bone seems to be different than i thought, or the locations.. all very weird. Now I’m not sure what armature to use, the one properly imported from female dae, with the bones properly connected, just the bone locations with custom orientation.. so confused 🙂

Or the armature with the bones inverted to use the other end of the bone

 

23 minutes ago, hfg2 said:

In hairworks you can make your spheres as big as you want and connect the cylinders the way you want, so I doubt there is a situation where you can't block the hair.

Do you have any experience with the bone orientation for hairworks?

apart from the upper arms, everything is under control and working, but I get the feeling that I’m doing things not the easiest way

Link to comment

Sorry, can't remember much, but try to get one bone working first, then the other could be flipped. Flipped means pointing to the inside (towards the body/spine) actually.

If you need to visualize the bones in the game (those are actually corrected by me, just saying) you can try this.

000.Custom.Body.P001.B001.StockBody-injector.zip

Should get something like in the bottom image hopefully.

nullSorry, not much experience with hairworks as I'm already transitioning away from this to other hair systems. Blender uses the concept of bones, where you have a head and a tail, but in other game engines there are only joints instead of bones, and each joint has only the orientation. In Blender you will always have the bone length axis defined as the Y axis of the bone, like its local Y coordinate is along the bone length, while the other main coordinate, which is used in IK orientation is defined by the X local axis. Sorry, but dont know which one is supposed to be the primary one, lol. The idea is that in different systems this could be totally messed up, because of this.

Dont know in Max, but in Blender you have Y forward and Z up, while the game is -Z forward and Y up. For me this can be converted using something like (just an example, my from forward is -Y in this example, so don't copy paste blindly):

	p = axis_conversion(
			from_forward='-Y',
			from_up='Z',
			to_forward='Z',
			to_up='Y'
			).to_4x4()

 

image.png

  • Like 1
  • Love It 1
Link to comment
1 hour ago, hfg2 said:

Sorry, can't remember much, but try to get one bone working first, then the other could be flipped. Flipped means pointing to the inside (towards the body/spine) actually.

If you need to visualize the bones in the game (those are actually corrected by me, just saying) you can try this.

000.Custom.Body.P001.B001.StockBody-injector.zip 81.13 kB · 0 downloads

Should get something like in the bottom image hopefully.

nullSorry, not much experience with hairworks as I'm already transitioning away from this to other hair systems. Blender uses the concept of bones, where you have a head and a tail, but in other game engines there are only joints instead of bones, and each joint has only the orientation. In Blender you will always have the bone length axis defined as the Y axis of the bone, like its local Y coordinate is along the bone length, while the other main coordinate, which is used in IK orientation is defined by the X local axis. Sorry, but dont know which one is supposed to be the primary one, lol. The idea is that in different systems this could be totally messed up, because of this.

Dont know in Max, but in Blender you have Y forward and Z up, while the game is -Z forward and Y up. For me this can be converted using something like (just an example, my from forward is -Y in this example, so don't copy paste blindly):

	p = axis_conversion(
			from_forward='-Y',
			from_up='Z',
			to_forward='Z',
			to_up='Y'
			).to_4x4()

 

image.png

Thanks for the support, I really appreciate it. Gonna have a look into that mod to show the bones. Have been wishing for something like this. With F2 in H5 also something is visible of the armature but not as detailed.

in the meanwhile I’ve written a Python script to inverse bones (tail - head) in the armature and tried again in max. Now the spheres end up in the other end of the bone, meaning that clavicle is on the shoulder and shoulder on the elbow, like it is supposed to be I think... then they can be connected easily. Now hoping to fine tune the offset orientation…

another step forward.. every time I think I m almost there, a new problem shows up. Guess it will end one day 🙂

anyway, many thanks for the support, I needed it 😉

  • Thumbs Up 1
Link to comment

This is the code that marked as flipped some of the bones: (https://github.com/search?q=repo%3AModdingClass%2FTK17-Custom-Bodies-plugin+isFlipped&type=code)

	lowerBodyList = [ "hip_R_joint", "vagina_L_joint01", "clavicle_L_joint"]
	breastFixList = ["breast_L_joint", "breast_scale_L_joint", "nipple_L_joint01", "nipple_L_jointEnd", "breast_deform01_R_joint01","breast_deform02_R_joint01", "breast_deform03_R_joint01","breast_deform01_R_jointEnd","breast_deform02_R_jointEnd","breast_deform03_R_jointEnd"]
	lipsFixList = ["upper_lip_R_joint01","upper_lip_R_joint02","upper_lip_R_joint03","upper_lip_R_jointEnd", "lower_lip_R_joint01","lower_lip_R_joint02","lower_lip_R_joint03","lower_lip_R_jointEnd"]
	headFixList = ["cheek_R_joint01", "cheek_R_jointEnd","ear_R_joint01", "ear_R_jointEnd", "forehead_joint01","forehead_jointEnd", "nose_joint01", "nose_joint01","nose_joint02","nose_jointEnd"]
	eyeFixList =["eye_socket_R_joint", "eye_brow_R_joint01","eye_brow_R_joint02", "eye_brow_R_jointEnd", "eye_R_joint"]
	specialCaseList = ["rib_R_jointEnd", "butt_R_jointEnd"]
	fixList = lowerBodyList + breastFixList +lipsFixList + eyeFixList + headFixList +specialCaseList
	empty["isFlipped"] = False
	if name in fixList or hip_R_joint_child or vagina_L_joint01_child or clavicle_L_joint_child : 
		empty["isFlipped"] = True

So in practice for me the left arm joints are flipped. 🙂

So focusing on the right arm should give you proper joints orientation from start, easier to work on that first, not taking into account flipping that must be applied on the other side.

Link to comment
20 hours ago, hfg2 said:

Sorry, can't remember much, but try to get one bone working first, then the other could be flipped. Flipped means pointing to the inside (towards the body/spine) actually.

If you need to visualize the bones in the game (those are actually corrected by me, just saying) you can try this.

000.Custom.Body.P001.B001.StockBody-injector.zip 81.13 kB · 2 downloads

Should get something like in the bottom image hopefully.

nullSorry, not much experience with hairworks as I'm already transitioning away from this to other hair systems. Blender uses the concept of bones, where you have a head and a tail, but in other game engines there are only joints instead of bones, and each joint has only the orientation. In Blender you will always have the bone length axis defined as the Y axis of the bone, like its local Y coordinate is along the bone length, while the other main coordinate, which is used in IK orientation is defined by the X local axis. Sorry, but dont know which one is supposed to be the primary one, lol. The idea is that in different systems this could be totally messed up, because of this.

Dont know in Max, but in Blender you have Y forward and Z up, while the game is -Z forward and Y up. For me this can be converted using something like (just an example, my from forward is -Y in this example, so don't copy paste blindly):

	p = axis_conversion(
			from_forward='-Y',
			from_up='Z',
			to_forward='Z',
			to_up='Y'
			).to_4x4()

 

image.png

Hi,

I see the red indicators, but only on my male model and only from one side, and no green and blue. female is xbody. does this only work for default body?

the blue ones are Y-axis?

which one is green and red? 😉

are there options to choose what is visible? at the moment only half of the red ones are visible, depending on the direction i'm looking, others appear and the first disappear..

plenty questions 😉

 

 

Link to comment

×
×
  • Create New...

Important Information

WARNING! Adult Only Content You must be 18 years of age or older to enter. By accepting you agree to Klub Exile's Terms of Use and Guidelines upon creating an account.