![見出し画像](https://assets.st-note.com/production/uploads/images/136893888/rectangle_large_type_2_af77d42f44d8c33b6f5acc472392259e.png?width=1200)
🎡つぶやきglsl twiglのgeekコードをShadertoyで動くようにしたい
![](https://assets.st-note.com/img/1712614185216-z193fw2vIn.png?width=1200)
![](https://assets.st-note.com/img/1712614254519-ofOyxcrovs.png?width=1200)
![](https://assets.st-note.com/img/1712614471977-cqfkIrVhRO.png?width=1200)
![](https://assets.st-note.com/img/1712661199022-90dpRww3J4.png?width=1200)
#つぶやきGLSL
— yonatan (@zozuar) April 25, 2023
vec3 a=FC.wzz-.5,q,p=a*t-3.;for(float d,i,l;l++<1e2;q=p-=rotate3D(.4,a)*vec3((FC.xy-.5*r)/r.y*d,d))for(d=-p.y,i=58.;i>.1;i*=.5)d=max(d,min(min(q=i*.9-abs(mod(q*rotate3D(.5,a.zxz),i+i)-i),q.y).x,q.z)),o+=.1/exp(length(q+.03)*2e2+d)+q.z/4e4+1e-4/exp(d*d*1e6);o.gba*=a; pic.twitter.com/3AohUFe5qS
こういうカッコいいコードのがわんさとあるのだが、一旦Shgadertoyで動きを確認してCLASSICのGLSLとして把握していきたい。
![](https://assets.st-note.com/img/1712745057825-He4K9Vu1wv.png?width=1200)
他にもスニペットありそうだがとりあえずこれ
precision highp float;
#define r iResolution.xy
#define m iMouse.xy
#define t iTime
mat3 rotate3D(float angle, vec3 axis){
vec3 a = normalize(axis);
float s = sin(angle);
float c = cos(angle);
float rr = 1.0 - c;
return mat3(
a.x * a.x * rr + c,
a.y * a.x * rr + a.z * s,
a.z * a.x * rr - a.y * s,
a.x * a.y * rr - a.z * s,
a.y * a.y * rr + c,
a.z * a.y * rr + a.x * s,
a.x * a.z * rr + a.y * s,
a.y * a.z * rr - a.x * s,
a.z * a.z * rr + c
);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec4 FC=gl_FragCoord;
vec4 o;
//ここにコード
fragColor=o;
}
いいなと思ったら応援しよう!
![あたり帳簿](https://assets.st-note.com/production/uploads/images/146045306/profile_76a0adfc7bd4b4908ef76d29ad61ae98.png?width=600&crop=1:1,smart)