MandelMultiwave2Beta {
;
; This coloring method provides a specific gradient modification for
; Mandelbrot fractals.
;
; This version uses an hsl space with hue from 0 to 8 instead of 0 to 6
; and with red, orange, yellow, yellow-green, green, cyan, blue, magenta
; equally spaced around the hue wheel. When interpolating colors, uses
; a colorspace with a red/green axis, a blue/yellow axis, and luminance at
; mutual right angles; the chroma plane's unit circle is fully saturated
; hues while its center is grey. In particular, this means that midway
; between red and green is grey, not yellow. Correspondingly, instead of
; rgb bias and rgb blend are rgby bias and rgby blend, applied in the same
; space.
;
; The four luminance-only waves also use sine curves instead of splines and
; have added phase options.
;
; The "superslow" bias was renamed the "overlay" bias, since it turns out to
; be useful at many different possible length scales. The random color part
; is most useful as the slowest bias now.
;
global:
complex il = 1/log(@power) ; Inverse log (power).
float lp = log(log(@bailout)) ; log(log bailout).
final:
float i = real(#numiter + il*lp - il*log(log(cabs(#z))))*@rescale + @displacement
IF (i < 1)
i = 1
ENDIF
float ix = (i - 1)/@hfreq2
ix = ix - trunc(ix)
color c1a
color c1b
color c1c
color c1d
color c2a
color c2b
color c2c
color c2d
color c3a
color c3b
color c3c
color c3d
color c4a
color c4b
color c4c
color c4d
IF (ix < 1/5)
ix = ix*5
c1a = @c1e
c1b = @c1a
c1c = @c1b
c1d = @c1c
c2a = @c2e
c2b = @c2a
c2c = @c2b
c2d = @c2c
c3a = @c3e
c3b = @c3a
c3c = @c3b
c3d = @c3c
c4a = @c4e
c4b = @c4a
c4c = @c4b
c4d = @c4c
ELSEIF (ix < 2/5)
ix = (ix - 1/5)*5
c1a = @c1a
c1b = @c1b
c1c = @c1c
c1d = @c1d
c2a = @c2a
c2b = @c2b
c2c = @c2c
c2d = @c2d
c3a = @c3a
c3b = @c3b
c3c = @c3c
c3d = @c3d
c4a = @c4a
c4b = @c4b
c4c = @c4c
c4d = @c4d
ELSEIF (ix < 3/5)
ix = (ix - 2/5)*5
c1a = @c1b
c1b = @c1c
c1c = @c1d
c1d = @c1e
c2a = @c2b
c2b = @c2c
c2c = @c2d
c2d = @c2e
c3a = @c3b
c3b = @c3c
c3c = @c3d
c3d = @c3e
c4a = @c4b
c4b = @c4c
c4c = @c4d
c4d = @c4e
ELSEIF (ix < 4/5)
ix = (ix - 3/5)*5
c1a = @c1c
c1b = @c1d
c1c = @c1e
c1d = @c1a
c2a = @c2c
c2b = @c2d
c2c = @c2e
c2d = @c2a
c3a = @c3c
c3b = @c3d
c3c = @c3e
c3d = @c3a
c4a = @c4c
c4b = @c4d
c4c = @c4e
c4d = @c4a
ELSE
ix = (ix - 4/5)*5
c1a = @c1d
c1b = @c1e
c1c = @c1a
c1d = @c1b
c2a = @c2d
c2b = @c2e
c2c = @c2a
c2d = @c2b
c3a = @c3d
c3b = @c3e
c3c = @c3a
c3d = @c3b
c4a = @c4d
c4b = @c4e
c4c = @c4a
c4d = @c4b
ENDIF
float h0h = hue(c1b)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
float s0s = sat(c1b)
float rgp0 = cos(h0h)*s0s
float byp0 = sin(h0h)*s0s
float lp0 = lum(c1b)
h0h = hue(c1c)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c1c)
float rgp1 = cos(h0h)*s0s
float byp1 = sin(h0h)*s0s
float lp1 = lum(c1c)
h0h = hue(c1a)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c1a)
float rgm0 = (rgp1 - cos(h0h)*s0s)/2
float bym0 = (byp1 - sin(h0h)*s0s)/2
float lm0 = (lp1 - lum(c1a))/2
h0h = hue(c1d)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c1d)
float rgm1 = (cos(h0h)*s0s - rgp0)/2
float bym1 = (sin(h0h)*s0s - byp0)/2
float lm1 = (lum(c1d) - lp0)/2
float ixt2 = ix^2
float ixt3 = ix^3
float ixa = 2*ixt3 - 3*ixt2 + 1
float ixb = ixt3 - 2*ixt2 + ix
float ixc = -2*ixt3 + 3*ixt2
float ixd = ixt3 - ixt2
float rg = ixa*rgp0 + ixb*rgm0 + ixc*rgp1 + ixd*rgm1
float by = ixa*byp0 + ixb*bym0 + ixc*byp1 + ixd*bym1
float lm = ixa*lp0 + ixb*lm0 + ixc*lp1 + ixd*lm1
complex rgby = rg + (0,1)*by
h0h = atan2(rgby)*4/#pi
IF (h0h < 0)
h0h = h0h + 8
ELSEIF (h0h > 8)
h0h = h0h - 8
ENDIF
IF (h0h < 4)
h0h = h0h/2
ELSE
h0h = h0h - 2
ENDIF
s0s = cabs(rgby)
IF (s0s > 1.0)
s0s = 1.0
ENDIF
IF (lm < 0.0)
lm = 0.0
ENDIF
IF (lm > 1.0)
lm = 1.0
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
color c1 = hsl(h0h,s0s,lm)
h0h = hue(c2b)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c2b)
rgp0 = cos(h0h)*s0s
byp0 = sin(h0h)*s0s
lp0 = lum(c2b)
h0h = hue(c2c)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c2c)
rgp1 = cos(h0h)*s0s
byp1 = sin(h0h)*s0s
lp1 = lum(c2c)
h0h = hue(c2a)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c2a)
rgm0 = (rgp1 - cos(h0h)*s0s)/2
bym0 = (byp1 - sin(h0h)*s0s)/2
lm0 = (lp1 - lum(c2a))/2
h0h = hue(c2d)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c2d)
rgm1 = (cos(h0h)*s0s - rgp0)/2
bym1 = (sin(h0h)*s0s - byp0)/2
lm1 = (lum(c2d) - lp0)/2
ixt2 = ix^2
ixt3 = ix^3
ixa = 2*ixt3 - 3*ixt2 + 1
ixb = ixt3 - 2*ixt2 + ix
ixc = -2*ixt3 + 3*ixt2
ixd = ixt3 - ixt2
rg = ixa*rgp0 + ixb*rgm0 + ixc*rgp1 + ixd*rgm1
by = ixa*byp0 + ixb*bym0 + ixc*byp1 + ixd*bym1
lm = ixa*lp0 + ixb*lm0 + ixc*lp1 + ixd*lm1
rgby = rg + (0,1)*by
h0h = atan2(rgby)*4/#pi
IF (h0h < 0)
h0h = h0h + 8
ELSEIF (h0h > 8)
h0h = h0h - 8
ENDIF
IF (h0h < 4)
h0h = h0h/2
ELSE
h0h = h0h - 2
ENDIF
s0s = cabs(rgby)
IF (s0s > 1.0)
s0s = 1.0
ENDIF
IF (lm < 0.0)
lm = 0.0
ENDIF
IF (lm > 1.0)
lm = 1.0
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
color c2 = hsl(h0h,s0s,lm)
h0h = hue(c3b)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c3b)
rgp0 = cos(h0h)*s0s
byp0 = sin(h0h)*s0s
lp0 = lum(c3b)
h0h = hue(c3c)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c3c)
rgp1 = cos(h0h)*s0s
byp1 = sin(h0h)*s0s
lp1 = lum(c3c)
h0h = hue(c3a)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c3a)
rgm0 = (rgp1 - cos(h0h)*s0s)/2
bym0 = (byp1 - sin(h0h)*s0s)/2
lm0 = (lp1 - lum(c3a))/2
h0h = hue(c3d)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c3d)
rgm1 = (cos(h0h)*s0s - rgp0)/2
bym1 = (sin(h0h)*s0s - byp0)/2
lm1 = (lum(c3d) - lp0)/2
ixt2 = ix^2
ixt3 = ix^3
ixa = 2*ixt3 - 3*ixt2 + 1
ixb = ixt3 - 2*ixt2 + ix
ixc = -2*ixt3 + 3*ixt2
ixd = ixt3 - ixt2
rg = ixa*rgp0 + ixb*rgm0 + ixc*rgp1 + ixd*rgm1
by = ixa*byp0 + ixb*bym0 + ixc*byp1 + ixd*bym1
lm = ixa*lp0 + ixb*lm0 + ixc*lp1 + ixd*lm1
rgby = rg + (0,1)*by
h0h = atan2(rgby)*4/#pi
IF (h0h < 0)
h0h = h0h + 8
ELSEIF (h0h > 8)
h0h = h0h - 8
ENDIF
IF (h0h < 4)
h0h = h0h/2
ELSE
h0h = h0h - 2
ENDIF
s0s = cabs(rgby)
IF (s0s > 1.0)
s0s = 1.0
ENDIF
IF (lm < 0.0)
lm = 0.0
ENDIF
IF (lm > 1.0)
lm = 1.0
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
color c3 = hsl(h0h,s0s,lm)
h0h = hue(c4b)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c4b)
rgp0 = cos(h0h)*s0s
byp0 = sin(h0h)*s0s
lp0 = lum(c4b)
h0h = hue(c4c)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c4c)
rgp1 = cos(h0h)*s0s
byp1 = sin(h0h)*s0s
lp1 = lum(c4c)
h0h = hue(c4a)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c4a)
rgm0 = (rgp1 - cos(h0h)*s0s)/2
bym0 = (byp1 - sin(h0h)*s0s)/2
lm0 = (lp1 - lum(c4a))/2
h0h = hue(c4d)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c4d)
rgm1 = (cos(h0h)*s0s - rgp0)/2
bym1 = (sin(h0h)*s0s - byp0)/2
lm1 = (lum(c4d) - lp0)/2
ixt2 = ix^2
ixt3 = ix^3
ixa = 2*ixt3 - 3*ixt2 + 1
ixb = ixt3 - 2*ixt2 + ix
ixc = -2*ixt3 + 3*ixt2
ixd = ixt3 - ixt2
rg = ixa*rgp0 + ixb*rgm0 + ixc*rgp1 + ixd*rgm1
by = ixa*byp0 + ixb*bym0 + ixc*byp1 + ixd*bym1
lm = ixa*lp0 + ixb*lm0 + ixc*lp1 + ixd*lm1
rgby = rg + (0,1)*by
h0h = atan2(rgby)*4/#pi
IF (h0h < 0)
h0h = h0h + 8
ELSEIF (h0h > 8)
h0h = h0h - 8
ENDIF
IF (h0h < 4)
h0h = h0h/2
ELSE
h0h = h0h - 2
ENDIF
s0s = cabs(rgby)
IF (s0s > 1.0)
s0s = 1.0
ENDIF
IF (lm < 0.0)
lm = 0.0
ENDIF
IF (lm > 1.0)
lm = 1.0
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
color c4 = hsl(h0h,s0s,lm)
ix = (i - 1)/@hfreq1
ix = ix - trunc(ix)
color ca
color cb
color cc
color cd
IF (ix < 1/4)
ix = ix*4
ca = c4
cb = c1
cc = c2
cd = c3
ELSEIF (ix < 1/2)
ix = (ix - 1/4)*4
ca = c1
cb = c2
cc = c3
cd = c4
ELSEIF (ix < 3/4)
ix = (ix - 1/2)*4
ca = c2
cb = c3
cc = c4
cd = c1
ELSE
ix = (ix - 3/4)*4
ca = c3
cb = c4
cc = c1
cd = c2
ENDIF
h0h = hue(cb)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(cb)
rgp0 = cos(h0h)*s0s
byp0 = sin(h0h)*s0s
lp0 = lum(cb)
h0h = hue(cc)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(cc)
rgp1 = cos(h0h)*s0s
byp1 = sin(h0h)*s0s
lp1 = lum(cc)
h0h = hue(ca)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(ca)
rgm0 = (rgp1 - cos(h0h)*s0s)/2
bym0 = (byp1 - sin(h0h)*s0s)/2
lm0 = (lp1 - lum(ca))/2
h0h = hue(cd)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(cd)
rgm1 = (cos(h0h)*s0s - rgp0)/2
bym1 = (sin(h0h)*s0s - byp0)/2
lm1 = (lum(cd) - lp0)/2
ixt2 = ix^2
ixt3 = ix^3
ixa = 2*ixt3 - 3*ixt2 + 1
ixb = ixt3 - 2*ixt2 + ix
ixc = -2*ixt3 + 3*ixt2
ixd = ixt3 - ixt2
rg = ixa*rgp0 + ixb*rgm0 + ixc*rgp1 + ixd*rgm1
by = ixa*byp0 + ixb*bym0 + ixc*byp1 + ixd*bym1
lm = ixa*lp0 + ixb*lm0 + ixc*lp1 + ixd*lm1
rgby = rg + (0,1)*by
h0h = atan2(rgby)*4/#pi
IF (h0h < 0)
h0h = h0h + 8
ELSEIF (h0h > 8)
h0h = h0h - 8
ENDIF
IF (h0h < 4)
h0h = h0h/2
ELSE
h0h = h0h - 2
ENDIF
s0s = cabs(rgby)
IF (s0s > 1.0)
s0s = 1.0
ENDIF
IF (lm < 0.0)
lm = 0.0
ENDIF
IF (lm > 1.0)
lm = 1.0
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
c2 = hsl(h0h,s0s,lm)
ix = (i - 1)/@sfreq
ix = ix - trunc(ix)
IF (ix < 1/3)
ix = ix*3
ca = @cz
cb = @cx
cc = @cy
cd = @cz
ELSEIF (ix < 2/3)
ix = (ix - 1/3)*3
ca = @cx
cb = @cy
cc = @cz
cd = @cx
ELSE
ix = (ix - 2/3)*3
ca = @cy
cb = @cz
cc = @cx
cd = @cy
ENDIF
h0h = hue(cb)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(cb)
rgp0 = cos(h0h)*s0s
byp0 = sin(h0h)*s0s
lp0 = lum(cb)
h0h = hue(cc)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(cc)
rgp1 = cos(h0h)*s0s
byp1 = sin(h0h)*s0s
lp1 = lum(cc)
h0h = hue(ca)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(ca)
rgm0 = (rgp1 - cos(h0h)*s0s)/2
bym0 = (byp1 - sin(h0h)*s0s)/2
lm0 = (lp1 - lum(ca))/2
h0h = hue(cd)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(cd)
rgm1 = (cos(h0h)*s0s - rgp0)/2
bym1 = (sin(h0h)*s0s - byp0)/2
lm1 = (lum(cd) - lp0)/2
ixt2 = ix^2
ixt3 = ix^3
ixa = 2*ixt3 - 3*ixt2 + 1
ixb = ixt3 - 2*ixt2 + ix
ixc = -2*ixt3 + 3*ixt2
ixd = ixt3 - ixt2
rg = ixa*rgp0 + ixb*rgm0 + ixc*rgp1 + ixd*rgm1
by = ixa*byp0 + ixb*bym0 + ixc*byp1 + ixd*bym1
lm = ixa*lp0 + ixb*lm0 + ixc*lp1 + ixd*lm1
rgby = rg + (0,1)*by
h0h = atan2(rgby)*4/#pi
IF (h0h < 0)
h0h = h0h + 8
ELSEIF (h0h > 8)
h0h = h0h - 8
ENDIF
IF (h0h < 4)
h0h = h0h/2
ELSE
h0h = h0h - 2
ENDIF
s0s = cabs(rgby)
IF (s0s > 1.0)
s0s = 1.0
ENDIF
IF (lm < 0.0)
lm = 0.0
ENDIF
IF (lm > 1.0)
lm = 1.0
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
c3 = hsl(h0h,s0s,lm)
float hh = hue(c2)
float ss = sat(c2)
float ll = lum(c2)
h0h = hue(c3)
IF (hh > 2)
hh = hh + 2
ELSE
hh = hh * 2
ENDIF
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
IF (ll != 1.0 && lum(c3) != 1.0)
ll = 1 - 1/((1/(1 - ll) - 1)*(1/(1 - lum(c3)) - 1) + 1)
ENDIF
IF (@smode == 0)
ss = ss*(1 - sat(c3)*(((1 - cos((hh - h0h)*#pi/4))/2)^@spow))
ELSE
hh = (hh + h0h)%8
IF (ss != 1.0 && sat(c3) != 1.0)
ss = 1 - 1/((1/(1 - ss) - 1)*(1/(1 - sat(c3)) - 1) + 1)
ENDIF
ENDIF
IF (hh < 4)
hh = hh/2
ELSE
hh = hh - 2
ENDIF
IF (hh > 5.999)
hh = 0
ENDIF
c1 = hsl(hh,ss,ll)
float ll2 = sin((((i - 1)/@lfreq) + @lphase)*2*#pi)*@lmag/2 + 0.5
float ll3 = sin((((i - 1)/@lfreq2) + @lphase2)*2*#pi)*@lmag2/2 + 0.5
float ll4 = sin((((i - 1)/@lfreq3) + @lphase3)*2*#pi)*@lmag3/2 + 0.5
float ll5 = sin((((i - 1)/@lfreq4) + @lphase4)*2*#pi)*@lmag4/2 + 0.5
float mn = @fitminit
float mx = @fitmaxit
ix = i
IF (@transfer == 1)
ix = ix^(1/@transpower)
mn = mn^(1/@transpower)
mx = mx^(1/@transpower)
ELSEIF (@transfer == 2)
ix = log(ix)
mn = log(mn)
mx = log(mx)
ENDIF
IF (@fit)
IF (ix < mn)
ix = 0
ELSE
ix = (ix - mn)/(mx - mn)
ENDIF
ix = ix * @fittimes
ELSE
ix = 0.05*ix
ENDIF
color c6 = gradient(ix)
ca = hsl(0,0.5,0.5)
cb = hsl(0,0.5,0.5)
cc = hsl(0,0.5,0.5)
cd = hsl(0,0.5,0.5)
float lastrhh = 0
float lastrsl = 0.5
int seed = random(@rseed)
ix = (i - @rstart)/@rlen + 2
int iy = trunc(ix)
ix = ix - iy
WHILE (iy > 0)
ca = cb
cb = cc
cc = cd
float rss = abs(seed)/#randomrange
seed = random(seed)
float rll = (seed/#randomrange)*@rlum/2 + 0.5
seed = random(seed)
float rsl = 2.0*rll
IF (rsl > 1.0)
rsl = 1.0 - rsl
ENDIF
rsl = rsl * rss
float rhh = 8.0*(abs(seed)/#randomrange)
seed = random(seed)
float rhhdiff = abs(rhh - lastrhh)
IF (abs(rhhdiff - 8) < rhhdiff)
rhhdiff = abs(rhhdiff - 8)
ENDIF
WHILE (rhhdiff*(rsl + lastrsl)/2 > @rhvmax)
rhh = 8.0*(abs(seed)/#randomrange)
seed = random(seed)
rhhdiff = abs(rhh - lastrhh)
IF (abs(rhhdiff - 8) < rhhdiff)
rhhdiff = abs(rhhdiff - 8)
ENDIF
ENDWHILE
IF (rhh < 4)
h0h = rhh/2
ELSE
h0h = rhh - 2
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
cd = hsl(h0h,rss,rll)
lastrhh = rhh
lastrsl = rsl
iy = iy - 1
ENDWHILE
h0h = hue(cb)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(cb)
rgp0 = cos(h0h)*s0s
byp0 = sin(h0h)*s0s
lp0 = lum(cb)
h0h = hue(cc)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(cc)
rgp1 = cos(h0h)*s0s
byp1 = sin(h0h)*s0s
lp1 = lum(cc)
h0h = hue(ca)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(ca)
rgm0 = (rgp1 - cos(h0h)*s0s)/2
bym0 = (byp1 - sin(h0h)*s0s)/2
lm0 = (lp1 - lum(ca))/2
h0h = hue(cd)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(cd)
rgm1 = (cos(h0h)*s0s - rgp0)/2
bym1 = (sin(h0h)*s0s - byp0)/2
lm1 = (lum(cd) - lp0)/2
ixt2 = ix^2
ixt3 = ix^3
ixa = 2*ixt3 - 3*ixt2 + 1
ixb = ixt3 - 2*ixt2 + ix
ixc = -2*ixt3 + 3*ixt2
ixd = ixt3 - ixt2
rg = ixa*rgp0 + ixb*rgm0 + ixc*rgp1 + ixd*rgm1
by = ixa*byp0 + ixb*bym0 + ixc*byp1 + ixd*bym1
lm = ixa*lp0 + ixb*lm0 + ixc*lp1 + ixd*lm1
rgby = rg + (0,1)*by
h0h = atan2(rgby)*4/#pi
IF (h0h < 0)
h0h = h0h + 8
ELSEIF (h0h > 8)
h0h = h0h - 8
ENDIF
IF (h0h < 4)
h0h = h0h/2
ELSE
h0h = h0h - 2
ENDIF
s0s = cabs(rgby)
IF (s0s > 1.0)
s0s = 1.0
ENDIF
IF (lm < 0.0)
lm = 0.0
ENDIF
IF (lm > 1.0)
lm = 1.0
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
color c7 = hsl(h0h,s0s,lm)
IF (@mmode == 1)
hh = hue(c1)
IF (hh > 2)
hh = hh + 2
ELSE
hh = hh * 2
ENDIF
h0h = hue(c6)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
hh = hh + h0h
h0h = hue(c7)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
hh = (hh + h0h)%8
IF (hh < 4)
hh = hh/2
ELSE
hh = hh - 2
ENDIF
float sc1 = sat(c1)
float sc6 = sat(c6)
float sc7 = sat(c7)
IF (sc1 > 0.99)
sc1 = 0.99
ENDIF
IF (sc6 > 0.99)
sc6 = 0.99
ENDIF
IF (sc7 > 0.99)
sc7 = 0.99
ENDIF
sc1 = 1/(1 - sc1) - 1
sc6 = 1/(1 - sc6) - 1
sc7 = 1/(1 - sc7) - 1
ss = sc1*sc6*sc7
ss = 1 - 1/(ss + 1)
float ll1 = lum(c1)
float ll6 = lum(c6)
float ll7 = lum(c7)
IF (ll1 == 1.0 || ll2 == 1.0 || ll3 == 1.0 || ll4 == 1.0 || ll5 == 1.0 || ll6 == 1.0 || ll7 == 1.0)
ll = 1.0
ELSE
ll1 = 1/(1 - ll1) - 1
ll2 = 1/(1 - ll2) - 1
ll3 = 1/(1 - ll3) - 1
ll4 = 1/(1 - ll4) - 1
ll5 = 1/(1 - ll5) - 1
ll6 = 1/(1 - ll6) - 1
ll7 = 1/(1 - ll7) - 1
ll = ll1*ll2*ll3*ll4*ll5*ll6*ll7
ll = 1 - 1/(ll + 1)
ENDIF
IF (ss < 0)
ss = 0
ELSEIF (ss > 1)
ss = 1
ENDIF
IF (ll < 0)
ll = 0
ELSEIF (ll > 1)
ll = 1
ENDIF
IF (hh > 5.999)
hh = 0
ENDIF
#color = hsl(hh,ss,ll)
ELSE
hh = hue(c1)
IF (hh > 2)
hh = hh + 2
ELSE
hh = hh * 2
ENDIF
h0h = hue(c7)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
hh = (hh + h0h)%8
hh = (hh/4)*#pi
sc1 = sat(c1)
sc7 = sat(c7)
IF (sc1 > 0.99)
sc1 = 0.99
ENDIF
IF (sc7 > 0.99)
sc7 = 0.99
ENDIF
sc1 = 1/(1 - sc1) - 1
sc7 = 1/(1 - sc7) - 1
ss = sc1*sc7
ss = 1 - 1/(ss + 1)
float ll1 = lum(c1)
float ll7 = lum(c7)
IF (ll1 == 1.0 || ll2 == 1.0 || ll3 == 1.0 || ll4 == 1.0 || ll5 == 1.0 || ll7 == 1.0)
ll = 1.0
ELSE
ll1 = 1/(1 - ll1) - 1
ll2 = 1/(1 - ll2) - 1
ll3 = 1/(1 - ll3) - 1
ll4 = 1/(1 - ll4) - 1
ll5 = 1/(1 - ll5) - 1
ll7 = 1/(1 - ll7) - 1
ll = ll1*ll2*ll3*ll4*ll5*ll7
ll = 1 - 1/(ll + 1)
ENDIF
IF (ll < 0)
ll = 0
ELSEIF (ll > 1)
ll = 1
ENDIF
IF (@mmode == 0)
rgp1 = (cos(hh)*ss + 1)/2
byp1 = (sin(hh)*ss + 1)/2
h0h = hue(c6)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c6)
rgp0 = (cos(h0h)*s0s + 1)/2
byp0 = (sin(h0h)*s0s + 1)/2
ll6 = lum(c6)
IF (rgp0 > 0.997)
rgp0 = 0.997
ENDIF
IF (byp0 > 0.997)
byp0 = 0.997
ENDIF
IF (ll6 > 0.997)
ll6 = 0.997
ENDIF
IF (rgp1 > 0.997)
rgp1 = 0.997
ENDIF
IF (byp1 > 0.997)
byp1 = 0.997
ENDIF
IF (ll > 0.997)
ll = 0.997
ENDIF
rgp0 = 1/(1 - rgp0) - 1
byp0 = 1/(1 - byp0) - 1
ll6 = 1/(1 - ll6) - 1
rgp1 = 1/(1 - rgp1) - 1
byp1 = 1/(1 - byp1) - 1
ll = 1/(1 - ll) - 1
rg = (1 - 1/(rgp0*rgp1 + 1))*2 - 1
by = (1 - 1/(byp0*byp1 + 1))*2 - 1
lm = 1 - 1/(ll6*ll + 1)
rgby = rg + (0,1)*by
h0h = atan2(rgby)*4/#pi
IF (h0h < 0)
h0h = h0h + 8
ELSEIF (h0h > 8)
h0h = h0h - 8
ENDIF
IF (h0h < 4)
h0h = h0h/2
ELSE
h0h = h0h - 2
ENDIF
s0s = cabs(rgby)
IF (s0s > 1.0)
s0s = 1.0
ENDIF
IF (lm < 0.0)
lm = 0.0
ENDIF
IF (lm > 1.0)
lm = 1.0
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
#color = hsl(h0h,s0s,lm)
ELSE
float aa = alpha(c6)
float omaa = 1 - aa
IF (@mmode == 2)
rgp1 = cos(hh)*ss
byp1 = sin(hh)*ss
h0h = hue(c6)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
h0h = (h0h/4)*#pi
s0s = sat(c6)
rgp0 = cos(h0h)*s0s
byp0 = sin(h0h)*s0s
ll6 = lum(c6)
rg = rgp0*aa + rgp1*omaa
by = byp0*aa + byp1*omaa
lm = ll6*aa + ll*omaa
rgby = rg + (0,1)*by
h0h = atan2(rgby)*4/#pi
IF (h0h < 0)
h0h = h0h + 8
ELSEIF (h0h > 8)
h0h = h0h - 8
ENDIF
IF (h0h < 4)
h0h = h0h/2
ELSE
h0h = h0h - 2
ENDIF
s0s = cabs(rgby)
IF (s0s > 1.0)
s0s = 1.0
ENDIF
IF (lm < 0.0)
lm = 0.0
ENDIF
IF (lm > 1.0)
lm = 1.0
ENDIF
IF (h0h > 5.999)
h0h = 0
ENDIF
#color = hsl(h0h,s0s,lm)
ELSE
h0h = hue(c6)
IF (h0h > 2)
h0h = h0h + 2
ELSE
h0h = h0h * 2
ENDIF
hh = (hh + h0h)%8
IF (hh < 4)
hh = hh/2
ELSE
hh = hh - 2
ENDIF
ss = sat(c6)*aa + ss*omaa
ll = lum(c6)*aa + ll*omaa
IF (hh > 5.999)
hh = 0
ENDIF
#color = hsl(hh,ss,ll)
ENDIF
ENDIF
ENDIF
default:
title = "Multiwave Mandelbrot Coloring 2 Beta"
param power
caption = "Exponent"
default = (2,0)
hint = "This should be set to match the exponent of the \
formula you are using. For Mandelbrot, this is 2. \
Only needed when coloring divergent points."
endparam
color param c1a
caption = "Hue 1A"
default = rgb(130/255,91/255,40/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c2a
caption = "Hue 2A"
default = rgb(186/255,153/255,102/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c3a
caption = "Hue 3A"
default = rgb(248/255,114/255,12/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c4a
caption = "Hue 4A"
default = rgb(74/255,0,0)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
param hfreq1
caption = "Short hue shift period (iters)"
default = 530.0
hint = "Changes the period of the short hue modification cycle. Early in the long cycle it will cycle among the four colors above."
endparam
color param c1b
caption = "Hue 1B"
default = rgb(77/255,49/255,19/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c2b
caption = "Hue 2B"
default = rgb(195/255,179/255,131/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c3b
caption = "Hue 3B"
default = rgb(231/255,227/255,23/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c4b
caption = "Hue 4B"
default = rgb(240/255,164/255,0)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c1c
caption = "Hue 1C"
default = rgb(0,72/255,16/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c2c
caption = "Hue 2C"
default = rgb(133/255,146/255,128/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c3c
caption = "Hue 3C"
default = rgb(179/255,220/255,72/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c4c
caption = "Hue 4C"
default = rgb(243/255,224/255,83/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c1d
caption = "Hue 1D"
default = rgb(24/255,23/255,103/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c2d
caption = "Hue 2D"
default = rgb(144/255,143/255,163/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c3d
caption = "Hue 3D"
default = rgb(64/255,153/255,192/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c4d
caption = "Hue 4D"
default = rgb(31/255,173/255,131/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c1e
caption = "Hue 1E"
default = rgb(120/255,22/255,22/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c2e
caption = "Hue 2E"
default = rgb(177/255,129/255,130/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c3e
caption = "Hue 3E"
default = rgb(189/255,65/255,68/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param c4e
caption = "Hue 4E"
default = rgb(33/255,31/255,79/255)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
param hfreq2
caption = "Long hue shift period (iters)"
default = 5147.0
hint = "Changes the period of the long hue modification cycle."
endparam
color param cx
caption = "Overlay bias color 1"
default = hsl(0,0.5,0.5)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param cy
caption = "Overlay bias color 2"
default = hsl(0,0.5,0.7)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
color param cz
caption = "Overlay bias color 3"
default = hsl(5,0.97,0.3)
hint = "Altering these hues will alter the way the gradient is modified."
endparam
param sfreq
caption = "Overlay bias period (iters)"
default = 82117.0
hint = "Changes the period of the overlay bias cycle."
endparam
param smode
caption = "Overlay bias mode"
enum = "saturation bias" "hsl bias"
default = 1
hint = "Luminances adjust luminance of colors above; in saturation bias mode hue/saturation adjusts saturation. Hues matching this hue are unchanged, hues opposite have their saturation reduced the higher this color's saturation. The effect is to suppress opposite hues; set this to saturated red to suppress green for example. Neutral grey has no effect. In hsl bias mode 8-fold hsl addition is used instead."
endparam
param spow
caption = "Overlay bias sensitivity"
default = 4.0
visible = (@smode == 0)
min = 0.01
hint = "Higher values narrow the range of hues desaturated; lower ones widen the range. 2 and 0.5 have opposite effects."
endparam
param rseed
caption = "Random color shift seed"
default = 57135488
hint = "Different values result in different random color shifts."
endparam
param rstart
caption = "Random color shift start (iters)"
default = 300000.0
hint = "Random color shifts start after this many iterations."
endparam
param rlen
caption = "Random color shift period (iters)"
default = 300000.0
hint = "Random color shift color spacing."
endparam
param rlum
caption = "Random color shift luminance range"
default = 0.2
min = 0.0
hint = "Limits amplitude of luminance biases caused by random color shift."
endparam
param rhvmax
caption = "Random color shift hue variability"
default = 2.0
min = 0.2
max = 8.0
hint = "Limits how wildly random color shift can shift hues. 2.0 allows a 90 degree rotation of saturated colors over one period. Less saturated, dark, and pale colors can vary in hue somewhat more."
endparam
param lfreq
caption = "First luminance shift period (iters)"
default = 17.0
hint = "Changes the period of the first luminance modification cycle. The four colors of the short cycle will change gradually to the second set of four, then the third, then the fourth, before returning."
endparam
param lmag
caption = "First luminance shift amplitude"
default = 0.2
min = 0.0
max = 1.0
hint = "Changes the amplitude of the first luminance modification cycle."
endparam
param lphase
caption = "First luminance shift phase"
default = 0.0
min = 0.0
max = 1.0
hint = "Changes the phase of the first luminance modification cycle."
endparam
param lfreq2
caption = "Second luminance shift period (iters)"
default = 94.0
hint = "Changes the period of the second luminance modification cycle."
endparam
param lmag2
caption = "Second luminance shift amplitude"
default = 0.4
min = 0.0
max = 1.0
hint = "Changes the amplitude of the second luminance modification cycle."
endparam
param lphase2
caption = "Second luminance shift phase"
default = 0.2
min = 0.0
max = 1.0
hint = "Changes the phase of the second luminance modification cycle."
endparam
param lfreq3
caption = "Third luminance shift period (iters)"
default = 2544.0
hint = "Changes the period of the third luminance modification cycle."
endparam
param lmag3
caption = "Third luminance shift amplitude"
default = 0.6
min = 0.0
max = 1.0
hint = "Changes the amplitude of the third luminance modification cycle."
endparam
param lphase3
caption = "Third luminance shift phase"
default = 0.8
min = 0.0
max = 1.0
hint = "Changes the phase of the third luminance modification cycle."
endparam
param lfreq4
caption = "Fourth luminance shift period (iters)"
default = 18544.0
hint = "Changes the period of the fourth luminance modification cycle."
endparam
param lmag4
caption = "Fourth luminance shift amplitude"
default = 0.6
min = 0.0
max = 1.0
hint = "Changes the amplitude of the fourth luminance modification cycle."
endparam
param lphase4
caption = "Fourth luminance shift phase"
default = 0.0
min = 0.0
max = 1.0
hint = "Changes the phase of the fourth luminance modification cycle."
endparam
param mmode
caption = "Primary gradient merge mode"
enum = "rgby bias" "hsl bias" "rgby blend" "hsl blend"
default = 1
hint = "Affects how the gradient is applied to the color ripples; the blend options use the gradient's alpha."
endparam
param fit
caption = "Fit Gradient to Range"
default = true
hint = "Check this to spread the gradient out over the range of iteration values."
endparam
param fittimes
caption = "Number of repetitions"
default = 1.0
min = 1.0
hint = "Repeats gradient the specified number of times over the range of iteration values."
endparam
param fitminit
caption = "Start iteration"
default = 1.0
min = 1.0
hint = "Gradient begins at this iteration number. It is best if it's approximately the lowest \
actual number of iterations in the image. You can find the exact number by looking at \
Statistics after generating the image once."
endparam
param fitmaxit
caption = "End iteration"
default = 1000.0
min = 1.0
hint = "Gradient fitting is based on this range of iterations. Can be profitably made lower than \
maxiter -- try reducing it by factors of 10 until the gradient doesn't fit well, then raise \
it by a factor of 10 once."
endparam
param transfer
caption = "Super transfer function"
enum = "Linear" "Power" "Log"
default = 2
hint = "Linear distributes gradient evenly over iterations. \
Power weights gradient towards lower iterations for powers > 1. \
Log weights gradient towards lower iterations."
endparam
param transpower
caption = "Transfer power"
default = 3.0
hint = "Larger values weight gradient more towards low iterations. \
3.0 with a regular transfer function of Linear and a super transfer \
function of Linear with a regular transfer function of CubeRoot \
produce the same results."
visible = (@transfer == 1)
endparam
param bailout
caption = "Bail-out value"
default = 100000.0
hint = "Larger gives smoother coloring for divergent points, and more accurate and smoother for convergent ones."
min = 1
endparam
param displacement
caption = "Displacement"
default = 0.0
hint = "Skips the first N iterations of the color gradient, effectively shifting the whole color scheme to lower iterations as a block. Use this for testing."
min = 0.0
endparam
param rescale
caption = "Rescaling"
default = 1.0
hint = "Compresses the entire color gradient by this factor, after application of displacement. Use this for testing."
min = 1.0
endparam
}