Hi all,
Here’s a version of a fractal variation that i’ve found at shadertoy and adapted to Blender OSL:
All is due to the shoulders of the giants we are standing on.
shader IndrasF(
float ITER = 12,
float SCALE = -2.25,
float Fact = 2.0,
vector CSize = vector(1.3, 1.7, 1.3),
output closure color CL = holdout()
) {
float m r= 0.25, mxr = 1.2;
float pFractal(point P) {
float scale = 1.0;
vector p = vector(P[0], P[2], P[1]);
p*=SCALE/clamp(dot(p,p),mr,mxr);
for(int i = 0; i < ITER; i++) {
p = 2.0*clamp(p, -CSize, CSize) - p;
float r2 = dot(p,p);
float k = max((2.)/(r2), .027);
p *= k;
scale *= k;
}
float l = length(p) - 3.5;
float rxy = l - 2.0;
float n = l * p[2];
rxy = max(rxy, -(n) / 2.);
return (rxy) / abs(scale);
}
float fractal = pFractal(I * Fact);
float fractal_glow = pFractal(P*Fact);
float fractal_cross = pFractal(cross(I,P)*Fact);
CL = emission() * color(clamp(fractal, .0,1), .0, .0)*20+emission()*color(.0, clamp(pow(fractal*2, 2.), .0, .02), .0);
return;
}
One of the results may be:
But there’s alot to be discovered with this one.
Cheers!
Add images