(URP) Shader for Strand-Based Hair and Strand Color Variation

Hi,

i am currently trying to write a urp shader for the strand based hair system, this is how it is looking so far:

I am still inexperienced with shaders but i have not found a lot of examples for the strand based hair system, apart from the enemies demo, which is in hdrp and way too complex for me to understand.
I have two questions, first of all i tried to write a shader that randomly interpolates the color for each strand between two given colors, but my result is not interpolated but each strand is always either the first or second color, as can be seen here:


As i understand it, the random range node should give me a value between 0 and 1, but it seems to always return either 0 or 1. Why is that?

My second question is more general, are there any examples of realistic hair shaders with the strand based system in urp that i might take a look at, or tutorials explaining the HairVertex and HairVolume Node? I have not found any documentation about them.
Thanks for any help!

Hi, you can find a physical hair shader graph extension (for URP) in Unity’s HairFX URP repository. (no need to import the HairFX Core package)

Then you can import the HDRP shader graph (and subgraphs) from enemies demo or the hair sample demo and slightly adjust it in URP.

That’s weird. It should be a different integer for each hair strand.
9162368--1274765--HairVertex.jpg

Thank you! This just what i needed. :slight_smile:
I implemented what i could from the enemies hair shader. On that note, do you happen to know why the alpha value of the fragment shader does not seem to do anything? Is it not compatible with the hair instance?