KITASENJU DESIGN BLOG

memo, html, javascript, unity

graph

glslでpowを使った減衰関数

float y(float x) { float offset = 0.0; float xx = x + offset; return cos(xx*10.0)*pow(2.0,-0.9*abs(xx)); }

ふたつのsmoothstep

//return x * x * (3.0 - 2.0 * x); return 6.0*x*x*x*x*x - 15.0*x*x*x*x + 10.0*x*x*x;

circle wave 円弧波

glslのコード float circleWave(float t) { float d=1.0; float st = sin(d * 3.1415 / 2.0); float p = (mod(t * 4.0, 2.0) - 1.0) * st; float a = sqrt(1.0 - pow(p, 2.0)); float amax = sqrt(1.0 - pow(st, 2.0)); float b = sign(mod(t, 1.0) - 0.5); …

smooth floor

float y(float x) { return floor(x) + smoothstep(0.4,1.0,fract(x)); }

sigmoid function in shader

シグモイド関数 float y(float x) { float contrast=16.0;//4.0,8.0,16.0 return 1.0/(1.0+exp(-contrast*(x-0.5))); //return 1.0/(1.0+exp(-(x-0.5))); } 参考 シェーダ

三角波的なfract

fract like triangle wave UVをミラー的に折り返したいとき。 GLSL Grapher で描画 float y(float x) { return abs(2.0*fract(0.5*x-0.5)-1.0); } unityのシェーダーで。 //hlsl float2 sankaku(float2 x) { return abs(2.0*frac(0.5*x-0.5)-1.0); } 参考 gl…

"FOOTER"