party like it's 1979

// gcc -std=c99 -Wall -Wextra -pedantic -O3 -o autostereo autostereo.c -lm && ./autostereo > autostereo.ppm
typedef int N;typedef double R;typedef unsigned char B;N main(){srand(time(0));R e=3,a=8,r=100,Z=2,D=18,b=18;N w=1920,h=1080;printf("P6\n%d %d\n255\n",w,h);for(N j=0;j<h;++j){R y=(h*0.5-(j+0.5))/r;B p[w][3];for(N i=0;i<w;++i){R x=(i+0.5-w*0.5)/r;R S=Z*Z-x*x-y*y;R d=S>0?D-sqrt(S):b;N o=floor(fabs(d-a)*e/d*r+rand()/(R)RAND_MAX);if(i-o<0||o==0)for(N c=0; c<3; ++c)p[i][c]=rand();else for(N c=0;c<3;++c)p[i][c]=p[i-o][c];}fwrite(&p[0][0],w*3,1,stdout);}return 0;}

(I have a less obfuscated version but it's too long to toot)


got centred pattern fill working

print at 180dpi (A4) and view cross-eyed from about 7 inches

texture is based on

. image
o stereo image pair
O autostereogram image
( ) autostereogram image pair

Show thread
Sign in to participate in the conversation

Welcome to, an instance for discussions around cultural freedom, experimental, new media art, net and computational culture, and things like that.