Skip to main content
Now in green
Source Link

GLSL, 700 629 564 545545 499 bytes

#define v vec2
#define l(b,d,t)length(g-b*d)<1.&&length(g-dot(g,b)*b)<(length(g)<.5?A*.5:.04)
#define j(x,r)length(x-g)<r
#define k(x,r,q)j(x,q)!=j(x,r)
float#define F=l(b)length(g-b)<1.3&&length(g-dot(g,b)*b)<(length(g)<S?A*S:A/S)
float C=.86,S=.5,F=.3,E=.22,A=.02,G=.21;void mainImage(out vec4 o,in v p){v r=iResolution.xy;v g=(p/S-r)/r.y;int c=0;ify;o.g=(jk(v(0,EF),FG,G-A)||j||k(v(E*CF*C,-E*SF*S),FG,G-A)||j||k(v(-E*CF*C,-E*SF*S),FG,G-A))c=1;if?o.g=0.:k(v(0),F,G)?C:l(v(0,1),1.,A)||l(v(C,-S),1.,A)||l(v(-C,-S),1.,A)||j(v(0),.06)||j(v(0,F),G)||j(v(F*C,-F*S),G)||j(v(-F*C,-F*S),G))c=0;if(k(v(?0),F,G))c=1;if(k.:j(v(0,FE),G,G-AF)||k||j(v(F*CE*C,-F*SE*S),G,G-AF)||k||j(v(-F*CE*C,-F*SE*S),G,G-A))c=0;o=vec4(cF)?C:0.;}

I was playing around with Shadertoy, so I tried the GLSL shading language. The code just rasterizes circles and lines by testing each fragment, and assigns them a value of one or zero. The size was cut down from >1000 bytes by heavy use of macros.

Shadertoy program

enter image description hereenter image description here

GLSL, 700 629 564 545 bytes

#define v vec2
#define l(b,d,t)length(g-b*d)<1.&&length(g-dot(g,b)*b)<(length(g)<.5?A*.5:.04)
#define j(x,r)length(x-g)<r
#define k(x,r,q)j(x,q)!=j(x,r)
float F=.3,C=.86,S=.5,E=.22,A=.02,G=.21;void mainImage(out vec4 o,in v p){v r=iResolution.xy;v g=(p/S-r)/r.y;int c=0;if(j(v(0,E),F)||j(v(E*C,-E*S),F)||j(v(-E*C,-E*S),F))c=1;if(l(v(0,1),1.,A)||l(v(C,-S),1.,A)||l(v(-C,-S),1.,A)||j(v(0),.06)||j(v(0,F),G)||j(v(F*C,-F*S),G)||j(v(-F*C,-F*S),G))c=0;if(k(v(0),F,G))c=1;if(k(v(0,F),G,G-A)||k(v(F*C,-F*S),G,G-A)||k(v(-F*C,-F*S),G,G-A))c=0;o=vec4(c);}

I was playing around with Shadertoy, so I tried the GLSL shading language. The code just rasterizes circles and lines by testing each fragment, and assigns them a value of one or zero. The size was cut down from >1000 bytes by heavy use of macros.

Shadertoy program

enter image description here

GLSL, 700 629 564 545 499 bytes

#define v vec2
#define j(x,r)length(x-g)<r
#define k(x,r,q)j(x,q)!=j(x,r)
#define l(b)length(g-b)<1.&&length(g-dot(g,b)*b)<(length(g)<S?A*S:A/S)
float C=.86,S=.5,F=.3,E=.22,A=.02,G=.21;void mainImage(out vec4 o,in v p){v r=iResolution.xy;v g=(p/S-r)/r.y;o.g=(k(v(0,F),G,G-A)||k(v(F*C,-F*S),G,G-A)||k(v(-F*C,-F*S),G,G-A))?o.g=0.:k(v(0),F,G)?C:l(v(0,1))||l(v(C,-S))||l(v(-C,-S))||j(v(0),.06)||j(v(0,F),G)||j(v(F*C,-F*S),G)||j(v(-F*C,-F*S),G)?0.:j(v(0,E),F)||j(v(E*C,-E*S),F)||j(v(-E*C,-E*S),F)?C:0.;}

I was playing around with Shadertoy, so I tried the GLSL shading language. The code just rasterizes circles and lines by testing each fragment, and assigns them a value of one or zero. The size was cut down from >1000 bytes by heavy use of macros.

Shadertoy program

enter image description here

