Unity-Technologies / com.unity.demoteam.hair

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

How to create a colour gradient from the bottom to the top of the hair? #69

Open StefanLengyel opened 11 months ago

StefanLengyel commented 11 months ago

Hello, Can someone help me? How can I achieve gradient like this?

image

my current situation:

image image

Thank you!

Appreciate your help in advance.

blueyred commented 11 months ago

you can probably use the UV.y in the shader - as ana example;


float4 UnlitFrag(UnlitVaryings IN) : SV_Target
{
return float4(IN.strandColor, 1.0) * (0.5 +( 0.5 * IN.strandUV.y));
}
StefanLengyel commented 11 months ago

Thank you @blueyred, I'm new in UNITY. That means I don't use the Shader editor but I open the shaders code and add/edit these lines?