// Glass sculpture // --------------- // Entry for the 4th POV-Ray Short Code Contest // Note: If you want to render faster, see the end of the file. global_settings { photons { count 1e6 } // This macro is embedded here to save 1 character (at the end of the // last #end of the macro, where the last } of the global_settings can // be put immediately after the #end). // The parameters are the object color and the loop counter. #macro C(P, N) // This trick saves writing 'pigment' twice in the code, plus it // gives the plane the same reflection and phong as the spheres, // which is cool: pigment { rgbf P } finish { ior 1.5 reflection .3 phong 2} } #if(N) sphere { .5 photons { target refraction 1 } // Note that the sphere block is closed in the next iteration, // in which it also gets its pigment and finish. // Start the next iteration, calling the macro recursively, // changing the color to the one of the spheres: C(1 N-1) #end #end } // global_settings end merge { plane { y, -1 // The plane block will be closed in the macro C(<1, .7, .5> 70) rotate -x*9 } light_source { 9, 1 area_light z*2 y, 9, 5 // Uncomment the following line for faster rendering: //adaptive 1 }