111
This commit is contained in:
@@ -21,6 +21,12 @@ inline half NB_Remap(half x, half inMin, half inMax, half outMin, half outMax)
|
||||
return saturate((x - inMin) / (inMax - inMin)) * (outMax - outMin) + outMin;
|
||||
}
|
||||
|
||||
inline half NB_Remap01(half x, half inMin, half inMax)
|
||||
{
|
||||
// x= clamp(x,inMin,inMax);
|
||||
return saturate((x - inMin) / (inMax - inMin));
|
||||
}
|
||||
|
||||
inline half NB_RemapNoClamp(half x, half inMin, half inMax, half outMin, half outMax)
|
||||
{
|
||||
// x= clamp(x,inMin,inMax);
|
||||
@@ -240,6 +246,14 @@ void Unity_Blend_HardLight_half(half Base, half Blend, half Opacity, out half Ou
|
||||
Out = lerp(Base, Out, Opacity);
|
||||
}
|
||||
|
||||
void Blend_HardLight_half(half Base, half Blend, out half Out)
|
||||
{
|
||||
half result1 = 1.0 - 2.0 * (1.0 - Base) * (1.0 - Blend);
|
||||
half result2 = 2.0 * Base * Blend;
|
||||
half zeroOrOne = step(Blend, 0.5);
|
||||
Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
|
||||
}
|
||||
|
||||
float2 randomGradient(float2 p) {
|
||||
p = p + 0.02;
|
||||
float x = dot(p, float2(123.4, 234.5));
|
||||
@@ -348,4 +362,10 @@ half2 Rotate(half2 v, half cos0, half sin0)
|
||||
return half2(v.x * cos0 - v.y * sin0,
|
||||
v.x * sin0 + v.y * cos0);
|
||||
}
|
||||
|
||||
half SmoothStep01(half interval)//让01线性过渡变成SmoothStep过渡,但是控制计算量。
|
||||
{
|
||||
interval = saturate(interval);
|
||||
return interval * interval * ( 3 - 2 * interval );
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user