|
|
You might also be interested in a completely different way of producing a spiral
image:
https://swiftcoder.wordpress.com/2010/06/21/logarithmic-spiral-distance-field/
I though the fading effect was pretty cool. I don't understand it yet, but I
got it to work after fixing something positively ridiculous.
Just thought I'd post it here since it's such a radically different way of
visualizing it.
#version 3.7;
//------------------------------------------
// SDL for spiral distance field
// Bill Walker - October 2017
//------------------------------------------
global_settings {assumed_gamma 1}
#include "colors.inc"
#include "consts.inc"
light_source { <-1,8,2> color White}
camera {
orthographic
location <0, 0, -100>
look_at <0, 0, 0>
right x*image_width
up y*image_height
}
plane {z, 1 pigment {checker Gray20, White} scale 10}
light_source {<0, 10, -500> color White*0.5}
#macro Spiral (X, Y)
#declare a=1;
#declare b=0.5;
// calculate the target radius and theta
#local R = sqrt (X*X +Y*Y);
// early exit if the point requested is the origin itself
// to avoid taking the logarithm of zero in the next step
#if (R = 0)
0
#else
#local T = atan2 (Y, X);
// calculate the floating point approximation for n
#local n = (log(R/a)/b - T)/(tau);
// find the two possible radii for the closest point
#local upper_r = a * pow(e, b * (T + tau*ceil(n)));
#local lower_r = a * pow(e, b * (T + tau*floor(n)));
// return the minimum distance to the target point
min (abs(upper_r - R), abs(R - lower_r))
#end
#end
#for (i, -image_width/2, image_width/2)
#for (j, -image_height/2, image_height/2)
box { -0.5, 0.5 translate <i, j, 0> pigment {color rgb min(1, Spiral(i, j)/255
)} }
#end
#end
Post a reply to this message
|
|