// Water glass creating rainbox on floor by dispersion of sunlight // // Copyright (C) 2009 by Christian Fröschlin, www.chrfr.de #default {finish {ambient 0}} #include "colors.inc" #include "metals.inc" #include "stones.inc" #include "strings.inc" #include "shapes.inc" #include "rand.inc" #include "woods.inc" #include "rad_def.inc" #include "functions.inc" #declare USE_RADIOSITY = on; #declare USE_PHOTONS = on; #declare USE_AREA_LIGHT = on; #declare USE_FILL_LIGHT = on; #declare USE_GLASS = on; #declare USE_WINDOW = on; #declare USE_PLANT = off; // +a0.1 +fn global_settings { assumed_gamma 1.0 max_trace_level 20 #if (USE_PHOTONS) //photons {count 10000} photons {count 20000 jitter off} //photons {count 75000} #end #if (USE_RADIOSITY) //radiosity {Rad_Settings(Radiosity_Final, off, off)} //radiosity {Rad_Settings(Radiosity_Normal, off, off)} radiosity {Rad_Settings(Radiosity_Fast, off, off) normal off brightness 0.75} //radiosity {Rad_Settings(Radiosity_Debug, off, off)} #end } // Water Glass #declare GLASS_HEIGHT = 13.2; #declare GLASS_RAD0 = 2.8; #declare GLASS_RAD1 = 4.1; #declare GLASS_THICK0 = 1.0; #declare GLASS_THICK1 = 0.15; #declare WATER_LEVEL = 10.0; // Environment #declare LIGHT_ANGLE = 30.0; #declare SILL_HEIGHT = 71.0; #declare ROOM_RAD_X = 300.0; #declare ROOM_RAD_Z = 100.0; #declare WALL_THICK = 15.0; camera { location <40.0, 150.0, -70.0> look_at <40.0, 70.0, 0.0> angle 60 } // Sky sphere { 0, 10000 pigment {color 0.8*SkyBlue} hollow } // Ground outside plane {y, 0 pigment{color rgb 0.8*ForestGreen}} // Water glass #declare GLASS_SHAPE_OUTER = merge { #local r = 0.5*GLASS_THICK1; cone {r*y, GLASS_RAD0, GLASS_HEIGHT*y, GLASS_RAD1} torus {GLASS_RAD1-r, r translate GLASS_HEIGHT*y} torus {GLASS_RAD0-r, r translate r*y} cylinder {0,r*y,GLASS_RAD0-r} } #declare GLASS_SHAPE_INNER = union { #local r = 0.5*GLASS_THICK1; #local R = GLASS_RAD0-GLASS_THICK1; cone {(GLASS_THICK0+r)*y, R, (GLASS_HEIGHT+0.001)*y, GLASS_RAD1-GLASS_THICK1} torus {R-r, r translate (GLASS_THICK0+r)*y} cylinder {0,r*y,R-r translate GLASS_THICK0*y} } #declare WATER_SHAPE = intersection { object {GLASS_SHAPE_INNER translate 0.001*y} plane { y,WATER_LEVEL pigment {color rgbt 1} normal {bozo 0.3 scale 0.5} finish { specular 0.2 roughness 0.05 reflection {0,1 fresnel on} conserve_energy } } } #declare M_GLASS = material { texture { pigment {color rgbt 1} finish { specular 0.3 roughness 0.001 reflection {0,1 fresnel on} conserve_energy } } interior {ior 1.5} } #declare GLASS = difference { object {GLASS_SHAPE_OUTER} object {GLASS_SHAPE_INNER} material {M_GLASS} } #declare WATER = object { WATER_SHAPE pigment {color rgbt 1} finish { specular 0.2 roughness 0.05 reflection {0,1 fresnel on} conserve_energy } interior {ior 1.33 dispersion 1.025 dispersion_samples 7} } #if (USE_GLASS = on) union { object {GLASS photons {target refraction on collect off}} object {WATER photons {refraction on collect off}} translate <3.75,SILL_HEIGHT+0.001,0> } #end // Walls #declare WALL2 = 0.5*WALL_THICK; difference { box {<-WALL2,0,-ROOM_RAD_Z>,} box {< WALL2,-0.1,-ROOM_RAD_Z+WALL_THICK>,} box {<-WALL2-0.1,SILL_HEIGHT-2,-ROOM_RAD_Z+WALL_THICK>,} pigment {color rgb 1.0} normal {leopard 0.5 scale 0.15 turbulence 2.5} } // Floor intersection { plane {y, 0.001 } plane {-x, 0} pigment { quilted turbulence 0.5 color_map { [0 color rgb 0.6] [1 color rgb 0.8] } scale 2 } normal {bozo 0.5 scale 0.01} } // Window Sill object { Round_Box_Union(<-WALL2, SILL_HEIGHT-2.01,-ROOM_RAD_Z+WALL_THICK>, , 0.5) pigment {granite color_map {[0 color rgb 0.02] [1 color rgb 0.1]} rotate 3*x scale 2} finish {reflection 0.025} } // Floor Panel union { Round_Box_Union(, , 0.15) Round_Box_Union(, , 0.15) texture {T_Wood4} } // Window #if (USE_WINDOW = on) // Window Frame union { Round_Box_Union(<-WALL2, SILL_HEIGHT, -ROOM_RAD_Z+WALL_THICK>, <-WALL2+2, SILL_HEIGHT+4, ROOM_RAD_Z-WALL_THICK>, 0.05) Round_Box_Union(<-WALL2, SILL_HEIGHT, ROOM_RAD_Z-WALL_THICK>, <-WALL2+2, 300-WALL_THICK, ROOM_RAD_Z-WALL_THICK-4>, 0.05) pigment {color rgb <0.2,0.1,0.1>} normal {bozo 0.3 scale 0.1} finish {phong 0.4 reflection 0.2} } // Window Pane box { <-WALL2, SILL_HEIGHT+2.01, -ROOM_RAD_Z+WALL_THICK>, <-WALL2+1, 300-WALL_THICK, ROOM_RAD_Z-WALL_THICK-4.01> material {M_GLASS} photons {pass_through refraction off reflection off collect off} } #end // Plant #if (USE_PLANT) #include "pot.inc" #declare PLANT = object {TREE}; #else #declare PLANT = cylinder {0,y,0.025 pigment {color Green}}; #end #declare POT = union { // Actual pot difference { object {GLASS_SHAPE_OUTER} object {GLASS_SHAPE_INNER} } // Saucer intersection { difference { object {GLASS_SHAPE_OUTER} object {GLASS_SHAPE_INNER} } plane {y, 1.5} pigment {color rgb 0.1} finish {reflection 0.05} scale <1.2,1,1.2> } // Earth intersection { object {GLASS_SHAPE_INNER} plane {y, GLASS_HEIGHT-1} pigment {color rgb <0.3,0.1,0.0>} normal {bozo 1.5 scale 0.1} } scale <3,1.5,3> pigment {color rgb <0.7,0.4,0.1>} } union { object {PLANT scale 130 translate 15*y} object {POT} translate <42,0,60> } // Sun light_source { #local L_RAD = radians(LIGHT_ANGLE); #local L_DIR = <-cos(L_RAD), sin(L_RAD), -0.15>; 0 color rgb 3*<1.0,0.9,0.7> parallel point_at -L_DIR looks_like {sphere {0,20 pigment {color White}}} translate 1000*L_DIR #if (USE_AREA_LIGHT = on) area_light 0.025*z,0.025*y,9,9 circular orient adaptive on #end } // Fill light #if (USE_FILL_LIGHT = on) light_source { <0.6*ROOM_RAD_X,50,-0.6*ROOM_RAD_Z> color <0.15,0.15+0.33/255,0.15+0.66/255> // Minor reduction of banding? shadowless photons {refraction off reflection off} } #end