|
![](/i/fill.gif) |
Hi Yagar,
Reminds me of something I did quite a while ago:
http://www.outerarm.demon.co.uk/graphics/fractal_sphere_640x480.jpg
The code is a pretty simple recursive macro, but I never quite bothered to
sort out if I was going back on myself, so the code drew far more spheres
than it needed. Code attached...
Cheers,
Ian.
http://www.outerarm.demon.co.uk/graphics/graphics.html
#version 3.1;
#include "colors.inc"
#include "textures.inc"
#include "metals.inc"
#include "stones.inc"
#macro draw_next (your_centre, your_size, your_dir, my_dir, iterations)
// #if (my_dir != (your_dir * <-1, -1, -1>))
#local my_size = your_size / 2;
#local temp = my_size + your_size;
#local my_centre = your_centre + (<temp,temp,temp> *
my_dir);
#local next_iterations = iterations - 1;
sphere {my_centre, my_size pigment {P_Chrome3} finish
{F_MetalC}}
#if (next_iterations > 0)
draw_next (my_centre, my_size, my_dir, x,
next_iterations)
draw_next (my_centre, my_size, my_dir, -x,
next_iterations)
draw_next (my_centre, my_size, my_dir, y,
next_iterations)
draw_next (my_centre, my_size, my_dir, -y,
next_iterations)
draw_next (my_centre, my_size, my_dir, z,
next_iterations)
draw_next (my_centre, my_size, my_dir, -z,
next_iterations)
#end
// #end
#end
camera
{
location <3.8, 3.8, -3.8>
look_at <0,0,0>
}
sky_sphere
{
pigment
{
gradient y
color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
}
}
background {Black}
light_source
{
<0, 5, -10>
color rgb 1.0
// area_light
// <1, 0, 0> <0, 0, 1>
// 7, 7
// jitter
}
plane
{
y, -2
texture
{
checker texture {T_Stone31 finish {reflection .3}},
texture {T_Stone15 finish {reflection .3}}
scale 3 //rotate y*45
}
}
//draw_next (0, 2, y, 0, 7)
draw_next (0, 2, y, 0, 2)
Post a reply to this message
|
![](/i/fill.gif) |