Ghostship's superfly hair shader



  • @ghostship Thanks, I'll make the changes tonight and post the script.



  • @amethystpendant Very interested! I had a hair with 10 zones to edit individually- pain! :-)


  • Poser Ambassadors

    @pelagius said in Ghostship's superfly hair shader:

    @amethystpendant Very interested! I had a hair with 10 zones to edit individually- pain! :-)

    I hear ya, I have hair with matzones for gazillion strands. My first reaction when go in the material room to refine it for SF ....WTF! and load another hair lol
    So this comes here really handy.



  • @ghostship, would it not be worth putting in a third hsv2 node for the diffuse channel as well, it can be left at the default but does then give the ability to change that as well? Also any reason why you don't use the bump on the translucence node?

    In addition to the changes you highlighted earlier I'll also add a param for the MixClosure 3 just for completeness, but default it to 0.5.



  • Short note on how the Translucent node is used in this shader. Translucent should always be connected by using the AddClosure node. The reason is that Translucent does only contribute back light. This is in opposite to Diffuse which contributes from front light only. I think BB mentioned it several times.

    I would suggest something like this (the MixNode reduces the amount of translucent):
    0_1548758074600_translucent.jpg



  • @amethystpendant Yes, sounds like a good idea to add another HSV2 node for diffuse.

    @nagra_00_ I will take a look at that. you are probably right.



  • @nagra_00_ Just did a check and replaced the mix with the add+mix as you have posted up and it makes the hair glow. I would not go this way with the shader.



  • @ghostship I know, never trust a physicist… ;-)
    Hmm, thats strange. By using the MixNode the way you do the diffuse value is reduced to 50% of its physical value.
    I took a quick look at the complete shader. There is a HSV node with value 2 in front of the TranslucentBsdf, which is than mixed in at 50%. This gives a 100% translucent in total. When i use translucent with clothes i use only 10-15% for it and drive the TranslucentBsdf input directly with the color map.



  • @nagra_00_ the HSV node, if I'm not mistaken, is changing the color of the image prior to being used for translucence, not upping it's amount compared to the diffuse node.


  • Poser Ambassadors

    0_1548780303367_c66abb15-4629-41c5-ab7d-a907c4305bdd-image.png

    It's doubled. This causes glow.



  • @bagginsbill Yes I just tried that and leaving that at 1, no glow



  • This is what I've got now
    0_1548780912009_e2722fd9-3e63-4439-9dee-6b8f7ef31c37-image.png



  • @amethystpendant that is not how @nagra_00_ set up the add closure and with it set up as he suggests and setting that value to 1 it still glows, just not as much.



  • The setup from @amethystpendant is fine. The MixNode from my suggestion is not needed as there is already the TranslucentHSV2 node that can be used to control the amount of translucent.



  • Okay the plugin is done. I can't of course attach it here and I've forgotten how to mark text as code to preserve it. I've uploaded it as a zip to my stash on DA GhostshipHair.zip I had to zip it as DA wont allow saving .py files

    Could some people test it and let me know if anything needs changing please, and let me know if any of the params are not right or obvious as to what they link to

    This is what is created by default assuming there is a firefly shader there to grab the maps from (the ff shader will be left in situ.

    0_1548788619763_5d6067d3-087e-4199-b35d-f8b4eb6f2036-image.png



  • @ghostship said in Ghostship's superfly hair shader:

    @amethystpendant that is not how @nagra_00_ set up the add closure and with it set up as he suggests and setting that value to 1 it still glows, just not as much.

    I'm not getting any glow from the shader, maybe my lights are different, I'm quite happy to change the setup it's quite easy to do


  • Poser Ambassadors

    Everybody keeps saying "my shader" but doesn't show it.

    Let me explain something, but quickly, with math.

    A mix node at .5 with inputs A and B is producing .5A + .5B
    Suppose you make A equal to Translucent(2 * Texture)
    And you make B equal to Diffuse(2 * Texture)
    You have
    .5 * (Translucent(2 * Texture)) + .5 * (Diffuse(2 * Texture))

    But using 2 * Texture as input to linear nodes (both of Translucent and Diffuse are linear) can be logically rearranged as:

    .5 * (2 * Translucent(Texture)) + .5 * (2 * Diffuse(Texture))

    And given that p * (q * r) is same as (p * q) * r, this is

    (.5 * 2) * Translucent(Texture) + (.5 * 2) * Diffuse(Texture)

    Now everybody should recognize that .5 * 2 is 1, and that 1 * X is X. Therefore the above simplifies to

    Translucent(Texture) + Diffuse(Texture)

    Which is same as using an Add instead of a Mix.

    The doubling of Value was providing enough compensation to counteract the 1/2 effect of the Mix node, thus effectively making it an Add node.

    You may have been doing that all along. I don't know.



  • @bagginsbill I think when we (or at least I) are referring to "your shader" we are meaning your uber hair shader, and when referring to you saying about add node for tran / diffuse we mean the excellent example you gave of why it should be add and not mix or modulated by rays in that same thread before you went on to develop the shader


  • Poser Ambassadors

    I was almost quoting others who said something like "In my shader, I'm not getting glow" and by "my" I mean whoever said that, not literally me, bagginsbill. Sorry for the confusion.

    Anyway the point is that maybe ghostship's shader was not wrong, because .5 * 2 is 1. It's unnecessarily complicated to use a mix with two doublers instead of just an add, but it does produce exactly the same result.



  • @bagginsbill said in Ghostship's superfly hair shader:

    I was almost quoting others who said something like "In my shader, I'm not getting glow" and by "my" I mean whoever said that, not literally me, bagginsbill. Sorry for the confusion.

    Anyway the point is that maybe ghostship's shader was not wrong, because .5 * 2 is 1. It's unnecessarily complicated to use a mix with two doublers instead of just an add, but it does produce exactly the same result.

    Ah that would be me, but I have shown my shader :) and I am using an add rather than a half doubled mix.