Unity-Technologies / com.unity.demoteam.hair

An integrated solution for authoring / importing / simulating / rendering strand-based hair in Unity.
Other
719 stars 97 forks source link

Making Hair Tip Thinner and Questions About Strand Renderer #42

Open CakemonBot opened 1 year ago

CakemonBot commented 1 year ago

Is it possible to change the hair size, and make the root thicker and tips thinner? I guess it could be something to do with strand renderer - built in strip, but using this setting I cannot use custom material, nothing will be rendered in the scene.

My work flow: Set up a hair instance object> set strand renderer to built in strip, scale up strand diameter and hair can be seen rendered, but in same length Setup a shader like so image Apply it to the hair and the hair works weirdly image

And if it required some shader knowledge it will be great if a sample shader can be provided, it's a bit advanced for me :)

fuglsang commented 1 year ago

Thanks for the workflow description. :)

Being able to visually modify the width of the rendered strands via ShaderGraph is a feature in progress.

makeplayhappy commented 1 year ago

I'd really like to look into solving this issue, are there any docs on how the strips are generated and the flow of the HLSL files?

makeplayhappy commented 1 year ago

This worked for my use case https://github.com/Unity-Technologies/com.unity.demoteam.hair/blob/master/Runtime/HairVertex.hlsl#L160

#if HAIR_VERTEX_ID_STRIPS
    float3 vertexOffsetWS = vertexTangentWS * (_GroupMaxParticleDiameter * (vertexUV.x - 0.5)) * (1 - vertexUV.y * 0.9);
#else
    float3 vertexOffsetWS = float3(0.0, 0.0, 0.0);
#endif
image