Smooth Minimal
One of most commun one found : Quadratic :
code:smoothsmin.glsl
// quadratic polynomial
float smin( float a, float b, float k )
{
k *= 4.0;
float h = max( k-abs(a-b), 0.0 )/k;
return min(a,b) - h*h*k*(1.0/4.0);
}
Mix factor
code:smoothsmin_mixfactor.glsl
vec2 smin( float a, float b, float k )
{
float h = max( k-abs(a-b), 0.0 )/k;
float m = h*h*0.5;
float s = m*k*(1.0/2.0);
return (a<b) ? vec2(a-s,m) : vec2(b-s,1.0-m);
}
https://scrapbox.io/files/66c6dd5398da7e001de47f88.png