Flower Tweet Shader


GeeXLab - Twigl flower shader



Downloads

 
Today, a new tweet shader made by yonatan using twigl.app (online editor for coding one tweet pixel shaders). This shader is very cool and I ported it to GeeXLab.

 
Original pixel shader:

for(float i,g,e,R,S;i++<1e2;o.rgb+=hsv(.4-.02/R,(e=max(e*R*1e4,.7)),.03/exp(e))){S=1.;
vec3 p=vec3((FC.xy/r-.5)*g,g-.3)-i/2e5;p.yz*=rotate2D(.3);
for(p=vec3(log(R=length(p))-t,e=asin(-p.z/R)-.1/R,atan(p.x,p.y)*3.);
S<1e2;S+=S)e+=pow(abs(dot(sin(p.yxz*S),cos(p*S))),.2)/S;g+=e*R*.1;}

Here is the same pixel shader in the GeeXLab demo:

#version 150
uniform float time;
uniform float frame;
uniform vec2 resolution;
in vec4 v_texcoord;
out vec4 FragColor;
 
#define PI 3.14159265
#define FC gl_FragCoord
 
vec3 hsv(float h, float s, float v)
{
  vec4 t = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
  vec3 p = abs(fract(vec3(h) + t.xyz) * 6.0 - vec3(t.w));
  return v * mix(vec3(t.x), clamp(p - vec3(t.x), 0.0, 1.0), s);
}
 
mat2 rotate2D(float r)
{
  return mat2(cos(r), sin(r), -sin(r), cos(r));
}
 
void main()
{
  vec2 r = resolution;
  float t = time;
  float f = frame;
  vec4 o = vec4(0.0);
  vec3 p = vec3(0.0);
  float i=0,g=0,e=0,R=0,S=0;
  for(; i++<1e2; o.rgb += hsv(.4-.02/R,(e=max(e*R*1e4,.7)),.03/exp(e)))
  {
    S=1.;
    vec3 p=vec3((FC.xy/r-.5)*g,g-.3)-i/2e5;
    p.yz*=rotate2D(.3);
    for(p=vec3(log(R=length(p))-t,e=asin(-p.z/R)-.1/R,atan(p.x,p.y)*3.);S<1e2;S+=S)
      e+=pow(abs(dot(sin(p.yxz*S),cos(p*S))),.2)/S;
 
    g+=e*R*.1;
  }
 
  FragColor = o;
}

The GeeXLab demo (just drop geexlab-demopack-gl32/d30-twigl/twigl06.xml in GeeXLab):
GeeXLab - Twigl flower shader

The shader is ready for live coding. Just edit the shader (d30-twigl/shaders/ps06.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 190 FPS (resolution: 800×800).





Leave a Comment

Your email address will not be published. Required fields are marked *