
|
Downloads
Demo: geexlab-demopack-gl32/d30-twigl/twigl02.xml
How to run the demo?
Download and unzip GeeXLab and the demopack where you want, launch GeeXLab and drop the demo (twigl02.xml) in GeeXLab. This demo requires OpenGL 3.2+. |
Another cool tweet shader made by @zozuar
float i,e,s,g,k=.005;for(o++;i++<2e2;g+=max(k,e*.2)){vec3 v=vec3(sin(e=t+g*.3),cos(e),4),p=vec3((FC.xy-.5*r)/r.y*g,g)*rotate3D(t,v);p.z+=t*4.;e=.3-dot(p.xy,p.xy);for(s=2.;s<2e2;s*=1.6)p.yz*=rotate2D(s),e+=abs(dot(sin(p*s+t*s*.2)/s,p-p+1.));o+=o.w*min(e,k)*k;}#つぶやきGLSL pic.twitter.com/k2iebu05Nq
— yonatan (@zozuar) September 22, 2021
And here is the pixel shader in the GeeXLab demo:
#version 150 uniform float time; uniform vec2 resolution; in vec4 v_texcoord; out vec4 FragColor; #define PI 3.14159265 #define FC gl_FragCoord mat2 rotate2D(float r) { return mat2(cos(r), sin(r), -sin(r), cos(r)); } mat3 rotate3D(float angle, vec3 axis) { vec3 a = normalize(axis); float s = sin(angle); float c = cos(angle); float r = 1.0 - c; return mat3( a.x * a.x * r + c, a.y * a.x * r + a.z * s, a.z * a.x * r - a.y * s, a.x * a.y * r - a.z * s, a.y * a.y * r + c, a.z * a.y * r + a.x * s, a.x * a.z * r + a.y * s, a.y * a.z * r - a.x * s, a.z * a.z * r + c ); } void main() { vec2 r = resolution; float t = time; vec4 fcolor = vec4(1.0); vec3 p = vec3(0.0); float i=0,e=0,s=0,g=0,k=.005; for(;i++<2e2;g+=max(k,e*.2)) { vec3 v=vec3(sin(e=t+g*.3),cos(e),4), p=vec3((FC.xy-.5*r)/r.y*g,g)*rotate3D(t,v); p.z+=t*4.; e=.3-dot(p.xy,p.xy); for(s=2.;s<2e2;s*=1.6) { p.yz*=rotate2D(s); e+=abs(dot(sin(p*s+t*s*.2)/s,p-p+1.)); } fcolor += fcolor.w*min(e,k)*k; } FragColor = fcolor; } |
The GeeXLab demo:
The shader is ready for live coding. Just edit the shader (d30-twigl/shaders/ps02.glsl) in your favorite text editor and save it to see the result in real time.
On a GeForce RTX 2070, this demo runs at 75 FPS (resolution: 1280×720).