com.unity.demoteam.hair icon indicating copy to clipboard operation
com.unity.demoteam.hair copied to clipboard

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

Open StefanLengyel opened this issue 1 year ago • 2 comments

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.

StefanLengyel avatar Aug 07 '23 21:08 StefanLengyel

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));
}

blueyred avatar Aug 09 '23 09:08 blueyred

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?

StefanLengyel avatar Aug 09 '23 11:08 StefanLengyel