Get Version 4 ! mcjHatsAreTheFashionOfTheDay : Fit Any Hair in Hats Pc/Mac

mCasualmCasual Posts: 4,601
edited February 2019 in Freebies

mcjhatsarethefashionoftheday is online
https://sites.google.com/site/mcasualsdazscripts9/mcjhatsarethefashionoftheday

version 4 adds 2 help buttons and a vew option that lets the hair float above the ears

with the help of the mcjCollider plugin

this script will pull a figure's hair above the hat-line onto the skull

a bit like wearing a bathing cap under the hat

New Genesis 3/8 compatible versions of mcjCollider are now online - PC 32bit PC 64bit and MAC 64bit 

https://sites.google.com/site/mcasualsdazscripts2/mcjcolliderds45

No But Really, You Should Get Version 2

Get version 2 because : version 1 if your hair prop was subdivided and you created the hat-fit morph 

the scene file could become un-openable !!! so you do want version 2

which makes sure to put the hair prop in non-subdivided state before computing the hat fit morph

then everybody ilives happily forever after

 

 

 

Post edited by mCasual on
«134

Comments

  • mCasualmCasual Posts: 4,601
    edited February 2019

    more images from the making-of

    january 6th i wrote the script for my needs: fitting the guard-of-the-castle hat to Teira the new recruit

     

    premierjourTheira.jpg
    682 x 1080 - 472K
    hatisinthefashion2.jpg
    618 x 1000 - 255K
    ABA.jpg
    1400 x 1080 - 673K
    Jessiesbeanie.jpg
    683 x 683 - 260K
    smallhottie4.jpg
    512 x 800 - 73K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,601

    oh en fait le script a commencé Janvier 1st

    Happy New Year 2019 ! by mCasual

  • 3dOutlaw3dOutlaw Posts: 2,470

    Woohoo!  This looks great, running off to download it now  :)  yes

  • mCasualmCasual Posts: 4,601
    edited February 2019

    hey padner

    yippee.jpg
    750 x 1125 - 128K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,601
    edited February 2019

    very low-poly hair test

    v6.jpg
    617 x 999 - 304K
    Post edited by mCasual on
  • Risk3DRisk3D Posts: 65

    Heya mCasual! Always love your scripts.

    I'm running into a little snag with this one. I've installed the files into the script folder and the script shows up in your section just fine, but I cant seem to find the "mcjCollider node" under the create window. Would it be in the bottom most of the drop down? I have a number of other creates like fluidos, lamh, etc there and wondering if there's a limit to how many will show up.

    Really hoping I can get this to work. It'd be perfect for combining my fave OOT hairs that often have wisps and different hats. :D

  • mCasualmCasual Posts: 4,601
    edited February 2019

    mcjCollider is a plug-in ( this was mentioned in the installation section )

    https://sites.google.com/site/mcasualsdazscripts2/mcjcolliderds45

    so you must download the mcjCollider for Mac 64-bit

    mcjCollider.dylib

    or the mcjCollider for PC 32-bit 

    mcjColliderDS45.dll 

    or the mcjCollider for PC 64-bit 

    mcjColliderDS45_64bit.dll

    then you must place that file in Daz Studio's plugins folder

    on a PC that's usually c:\Program Files\DAZ 3D\DAZStudio4\plugins

    on a mac that's usually Applications/ DAZ 3D/DazStudio4 64-bit/plugins

    once that's installed, next time you start Daz Studio it should be part of the Create menu

    in the case of the Hat script, you select the head of the figure before creating the collider node

    so the collider node will "see" the head facets and the script will use it to pull the hair onto the head

     

     

     

     

     

     

     

     

     

     

    Heya mCasual! Always love your scripts.

    I'm running into a little snag with this one. I've installed the files into the script folder and the script shows up in your section just fine, but I cant seem to find the "mcjCollider node" under the create window. Would it be in the bottom most of the drop down? I have a number of other creates like fluidos, lamh, etc there and wondering if there's a limit to how many will show up.

    Really hoping I can get this to work. It'd be perfect for combining my fave OOT hairs that often have wisps and different hats. :D

     

    Post edited by mCasual on
  • SixDsSixDs Posts: 2,384

    Absolutely outstanding! Thank you, sir.

  • Thank you, as always, Casual.

  • Sfariah DSfariah D Posts: 25,610

    Will this work with the boys?  I got a hooded DForce outfit for G8M and would like to use it with hair.  If this can work with any figure that would be cool!  I doubt it will work with Dog 8 though.  LOL 

  • RAMWolffRAMWolff Posts: 10,145

    Ah, it's out.  Thanks so much!  :-)

  • Risk3DRisk3D Posts: 65
    mCasual said:

    mcjCollider is a plug-in ( this was mentioned in the installation section )

    https://sites.google.com/site/mcasualsdazscripts2/mcjcolliderds45

    so you must download the mcjCollider for Mac 64-bit

    mcjCollider.dylib

    or the mcjCollider for PC 32-bit 

    mcjColliderDS45.dll 

    or the mcjCollider for PC 64-bit 

    mcjColliderDS45_64bit.dll

    then you must place that file in Daz Studio's plugins folder

    on a PC that's usually c:\Program Files\DAZ 3D\DAZStudio4\plugins

    on a mac that's usually Applications/ DAZ 3D/DazStudio4 64-bit/plugins

    once that's installed, next time you start Daz Studio it should be part of the Create menu

    in the case of the Hat script, you select the head of the figure before creating the collider node

    so the collider node will "see" the head facets and the script will use it to pull the hair onto the head

     

     

     

     

     

     

     

     

     

     

    Heya mCasual! Always love your scripts.

    I'm running into a little snag with this one. I've installed the files into the script folder and the script shows up in your section just fine, but I cant seem to find the "mcjCollider node" under the create window. Would it be in the bottom most of the drop down? I have a number of other creates like fluidos, lamh, etc there and wondering if there's a limit to how many will show up.

    Really hoping I can get this to work. It'd be perfect for combining my fave OOT hairs that often have wisps and different hats. :D

     

     

    mCasual said:

    mcjCollider is a plug-in ( this was mentioned in the installation section )

    https://sites.google.com/site/mcasualsdazscripts2/mcjcolliderds45

    so you must download the mcjCollider for Mac 64-bit

    mcjCollider.dylib

    or the mcjCollider for PC 32-bit 

    mcjColliderDS45.dll 

    or the mcjCollider for PC 64-bit 

    mcjColliderDS45_64bit.dll

    then you must place that file in Daz Studio's plugins folder

    on a PC that's usually c:\Program Files\DAZ 3D\DAZStudio4\plugins

    on a mac that's usually Applications/ DAZ 3D/DazStudio4 64-bit/plugins

    once that's installed, next time you start Daz Studio it should be part of the Create menu

    in the case of the Hat script, you select the head of the figure before creating the collider node

    so the collider node will "see" the head facets and the script will use it to pull the hair onto the head

     

     

     

     

     

     

     

     

     

     

    Heya mCasual! Always love your scripts.

    I'm running into a little snag with this one. I've installed the files into the script folder and the script shows up in your section just fine, but I cant seem to find the "mcjCollider node" under the create window. Would it be in the bottom most of the drop down? I have a number of other creates like fluidos, lamh, etc there and wondering if there's a limit to how many will show up.

    Really hoping I can get this to work. It'd be perfect for combining my fave OOT hairs that often have wisps and different hats. :D

     

    Ahh forgot to install collider, lol sorry instalation brain fart. :P Thanks again!

  • mCasualmCasual Posts: 4,601
    edited February 2019

    yes it will work with anything in fact even a sphere

    though it's actually the hair that gets fitted on the head, the hat is not really involved at all

     

    Will this work with the boys?  I got a hooded DForce outfit for G8M and would like to use it with hair.  If this can work with any figure that would be cool!  I doubt it will work with Dog 8 though.  LOL 

     

    mcjLa pistolera del amor.jpg
    1080 x 1644 - 620K
    Post edited by mCasual on
  • Your scripts are the bomb!!!! Thank you very much

  • mCasualmCasual Posts: 4,601
    edited February 2019

    New Genesis 3/8 compatible versions of mcjCollider are now online - PC 32bit PC 64bit and MAC 64bit 

    https://sites.google.com/site/mcasualsdazscripts2/mcjcolliderds45

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,601
    edited February 2019

    possible? fitting any hair under that beanie? 

    Yes But you have to work on it

    my new script and plugin to do this

    https://sites.google.com/site/mcasualsdazscripts9/mcjhatsarethefashionoftheday

    which is now compatible with Genesis 3 and Genesis 8 ( if you get the yesterday's version of the mcjCollider plugin )

    in the case of the razorcut hair for Genesis 3, it didnt work 100%, i had to scale up the beanie a bit

    it may be due to the fit function or to other morphs in the wig

    ( so if it's critical you could simply export the hair as an obj, then re-import it, so it becomes a prop and the hat-fit morph will be the unique morph )

     

    yaess.jpg
    1080 x 1080 - 479K
    Post edited by Chohole on
  • barbultbarbult Posts: 23,050
    edited February 2019

    Oh, WOW! This is great! I donated with your donations link on your website.

    I took a scene that I recently completed and added a hat I recently purchased. The character is G8F and the hair is Bang Bob Hair with dForce. After the hair was simulated, I froze the simulation and used this script to morph the hair to fit under the hat. For comparison, the scene without the hat is in my gallery.

     

    Dailia Granny Nightgown Tassel Brown Bang Bob TXPA Hat.jpg
    1600 x 2000 - 2M
    Post edited by barbult on
  • barbultbarbult Posts: 23,050
    edited February 2019

    Uh oh! A trouble! The scene I cannot reopen the scene I saved with the the collider and hair under the hat. It crashes Daz Studio when opening the scene. crying

    DAZStudio.exe caused ACCESS_VIOLATION in module "C:\Program Files\DAZ 3D\DAZStudio4 Public Build\dzcore.dll" at 0033:0000000055A8C4C7, DzMorphDeltas::clearVertCount()+391 byte(s)

    Post edited by barbult on
  • mCasualmCasual Posts: 4,601
    edited February 2019
    barbult said:

    Uh oh! A trouble! The scene I cannot reopen the scene I saved with the the collider and hair under the hat. It crashes Daz Studio when opening the scene. crying

     

    i will see if it's related to the plugin maybe it's better to delete the collider node after use but maybe i'll have to modify the collider plugin note that anyway a collider is not reusable after you close the scene because it forgets what it was attached to.

    i tried 2 times to close and open a file wilt a collider, didnt crash,, i think it's not the collider plugin's fault

    the error message you got seems to indicate the Morph channel which was created by the mcjhatsarethefashionoftheday script got into a fight with Daz Studio's scene initializer

    maybe if the hair prop was subdivided there was a wrong vertex count in the morph

    -------

    sometimes, instead of opening a scene file, you can file/merge it with an opened file ... this may let you recover your scene

    if it's really critical, you could go in the daz studio data/ folder, locate the files associated to the morph name and delete them

    that way when you open the file the morph wont be found and maybe the scene loader will go "oh well" and load the scene anyway

    --------

    maybe there's an interaction with the dForce things, all my tests so far were done with hair figures and props

    --------

     

     

    Post edited by mCasual on
  • barbultbarbult Posts: 23,050
    mCasual said:
    barbult said:

    Uh oh! A trouble! The scene I cannot reopen the scene I saved with the the collider and hair under the hat. It crashes Daz Studio when opening the scene. crying

     

    i will see if it's related to the plugin maybe it's better to delete the collider node after use but maybe i'll have to modify the collider plugin note that anyway a collider is not reusable after you close the scene because it forgets what it was attached to.

    i tried 2 times to close and open a file wilt a collider, didnt crash,, i think it's not the collider plugin's fault

    the error message you got seems to indicate the Morph channel which was created by the mcjhatsarethefashionoftheday script got into a fight with Daz Studio's scene initializer

    maybe if the hair prop was subdivided there was a wrong vertex count in the morph

    -------

    sometimes, instead of opening a scene file, you can file/merge it with an opened file ... this may let you recover your scene

    if it's really critical, you could go in the daz studio data/ folder, locate the files associated to the morph name and delete them

    that way when you open the file the morph wont be found and maybe the scene loader will go "oh well" and load the scene anyway

    --------

    maybe there's an interaction with the dForce things, all my tests so far were done with hair figures and props

    --------

    Merge didn't work. I got the same access violation. Where does the script store the data files for the morph? (I didn't save the morph as a morph asset, so I figured the morph was saved internal to the scene.) The hair itself was installed with Daz Connect. Hopefully the script is not trying to write anything into the "cloud" folder. Anything a user writes into that folder is not later recognized by Daz Studio. Users have to save morphs and other assets into a non-cloud content library.

  • barbultbarbult Posts: 23,050

    I have another problem that maybe you can help with:
    I tried a hat that fits much tighter to the head (Georgette Hat). I tried a normal hair figure (not dForce) Fashion Bob Hair. No matter what value I set the Air Gap to, the hair sticks out away from the head by the same amount. It always sticks through the hat on top, front, and in the back. I tried the recommended value of 2, I tried a negative value, and I tried 0.01. They all turned out the same. In the attached screenshots, I hid all the hair except the scalp for ease of viewing. (All hair was visible when running the script, though). The scalp is blue with low opacity. Genesis 8 is dark red. The hat is gray. You can see the location of the plane, the head and the hair scalp. Why is the scalp so far from the head, when I selected 0.01 for the air gap? I wonder if I am doing something wrong. Maybe I don't understand what the "air gap" is. Can you replicate this issue? Thanks for your assistance. 

     

    Fashion Bob scalp way above head.png
    2583 x 1938 - 529K
    Fashion Bob scalp outside of hat.png
    2583 x 1940 - 652K
  • mCasualmCasual Posts: 4,601
    the morphs are added directly to the figure, so when you save the scene, it's daz studio itself that saves the morph in the data folder. not sure why it poses a problem in you case, i suspect it has to do with dforce or subdivision surfaces or daz's whats it called 3-axis morphs. my script adds old-school Poser morphs
  • mCasualmCasual Posts: 4,601
    ok i'll do more tests maybe see if the subdivision resolution of the figure has an effect but there's other factors related to the way the plane, the head and the hair are rotated, scaled and morphed, it's a bit complicated for me to get a firm grasp of all the factors at play. the simplest case is if you have the hair as an obj file, parented to the head when the head is zero-posed.
  • mCasualmCasual Posts: 4,601
    i located the problem !around line 209
    dir.x *= off;
    dir.x *= off;
    dir.x *= off;
    
    

    needs to be

    dir.x *= off;
    dir.y *= off;
    dir.z *= off;
    

    because of this your hair was probably well fittez laterally, but was 1 cm for the Y and Z axis 

    i will post an update in a few minutes

     

    barbult said:

    I have another problem that maybe you can help with:
    I tried a hat that fits much tighter to the head (Georgette Hat). I tried a normal hair figure (not dForce) Fashion Bob Hair. No matter what value I set the Air Gap to, the hair sticks out away from the head by the same amount. It always sticks through the hat on top, front, and in the back. I tried the recommended value of 2, I tried a negative value, and I tried 0.01. They all turned out the same. In the attached screenshots, I hid all the hair except the scalp for ease of viewing. (All hair was visible when running the script, though). The scalp is blue with low opacity. Genesis 8 is dark red. The hat is gray. You can see the location of the plane, the head and the hair scalp. Why is the scalp so far from the head, when I selected 0.01 for the air gap? I wonder if I am doing something wrong. Maybe I don't understand what the "air gap" is. Can you replicate this issue? Thanks for your assistance. 

     

     

  • barbultbarbult Posts: 23,050
    mCasual said:
    the morphs are added directly to the figure, so when you save the scene, it's daz studio itself that saves the morph in the data folder. not sure why it poses a problem in you case, i suspect it has to do with dforce or subdivision surfaces or daz's whats it called 3-axis morphs. my script adds old-school Poser morphs

    I don't think Daz Studio is saving the mcjFitHat morph in the data directory when I save a scene. In the scene file, I see the mcjFitHat section with all of its deltas listed. I searched my data directory an there are no mcjFitHat files. To save the morph in the data folder, it has to be saved as a Morph Asset.

    I did another experiment with a hair figure with subD. After saving the file and trying to reload it, I got the same access violation. So, I think you are probably right about subD causing a potential problem. The same hair with base resolution worked fine.

    The dForce hair that I had the original access violation on also used subD.

    Thanks for your help figuring out the problem.

  • mCasualmCasual Posts: 4,601
    edited February 2019

    in the next version since the script has the hair selected

    i'll force the subdivided hair figures/hair in base resolution

    and maybe put them back in the user's resolution when i'm done

     

    barbult said:
    mCasual said:
     

    I did another experiment with a hair figure with subD. After saving the file and trying to reload it, I got the same access violation. So, I think you are probably right about subD causing a potential problem. The same hair with base resolution worked fine.

     

     

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,601
    edited February 2019

     next version with functioning air-gap 0.5mm

     

    barbult said:
    mCasual said:
     
    airgap.jpg
    343 x 555 - 140K
    Post edited by mCasual on
  • barbultbarbult Posts: 23,050
    edited February 2019

    I redid my scene that uses the dForce hair. I set resolution back to Base, ran the script, and set resolution back to High Resolution (subD). I saved the scene, closed DS and reopened DS. It opened fine. So, I believe your plan to force hair to base resolution, run the script and set it back to the user's resolution will work great.

    Edit: dForce hair doesn't seem to cause a problem. That is nice news.

    Post edited by barbult on
  • mCasualmCasual Posts: 4,601
    edited February 2019

    the next version will automatically set the resolution to base and the viewport resolution will be set to 0 

    then the script does it's millions of collision detections ( num vertices in the hair multiplied by num facets in the head )

    then it sets the resolution back to what it was

    	var oldLodLevel = 0;	var oldRez = 0;	var hairObj = hair.getObject();	var hairShp = hairObj.getCurrentShape();	var lodlevel = hairShp.findProperty( "lodlevel" );	var SubDIALevel = 0;	if( lodlevel )	{		oldLodLevel = lodlevel.getValue();		lodlevel.setValue( 0 ); //base		SubDIALevel = hairShp.findProperty( "SubDIALevel" );		oldRez = SubDIALevel.getValue();		SubDIALevel.setValue( 0 );	}

    .

    .

    .

    	if( lodlevel )	{		lodlevel.setValue( oldLodLevel ); 	}	if( SubDIALevel )	{		SubDIALevel.setValue( oldRez );	}
    barbult said:

    I redid my scene that uses the dForce hair. I set resolution back to Base, ran the script, and set resolution back to High Resolution (subD). I saved the scene, closed DS and reopened DS. It opened fine. So, I believe your plan to force hair to base resolution, run the script and set it back to the user's resolution will work great.

    Edit: dForce hair doesn't seem to cause a problem. That is nice news.

     

    Post edited by mCasual on
Sign In or Register to comment.