// POV-Ray test: are halos transparent // Last edited on 2010-03-30 19:27:16 by stolfi // Moral of story: Merge/union of objects with interior // does not work properly. The interior must be crafted for the // final shape of objects and applied to the merged object. global_settings { max_trace_level 10 } #declare bgDepth = 10; #declare len = 5.0; // Length of cylinder #declare haf = len/2; // ---------------------------------------------------------------------- // TEXTURES AND INTERIORS #declare tx_none = texture{ pigment{ color rgb <1,1,1> transmit 1 } finish { ambient 0 diffuse 0 } } #declare gcor = <0.2, 1.0, 0.5>; // Color of glow. // Interior with a cylindrical glow that decays linearly #declare in_neon_cyl = interior{ media{ emission rgb 0.8*gcor density{ cylindrical rotate 90*z } } } // Interior with a cylindrical glow that decays quadratically #local mag = (len+2)/2; #declare in_neon_bar = interior{ media{ emission rgb 0.8 density{ cylindrical rotate 90*z } density{ spherical color_map{ [0.00 rgb <0,0,0>] [0.60/mag rgb 0.80*gcor] [0.80/mag rgb 0.95*gcor] [1.00/mag rgb 1.00*gcor] [1.00 rgb 1.00*gcor] } scale mag } } } // Interior with uniform glow #declare in_neon_sph = interior{ media{ emission rgb 0.4*gcor } } // ---------------------------------------------------------------------- // OBJECTS // A glow cloud of radius 1 at the origin #declare neon_sph = difference{ sphere{ <0,0,0>, 1 } sphere{ <-1/3,0,0>, 1/3 } hollow texture{ tx_none } interior{ in_neon_sph } } // A glow stick of radius 1 and length {len} along the X-axis #declare neon_cyl = difference{ merge{ sphere{ <-haf,0,0>, 1 } cylinder{ <-haf,0,0>, <+haf,0,0>, 1 } sphere{ <+haf,0,0>, 1 } } sphere{ <-haf,0,0>, 0.5 } hollow texture{ tx_none } interior{ in_neon_cyl } } // A glow stick of radius 1 and length {len} along the X-axis with compound glow #declare neon_bar = difference{ merge{ sphere{ <-haf,0,0>, 1 } cylinder{ <-haf,0,0>, <+haf,0,0>, 1 } sphere{ <+haf,0,0>, 1 } } sphere{ <-haf,0,0>, 0.5 } hollow texture{ tx_none } interior{ in_neon_bar } } // ---------------------------------------------------------------------- // A pair of merged solid spheres with single interior #declare neon_mol_merge_sng = merge{ sphere{ <-0.4,0,0>, 1 } sphere{ <+0.4,0,0>, 1 } hollow texture{ tx_none } interior{ in_neon_cyl } } // A pair of united solid spheres with single interior #declare neon_mol_union_sng = union{ sphere{ <-0.4,0,0>, 1 } sphere{ <+0.4,0,0>, 1 } hollow texture{ tx_none } interior{ in_neon_cyl } } // ---------------------------------------------------------------------- // A pair of merged hollow spheres with single interior #declare neon_mol_merge_hol = merge{ sphere{ <-0.4,0,0>, 1 hollow } sphere{ <+0.4,0,0>, 1 hollow } texture{ tx_none } interior{ in_neon_cyl } } // A pair of united hollow spheres with single interior #declare neon_mol_union_hol = union{ sphere{ <-0.4,0,0>, 1 hollow } sphere{ <+0.4,0,0>, 1 hollow } texture{ tx_none } interior{ in_neon_cyl } } // ---------------------------------------------------------------------- // A pair of merged hollow spheres with separate interiors #declare neon_mol_merge_sep = merge{ object{ neon_sph translate -0.4*x } object{ neon_sph translate +0.4*x } } // A pair of united hollow spheres with separate interiors #declare neon_mol_union_sep = union{ object{ neon_sph translate -0.4*x } object{ neon_sph translate +0.4*x } } // ---------------------------------------------------------------------- // Floor plane: #declare ground = plane{ z, -bgDepth pigment{ checker color rgb <0.03, 0.03, 0.03> color rgb <0.05, 0.05, 0.05> scale 0.5 rotate 27*z } finish{ diffuse 0.2 ambient 0.8 } } #local dy = 2.5; #local dx = 0.75*len; // Scene: #declare scene = union{ object{ neon_sph translate +3*dy*y translate -0.75*dx*x } object{ neon_cyl translate +2*dy*y } object{ neon_bar translate +1*dy*y } object{ neon_mol_merge_sng translate 00*dy*y translate -0.75*dx*x } object{ neon_mol_union_sng translate 00*dy*y translate +0.75*dx*x } object{ neon_mol_merge_hol translate -1*dy*y translate -0.75*dx*x } object{ neon_mol_union_hol translate -1*dy*y translate +0.75*dx*x } object{ neon_mol_merge_sep translate -2*dy*y translate -0.75*dx*x } object{ neon_mol_union_sep translate -2*dy*y translate +0.75*dx*x } } object{ scene } object{ ground translate -bgDepth*z } light_source{ <100,400,100> color rgb 0.2*<1,1,1> } #local smin = min_extent(scene); #local smax = max_extent(scene); #local cam_focus = (smin + smax)/2; #local cam_dir = z; #local cam_dist = 10*len; #local cam_wd = 1.1*(smax.x - smin.x); #local cam_ht = 1.1*(smax.y - smin.y); #debug concat("cam wd = ", str(cam_wd,12,6), " ht = ", str(cam_ht,12,6), "\n") #if (cam_wd/image_width > cam_ht/image_height) #local cam_ht = cam_wd*(image_height/image_width); #else #local cam_wd = cam_ht*(image_width/image_height); #end camera { perspective location cam_focus + cam_dist*cam_dir right -cam_wd/cam_dist*x up cam_ht/cam_dist*y sky y look_at cam_focus }