Could you make this filter effect:
Random rectangle division could do this, but with modification.
Maybe this can be a good start:
foo :
800,800,1,1
1,1,1,4
eval "
# Construct list of rectangles.
da_push([0,0,1,1]);
repeat(150,
do (
n = round(u(da_size()-1));
R = I[n];
dx = R[2] - R[0];
dy = R[3] - R[1],
dx*dy<0.01);
f = u(0.2,0.8);
dx<dy?( # Horizontal split
y = lerp(R[1],R[3],f);
I[n] = [ R[0],R[1],R[2],y ];
da_push([ R[0],y,R[2],R[3] ]);
):( # Vertical split
x = lerp(R[0],R[2],f);
I[n] = [ R[0],R[1],x,R[3] ];
da_push([ x,R[1],R[2],R[3] ]);
);
);
# Draw rectangles.
repeat(da_size(),k,
R = round(I[k]*[ w#0,h#0,w#0,h#0 ]);
polygon(#0,4,R[0],R[1],R[2] - 1,R[1],R[2] - 1,R[3] - 1,R[0],R[3] - 1,1,k);
);
"
rm.
+g. xy,1 a[-2,-1] c norm. ==. 0
{0,iM+1},1,1,3 rand. 100,255 map[0] . rm.
*
2 Likes
A variation, that recursively generates all subdivisions:
foo :
800,800,1,1
1,1,1,4x2
eval "
# Construct list of rectangles.
da_push(#1,[0,0,1,1]);
repeat(7,l,
repeat(da_size(#1),k,
R = I[#1,k];
dx = R[2] - R[0];
dy = R[3] - R[1];
f = u(0.3,0.7);
dx<dy?( # Horizontal split
y = lerp(R[1],R[3],f);
da_push([ R[0],R[1],R[2],y ],[ R[0],y,R[2],R[3] ]);
):( # Vertical split
x = lerp(R[0],R[2],f);
da_push([ R[0],R[1],x,R[3] ],[ x,R[1],R[2],R[3] ]);
);
);
run('rv[-2,-1] f. 0');
);
# Draw rectangles.
repeat(da_size(#1),k,
R = round(I[#1,k]*[ w#0,h#0,w#0,h#0 ]);
polygon(#0,4,R[0],R[1],R[2] - 1,R[1],R[2] - 1,R[3] - 1,R[0],R[3] - 1,1,k);
);
"
rm[-2,-1]
+g. xy,1 a[-2,-1] c norm. ==. 0
{0,iM+1},1,1,3 rand. 100,255 map[0] . rm.
*
1 Like
Could you put this in official GMIC ?