Space
Source Link

GLSL, 700 629 564564 545 bytes

#define v vec2
#define l(b,d,t)length(g-b*d)<1.&&length(g-dot(g,b)*b)<(length(g)<.5?A*.5:.04)
#define j(x,r)length(x-g)<r
#define k(x,r,q)j(x,q)!=j(x,r)
float F=.3,C=.86,S=.5,E=.22,A=.02,G=.21;
void21;void mainImage(out vec4 o,in v p){v r=iResolution.xy;v g=vg=(-p.x+r.x*S,p.y/S-r.y*S)/r.y/C;inty;int c=0;if(j(v(0,E),F)||j(v(E*C,-E*S),F)||j(v(-E*C,-E*S),F))c=1;if(l(v(0,1),1.,A)||l(v(C,-S),1.,A)||l(v(-C,-S),1.,A)||j(v(0),.06)||j(v(0,F),G)||j(v(F*C,-F*S),G)||j(v(-F*C,-F*S),G))c=0;if(k(v(0),F,G))c=1;if(k(v(0,F),G,G-A)||k(v(F*C,-F*S),G,G-A)||k(v(-F*C,-F*S),G,G-A))c=0;o=vec4(c);}

I was playing around with Shadertoy, so I tried the GLSL shading language. The code just rasterizes circles and lines by testing each fragment, and assigns them a value of one or zero. The size was cut down from >1000 bytes by heavy use of macros.

Shadertoy program

enter image description here

GLSL, 700 629 564 bytes

#define v vec2
#define l(b,d,t)length(g-b*d)<1.&&length(g-dot(g,b)*b)<(length(g)<.5?A*.5:.04)
#define j(x,r)length(x-g)<r
#define k(x,r,q)j(x,q)!=j(x,r)
float F=.3,C=.86,S=.5,E=.22,A=.02,G=.21;
void mainImage(out vec4 o,in v p){v r=iResolution.xy;v g=v(-p.x+r.x*S,p.y-r.y*S)/r.y/C;int c=0;if(j(v(0,E),F)||j(v(E*C,-E*S),F)||j(v(-E*C,-E*S),F))c=1;if(l(v(0,1),1.,A)||l(v(C,-S),1.,A)||l(v(-C,-S),1.,A)||j(v(0),.06)||j(v(0,F),G)||j(v(F*C,-F*S),G)||j(v(-F*C,-F*S),G))c=0;if(k(v(0),F,G))c=1;if(k(v(0,F),G,G-A)||k(v(F*C,-F*S),G,G-A)||k(v(-F*C,-F*S),G,G-A))c=0;o=vec4(c);}

I was playing around with Shadertoy, so I tried the GLSL shading language. The code just rasterizes circles and lines by testing each fragment, and assigns them a value of one or zero. The size was cut down from >1000 bytes by heavy use of macros.

Shadertoy program

enter image description here

GLSL, 700 629 564 545 bytes

#define v vec2
#define l(b,d,t)length(g-b*d)<1.&&length(g-dot(g,b)*b)<(length(g)<.5?A*.5:.04)
#define j(x,r)length(x-g)<r
#define k(x,r,q)j(x,q)!=j(x,r)
float F=.3,C=.86,S=.5,E=.22,A=.02,G=.21;void mainImage(out vec4 o,in v p){v r=iResolution.xy;v g=(p/S-r)/r.y;int c=0;if(j(v(0,E),F)||j(v(E*C,-E*S),F)||j(v(-E*C,-E*S),F))c=1;if(l(v(0,1),1.,A)||l(v(C,-S),1.,A)||l(v(-C,-S),1.,A)||j(v(0),.06)||j(v(0,F),G)||j(v(F*C,-F*S),G)||j(v(-F*C,-F*S),G))c=0;if(k(v(0),F,G))c=1;if(k(v(0,F),G,G-A)||k(v(F*C,-F*S),G,G-A)||k(v(-F*C,-F*S),G,G-A))c=0;o=vec4(c);}

I was playing around with Shadertoy, so I tried the GLSL shading language. The code just rasterizes circles and lines by testing each fragment, and assigns them a value of one or zero. The size was cut down from >1000 bytes by heavy use of macros.

Shadertoy program

enter image description here

New code
Source Link

GLSL, 700 629 566564 bytes

