// Entry code: qsvluk // Name : Mikael Pohjola // Frame rate: 10 #local c=clock; //Abbreviate the clock keyword //A macro creating a gradient in a certain direction, with the corresponding r, g, or b color (used to create one of the rgb component gradients for the colorcube) #macro p(a) [gradient x rotate a*90 color_map { [0 rgb 0] [1 rgb 3*vrotate(x,90*a)] //observe how the corresponging color is obtained by rotating the x-vector }] #end //A macro for the bouncing cube (with the abs and mod functions it changes directions when it "hits the walls") #macro l(a,b) abs(mod(a*c+b, 2)-1) #end //Union of the big colorcube and the black-white cylinder union { box { 0.01-z, 1 //Big colorcube (need to translate by 0.01 to avoid the discontinuity of the pigment) } cylinder { //Black-white cylinder running through the middle of the cube 0,1 0.01 } pigment { //The pigment of the colorcube r, g and b gradients in each coordinate axis average pigment_map { p(0) //Gradient created by the macro p(z) p(-y) } } translate 0.5*(z-x-y) //Translate so that the origin is in the center of the cube scale 1.1 //Scale so that the camera fits into the cube hollow } //Lightsource that looks like a cube light_source { 90 //Lighsource bounces around fade_power 2 //Set fade power to get the lightsource to light up nearby region of the cube fade_distance 0.05 looks_like { box { -0.05, 0.05 rotate <18,9>*c*40 finish { reflection 1 //The cube has no pigment, but reflects the big colorcube color } } } translate 0.5*(z-x-y) }