Shader Graph自定义渐变色节点Gradiant
Unity自带Shader中的Gradiant不能暴露在外部
使用定义CustomFunction来制作暴露给外部的Gradiant
ShaderGraph节点图
CustomFunction代码
if(inputValue<location1)
{
outFloat = color1;
}
else if(inputValue<location2)
{
float pos = (inputValue-location1)/(location2-location1);
outFloat = lerp(color1, color2, pos);
}
else if(inputValue<location3)
{
float pos = (inputValue-location2)/(location3-location2);
outFloat = lerp(color2, color3, pos);
}
标签:Gradiant,自定义,Graph,Shader,渐变色,节点
From: https://www.cnblogs.com/Firepad-magic/p/18418382