#define v vec2
#define f float
#define r iResolution
#define l(b,d,t)(length(g-b*d)<1.&&length(g-(dot(g,b))*b)<t*<(length(g)<.5?A*.5:.04)
#define j(x,r)distancelength(x,-g)<r
#define k(x,r,q)!(j(x,q))&&j!=j(x,r)
ffloat F=.3,C=.86,S=.5,E=.22,A=.02,G=.21;
void mainImage(out vec4 o,in v p){v r=iResolution.xy;v g=v(-p.x+r.x*S,p.y-r.y*S)/r.y/C;int c=0;if(j(v(0,E),F)||j(v(E*C,-E*S),F)||j(v(-E*C,-E*S),F))c=1;if(l(v(0,1),1.,A)||l(v(C,-S),1.,A)||l(v(-C,-S),1.,A)||l(v(0,1),1.5,.08)||l(v(C,-S),1.5,.08)||l(v(-C,-S),1.5,.08)||j(v(0),.06)||j(v(0,F),G)||j(v(F*C,-F*S),G)||j(v(-F*C,-F*S),G))c=0;if(k(v(0),F,G))c=1;if(k(v(0,F),G,G-A)||k(v(F*C,-F*S),G,G-A)||k(v(-F*C,-F*S),G,G-A))c=0;o=vec4(c);}

I was playing around with Shadertoy, so I tried the GLSL shading language. The code just rasterizes circles and lines by testing each fragment, and assigns them a value of one or zero. The size was cut down from >1000 bytes by heavy use of macros.

Shadertoy program

enter image description here

GLSL, 700 629 566 bytes

#define v vec2
#define f float
#define r iResolution
#define l(b,d,t)(length(g-b*d)<1.&&length(g-(dot(g,b))*b)<t*.5)
#define j(x,r)distance(x,g)<r
#define k(x,r,q)!(j(x,q))&&j(x,r)
f F=.3,C=.86,S=.5,E=.22,A=.02,G=.21;
void mainImage(out vec4 o,in v p){v g=v(-p.x+r.x*S,p.y-r.y*S)/r.y/C;int c=0;if(j(v(0,E),F)||j(v(E*C,-E*S),F)||j(v(-E*C,-E*S),F))c=1;if(l(v(0,1),1.,A)||l(v(C,-S),1.,A)||l(v(-C,-S),1.,A)||l(v(0,1),1.5,.08)||l(v(C,-S),1.5,.08)||l(v(-C,-S),1.5,.08)||j(v(0),.06)||j(v(0,F),G)||j(v(F*C,-F*S),G)||j(v(-F*C,-F*S),G))c=0;if(k(v(0),F,G))c=1;if(k(v(0,F),G,G-A)||k(v(F*C,-F*S),G,G-A)||k(v(-F*C,-F*S),G,G-A))c=0;o=vec4(c);}

I was playing around with Shadertoy, so I tried the GLSL shading language. The code just rasterizes circles and lines by testing each fragment, and assigns them a value of one or zero. The size was cut down from >1000 bytes by heavy use of macros.

Shadertoy program

enter image description here

GLSL, 700 629 564 bytes

#define v vec2
#define l(b,d,t)length(g-b*d)<1.&&length(g-dot(g,b)*b)<(length(g)<.5?A*.5:.04)
#define j(x,r)length(x-g)<r
#define k(x,r,q)j(x,q)!=j(x,r)
float F=.3,C=.86,S=.5,E=.22,A=.02,G=.21;
void mainImage(out vec4 o,in v p){v r=iResolution.xy;v g=v(-p.x+r.x*S,p.y-r.y*S)/r.y/C;int c=0;if(j(v(0,E),F)||j(v(E*C,-E*S),F)||j(v(-E*C,-E*S),F))c=1;if(l(v(0,1),1.,A)||l(v(C,-S),1.,A)||l(v(-C,-S),1.,A)||j(v(0),.06)||j(v(0,F),G)||j(v(F*C,-F*S),G)||j(v(-F*C,-F*S),G))c=0;if(k(v(0),F,G))c=1;if(k(v(0,F),G,G-A)||k(v(F*C,-F*S),G,G-A)||k(v(-F*C,-F*S),G,G-A))c=0;o=vec4(c);}

I was playing around with Shadertoy, so I tried the GLSL shading language. The code just rasterizes circles and lines by testing each fragment, and assigns them a value of one or zero. The size was cut down from >1000 bytes by heavy use of macros.

Shadertoy program

enter image description here

Even smaller
Source Link
Loading
Small cleanups
Source Link
Loading
Source Link
Loading