My Hair Shader



  • I've taken some of @bagginsbill's and @ghostship's superfly hair shaders and blended one of my own. I stole the secondary highlight portion from @bagginsbill and the rest from @ghostship but with my own spin on things. I intend to make it available as a plugin for EZSkin3 as it requires trans maps from the hair shaders that come with the models, which as we all know can be quite a chore to insert. I haven't decided what params need exposing so for now I have just got the ability to select the colour and bump maps. (Whilst testing I used @vilters method of combining all the different mat zones in to one which made it easier for testing.

    Here's the spaghetti
    0_1549223746732_5756460a-9594-4864-a0df-a3b96dbbf9b3-image.png

    and this is how it renders
    Blonde
    0_1549223773893_APTest1.png
    Brunette
    0_1549223638195_APTest2.png



  • I dunno what any of that glibberdy goop means in the first pic but thank you for making a hair shader for EZSkin. The more one click-y solutions for this type of thing, the happier I am. :P



  • @amethystpendant I wondered where the 1.45 IOR had come from, since that reminded me of glass, so I did a quick search and came up with this Light Scattering from Human Hair Fibers scholarly article. The table at the top of page 8 lists 1.55 as a nominal IOR for hair fibres.

    Being reasonably familiar with @bagginsbill 's hair shader, I presume that hair with horizontal UV fibres would need some adjustment of the Anisotropic rotations. I have quite a few prop hair models that have all sorts of fibre directions (e.g. skullcaps & scalps) that required some real fruitloopery to generate appropriate anisotropic rotations. Probably way beyond the scope of what you're looking for ;-)



  • @anomalaus said in My Hair Shader:

    @amethystpendant I wondered where the 1.45 IOR had come from, since that reminded me of glass, so I did a quick search and came up with this Light Scattering from Human Hair Fibers scholarly article. The table at the top of page 8 lists 1.55 as a nominal IOR for hair fibres.

    Being reasonably familiar with @bagginsbill 's hair shader, I presume that hair with horizontal UV fibres would need some adjustment of the Anisotropic rotations. I have quite a few prop hair models that have all sorts of fibre directions (e.g. skullcaps & scalps) that required some real fruitloopery to generate appropriate anisotropic rotations. Probably way beyond the scope of what you're looking for ;-)

    Thanks @anomalaus, yes the 1.45 was simply a placeholder until someone corrected me.

    Yes, I will have to swap the normals movement for a horizontal hair map, for @ghostship's shader I had a vertical and horizontal material definition, but for that I merely swapped the mapping from UV to VU as it was designed to use a single map for colour and bump, this will be more complex. As to scope, I want to try to get a decent shader that performs reasonably well, I love @bagginsbill's shader but it does slow the renders down quite considerably. My ultimate goal would be to be able to apply a decent mat to some of the more esotericly mapped models like Eternal Kyra which refused to be wrangled with @bagginsbill's shader.



  • Okay, I think my hair shader plugin for EZSkin3 is ready for testing Plugin

    The shader creates this shader
    0_1549813891774_Spag.PNG

    Because of the variety of options I've broken them down into 3 areas
    Maps
    0_1549813929003_Maps.PNG
    Diffuse / Translucence
    0_1549813949485_Diffuse.PNG
    Specular
    0_1549813976687_Specular.PNG

    Most of the options are obvious but its probably worth mentioning
    Diffuse
    Translucence Component: This determines how much light is subject to passing through rather than diffusing 0 = No translucence 1 = no Diffuse
    Specular
    Shifted refers to the secondary spec, which is shifted according to Anisotropic Shift param < 0.5 towards the root, > 0.5 towards the tip.
    Anisotropic Mix: ratio of Secondary To Primary 0 = All secondary 1 = All Primary Default 0.5

    One point about the maps, if no map is set the one on the firefly root is used, on re-opening it looks like the maps have gone, but if you hit reset they re-appear

    Hope someone finds it useful



  • One thing I would ask, should the modified normal used to shift the secondary reflections be merged with the normals coming out of the bump map?

    Here are a few comparison renders

    This is OOT Luisa hair using OOT colour 27

    OOT shader
    0_1549818278679_Stock.png
    @bagginsbill's shader using the colour / bump maps
    0_1549818313831_BBbyAP.png
    @ghostship's
    0_1549818343715_GSbyAP.png
    My shader
    0_1549818359847_APbyAPDefault.png
    My Shader No Secondary
    0_1549818379948_APbyAPNoSecondary.png
    and My Shader No Primary
    0_1549818404282_APbyAPNoPrimary.png



  • @amethystpendant have you done a comparison of render times?



  • @ghostship No, I haven't, but I will do



  • @ghostship

    I ran each setup 3 times with the following settings
    0_1549828242633_031b20cc-99c1-4ee4-833b-6bdf48a265a7-image.png

    Lights 1 large area light, 1 bright 100% infinite and a little ambient from the construction

    There was very little variance between the runs, times in seconds

    OOT default Shader = 73
    @bagginsbill with Maps = 126
    @bagginsbill procedural = 147
    @ghostship = 101
    Mine = 103



  • @amethystpendant I know this is slightly OT but you should give a bucket size of 512 a try when not using Progressive Refinement. My 1070 hits a sweet spot there.

    I did a test scene with 256 that gave me 481.29 seconds, upping it to 512 reduced that too 417.78 seconds and the difference in much larger scenes is even greater.

    Unless you only render in Progressive, then what I'm saying doesn't effect you and you can just ignore me. :P