Still having all these super graphical ones in my system… Less comments this time around.
Square dots/Lines
# SeExpr script to draw tiled squares not unlike screentones.
# We'd ideally work this one out further so it'll have the lines be less canvas-
# size based and more 'per so many pixels' or something.
# [$u, $v, 0] is a vector constructed from the proportional horizontal and
# vertical positions ($u and $v) of the output pixel and 0 as the Z-value.
# We multiply the proportional vertical by the ratio we can get from the height
# and width of the image, so that our computed shapes are in a square aspect
# ratio, they'd get streched otherwise.
$ratiov = $h / $w;
$uv = [$u, $v * $ratiov, 0];
# These are all the configurable variables. There's no reason why they're all
# assembled here besides making it easier to read the script. Values inside the
# comments are used by SeExpr widgets to determine the upper and lower limits.
$radius = 0.33; #0.0, 1.0
$lines = 27; #1, 300
$size = $lines;
$angle = 122; #0, 359
$softness = 0.4006; #0.001, 1.0
$color1 = [0,0,0];
$color2 = [1,1,1];
# Tiling part.
# ------------
# we'll construct the position of the current pixel
# in a pattern from the $uv
$tiles = $uv * size;
$repeat = boxstep(1 , fmod( $tiles[1], 1.0) );
# reassemble the tiled vector;
$tiles = [ $tiles[0] + $repeat, $tiles[1], 0];
# Now we rotate the tiled vector, 2d rotation uses the z-axis, that's [0, 0, 1].
$tiles = rotate($tiles, [0, 0, 1], rad($angle));
# Here we remove the offset from the tiled vector.
$tiles -= floor($tiles);
# square determining part
# -----------------------
# we're computing a 'distance field' here.
$fac = remap($tiles[0], .5, 0.5*$radius, 1*$softness, 2);
# comment out the following to make this a lines-script.
$fac *= remap($tiles[1], .5, 0.5*$radius, 1*$softness, 2);
# filling the shape
# -----------------
$color = ccurve($fac, 0, $color2, 4, 1, $color1, 4);
# and we return the color
$color
Truchet
Classic
$ratiov = $h/$w;
$uv = [$u, $v*$ratiov, 0];
$scale2 = 10; #0,50
$color1 = [0,0,0];
$color2 = [1,1,1];
$celval = cellnoise($uv*$scale2);
#circle determining part
$distance = ($uv*$scale2);
$angle = floor($celval*4)*90;
$distance = rotate($distance, [0,0,1], rad($angle));
$distance -= floor($distance);
$dotproduct = (distance[0]+distance[1]);
$fac = smoothstep(.999, 1.001, $dotproduct);
$color = $color2;
if ($fac>0) {
$color = ccurve($fac,0,$color1,4,1,$color2,4);
}
$color
Maze
$ratiov = $h/$w;
$uv = [$u, $v*$ratiov, 0];
$scale2 = 10; #0,50
$color1 = [0,0,0];
$color2 = [1,1,1];
$celval = cellnoise($uv*$scale2);
$distance = ($uv*$scale2);
$angle = floor($celval*4)*90;
$distance = rotate($distance, [0,0,1], rad($angle));
$distance -= floor($distance);
$dotproduct = (distance[0]+distance[1]);
$border = 0.01;
$fac = smoothstep(1-$border, 1.0, $dotproduct);
$fac += smoothstep(1+$border, 1.0, $dotproduct);
$color = ccurve($fac,0,$color1,4,1,$color2,4);
$color
Halfround:
$ratiov = $h/$w;
$uv = [$u, $v*$ratiov, 0];
$scale2 = 10; #0,50
$color1 = [0,0,0];
$color2 = [1,1,1];
$celval = cellnoise($uv*$scale2);
$distance = ($uv*$scale2);
$angle = floor($celval*4)*90;
$distance2 = rotate($distance, [0,0,1], rad($angle+180));
$distance = rotate($distance, [0,0,1], rad($angle));
$distance -= floor($distance);
$distance2 -= floor($distance2);
$dotproduct = dot($distance,$distance)*4;
$dotproduct2 = dot($distance2,$distance2)*4;
$border = 0.05;#0, .21
$lowerBorder = 1-$border;
$upperBorder = 1+$border;
$fac = gaussstep($lowerBorder, 1.0, $dotproduct);
$fac += gaussstep($upperBorder, 1.0, $dotproduct);
$fac += gaussstep($lowerBorder, 1.0, $dotproduct2);
$fac += gaussstep($upperBorder, 1.0, $dotproduct2);
$color = ccurve(1-$fac,0.0,$color1,4,1,$color2,4);
$color

