I’ve wanted to combine the kaleidoscope and layer cake scripts for around a year and I have been trying for a few months to get this script to work as it I think it should. I finished a script but I wanted to add anti-aliasing which doesn’t involve simply resizing the image since it takes a long time - I wanted proper linear interpolation instead like with my Layer Cake 2 script. This has given me a lot of stress and I simply don’t know how I’m going to do this at all.
I’ve made an updated script where the only attempt at antialiasing is with the radial strips and not the circular layers, but as you can see from the example, it’s not working properly.
#@gui Kaleidoscope Layer Cake : fx_jr_klc, fx_jr_klc_preview(1)
#@gui : sep = separator()
#@gui : Kaleidoscope Mirrors = int(6,1,64)
#@gui : Mirror Rotation = float(0,-360,360)
#@gui : Result Rotation = float(0,-360,360)
#@gui : Centre (%) = point(50,50,0,1)
#@gui : Mirror Offset (%) = point(50,50,0,1)
#@gui : Scale (%) = float(100,0,1000)
#@gui : Scale Bend (%) = float(0,-5,5)
#@gui : Broken Mirrors = choice("Off","On","Reverse")
#@gui : Layer Cake Density = float(30,0,100)
#@gui : Angle = float(0,-360,360)
#@gui : Angle Mode = choice("Normal","Divide by mirror quantity")
#@gui : Anti-Alias = float(2,0,20)
#@gui : Interpolation = choice(2,"None","Linear","Bicubic")
#@gui : Boundary = choice(3,"Transparent","Nearest","Periodic","Mirror")
fx_jr_klc:
to_rgb
aa=($14)
num=$1
mrot={$2/180*pi}
rrot={$3/180*pi}
cx=$4*w/100
cy=$5*h/100
ox=$6*w/100
oy=$7*h/100
scale=$8/100
sbend=$9
broken=$10
lcd=$11
lcang={$12/180*pi}
lcam=$13
inter=$15
bound=$16
f "begin(mrot="$mrot";rrot="$rrot";cx="$cx";cy="$cy";ox="$ox";oy="$oy";num="$num";scale="$scale";sbend="$sbend";broken="$broken";inter="$inter";bound="$bound";lcd="$lcd";ilcang="$lcang"/("$lcam"?num:1);aa="$aa");
vx=x-cx+0.5;vy=y-cy-0.5;
maxr=sqrt((w+0.5)^2+(h+0.5)^2)/2;
ra=sqrt(vx^2+vy^2);
rad=ra/maxr;
radius=((rad)^(2^sbend));
ang=atan2(vy,vx)-mrot-rrot-((lcd==0?(radius*scale):(floor(radius*lcd*scale)/lcd))*ilcang);
awidth=pi/num;
mult=ang/awidth;
multint = floor(mult);
multintaa = floor(mult+aa/ra);
angle = ang-multint*awidth;
broken==1?(angle=angle):broken==2?(angle=awidth-angle;awidth*=-1):(multint%2==1)?(angle=awidth-angle;awidth*=-1);
xwarp00=radius*scale*maxr*cos(angle+mrot)+ox-0.5;
ywarp00=radius*scale*maxr*sin(angle+mrot)+oy-0.5;
xwarp01=radius*scale*maxr*cos(angle+mrot-awidth)+ox-0.5;
ywarp01=radius*scale*maxr*sin(angle+mrot-awidth)+oy-0.5;
xwarp10=radius*scale*maxr*cos(angle+mrot+ilcang)+ox-0.5;
ywarp10=radius*scale*maxr*sin(angle+mrot+ilcang)+oy-0.5;
xwarp11=radius*scale*maxr*cos(angle+mrot-awidth+ilcang)+ox-0.5;
ywarp11=radius*scale*maxr*sin(angle+mrot-awidth+ilcang)+oy-0.5;
kfunc=min(((mult-multintaa)*ra/(aa*2)+0.5),1);
lcfunc=1;
I=I(xwarp00,ywarp00,z,inter,bound)*(kfunc)+I(xwarp01,ywarp01,z,inter,bound)*(1-kfunc);"
c 0,255
n 0,255
fx_jr_klc_preview:
fx_jr_klc $*
fx_jr_klc 7,0,0,46.5776,54.591,50,50,100,0,0,30,0,0,5,2,3
I have absolutely no idea about how I can fix this. kfunc
is supposed to allow for a linear crossfading between the strips it’s actually crossfading between parts of the image which follow a discontinuous function. I want to crossfade between rotated versions of the same image with the transitions corresponding to where the strips should be rather than an image which is already partitioned into strips.
I think that I made a similar solution to the one I need in the Layer Cake 2 script but I have no idea how I’d implement such a thing here.