// Persistence of Vision Ray Tracer Scene Description File // File: bubbles.pov // Vers: 3.5 // Desc: Soap Bubbles // Date: Thu Nov 6 11:48:21 GMT 2003 // Auth: Bill Hails // #include "colors.inc" sky_sphere { pigment { image_map { jpeg "dscf0199.jpg" } scale 2 translate -1 } rotate 180 * y } #local BoxSize = 5; box { <-BoxSize * 4/3, -BoxSize, 10>, texture { pigment { Black } } finish { ambient 0 diffuse 0 } } #local T_Bubble = texture { pigment { colour rgbt<1, 1, 1, 1> } finish { ambient 0.05 diffuse 0.6 reflection { 0.27 } irid { 0.30 thickness 0.5 turbulence 0.5 } } } #macro Bubble(R) sphere { <0, 0, 0>, R texture { T_Bubble } } #end #local IntersectDistance = function(D, R1, R2) { (pow(D,2) - pow(R2,2) + pow(R1,2))/(2*D) } #local IntersectRadius = function(D, R1, R2) { (sqrt(4*pow(D,2)*pow(R1,2) - pow(pow(D,2)-pow(R2,2)+pow(R1,2),2)) / (2*D)) } #macro DoubleBubble(R1, R2, D1) #if (D1 > (R1 + R2)) #error "spheres do not intersect" #end #local D2 = IntersectDistance(D1, R1, R2); #local R3 = IntersectRadius(D1, R1, R2); union { sphere { 0, R1 bounded_by { box { -R1, } } clipped_by { bounded_by } } disc { , x, R3 } sphere { , R2 bounded_by { box { , } } clipped_by { bounded_by } } texture { T_Bubble } } #end #local Bulb = sphere { <0, 0, 0>, 1 pigment { White } finish { ambient 20 } } // object { Bubble(1) translate <0, 0, 4> } // object { Bubble(0.5) translate <-3, 1, 6> } // object { DoubleBubble(1, 0.8, 0.8) rotate <0, 0, 0> translate <0, 0, 4> } object { Bubble(0.4) translate <0, 0, 5> } object { Bubble(0.3) translate <-0.2, 1.7, 4.5> } object { DoubleBubble(0.30, 0.24, 0.24) rotate <-20, -130, 0> translate <-1.8, 1.4, 4.7> } object { DoubleBubble(0.50, 0.40, 0.40) rotate <0, 10, 10> translate <0.1, -1, 3.5> } object { Bubble(0.4) translate <0.6, 1.1, 0> } object { Bubble(0.6) translate <-2.8, 1.7, 9> } object { Bubble(0.2) translate <2.5, -1.5, 5> } object { Bubble(0.3) translate <-2.1, -1.6, 3> } object { Bubble(0.35) translate <2.2, 1.3, 4> } object { Bubble(0.36) translate <2.6, -0.3, 3.6> } object { Bubble(0.37) translate <-0.3, -1.4, -1.6> } object { Bulb translate <-16, 10, -4> } light_source { <0, 0, 0> White } light_source { <-BoxSize * 4/3, -BoxSize, 9.999> White } camera { location <0, 0, -10> look_at <0, 0, 5> angle 23 focal_point <0, 0, 5> aperture 0.6 blur_samples 30 }