POV-Ray : Newsgroups : povray.text.scene-files : fractal kaleidoscope : fractal kaleidoscope Server Time
28 Jul 2024 14:26:00 EDT (-0400)
  fractal kaleidoscope  
From: Dean Wheeler
Date: 27 Feb 2000 02:39:59
Message: <38b8d4cf@news.povray.org>
// If you like fractals, chaos theory, stained-glass windows, or
kaleidoscopes,
// you will love this one....  Don't worry, it renders pretty fast.
//
//
// fractalballs.pov
//
//
/* POVray scene file by Dean Wheeler, 26 Feb 2000,
whe### [at] uclink4berkeleyedu
Background:  This scene replicates a photo on the cover of the Dec. 1999
issue
of "The Physics Teacher", published by the American Assoc. of Physics
Teachers.
(No, I'm not a physics teacher, but this IS a cool magazine.)  Anyway, this
scene
illustrates CHAOTIC SCATTERING of light, i.e. it generates a light FRACTAL.
Because of the limitations of caustics in POVray, it was necessary to modify
the
sources of light and material properties to replicate the effect achievable
in
real life.  However, in some ways POVray surpassed what is achievable in
(geometrically imperfect) real life...

Here is the geometric setup in real life:
 (1) Four white mirrored spheres are stuck together in a tetrahedral or
     triangular pyramid formation.  Between any three of the spheres there
is an
     opening which goes into the "central cavity."  There are four such
openings,
     corresponding to the four faces of a triangular pyramid.  In real life,
such
     a set-up can be accomplished using four silver Christmas-tree
ornaments.
 (2) Three of the openings are respectively covered with a filter each of a
     different color.  Lights are set up outside to direct light into the
central
     cavity through the three colored filters. A minimal amount of ambient
light
     enters the fourth opening.
 (3) The viewer observes through the fourth opening the fractal pattern
created
     in the central cavity.

For POVray, I instead use one bright light coincident with the camera.  This
light
has THE EFFECT OF illuminating the three "filters"--which are opaque--from
the
inside.  The color that the camera sees at any location in the cavity
indicates,
for a ray shot from the camera to that location, which of the four openings
the
ray exits (black indicates the fourth opening).  As indicated by the fractal
nature of the pattern, a finite-sized ray (e.g. a laser beam) shot at any of
the
boundaries between colors would exit all four openings simultaineously,
hence the
term CHAOTIC SCATTERING.

By playing around with the light-source location(s), material properties,
etc.,
some interesting variations can be created.  The default pattern here is a
good
starting point...
*/

global_settings { assumed_gamma 2.2 ambient_light 1 max_trace_level 25}
#declare ri3 = 1/sqrt(3);
#declare ri6 = 1/sqrt(6);
#declare v1=<1,-ri3,-ri6>;
#declare v2=<-1,-ri3,-ri6>;
#declare v3=<0,2*ri3,-ri6>;
#declare v4=<0,0,3*ri6>;
// j alters the surface normals of the colored filters;  try -5<j<5
#declare j=1;
// k alters the position and size of filters;  try 0.5<k<2
#declare k=1;

#camera {location -1.4*v4
         angle    65
         look_at  <0,-0.15,0>
        }
light_source {-1.4*v4 color rgb 3 shadowless}
/* location <0,0,0> is the center of the cavity
   vectors v1..v4 are centers of the spheres
   use them as basis vectors for placing other objects in the scene */
#declare tetrahedron = union {sphere {v1, 1 }
                              sphere {v2, 1 }
                              sphere {v3, 1 }
                              sphere {v4, 1 }
                              finish {ambient 0.03
                                      diffuse 0
                                      reflection 0.95}
                              pigment {color rgb<1,1,1>} }
#declare filters = union {smooth_triangle {v1,j*v1-v2,v3,j*v3-v2,v4,j*v4-v2
                                           pigment{color rgb<0,0.5,0.4>}}
                          smooth_triangle {v1,j*v1-v3,v2,j*v2-v3,v4,j*v4-v3
                                           pigment{color rgb<0.8,0.8,0.8>}}
                          smooth_triangle {v2,j*v2-v1,v3,j*v3-v1,v4,j*v4-v1
                                           pigment{color rgb<0.8,0,0>}} }
object {tetrahedron}
object {filters scale k}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.