#version 3.5; #include "colors.inc" #include "functions.inc" #include "glass.inc" global_settings { assumed_gamma 1.0 max_trace_level 20 } #default {finish{ambient 0}} #declare usearealight = no; #declare usehighqualityarealight = yes; #declare usebeammedia = yes; #declare usemedia = yes ; #declare usefog = no; // i added fading to the main light source so this isn't really necessary anymore #declare light_pos = <0, 2.15, 0>; //#declare light_col = <1,.9,.7>; //decided to go with a cooler inside color and a warmer outside color to fit with the lonliness theme. #declare light_col = <.9,.9,1>; #macro paddedWall (X,Y) union { #declare J=1; #while (J<=Y) #declare I =1; #while(I<=X) sphere {0,1 scale <1.1,1.1,1> translate } sphere {,.1} sphere {,.1} #declare I=I+1; #end #declare J=J+1; #end } #end #declare Wall = object {paddedWall (12,10) scale .5 //pigment {color rgb <.3,.3,.3>} pigment { bozo color_map { [0 rgb <.1,0,0>] [.1 rgb <.2,.0,0>] [.2 rgb <.3,.1,.0>] [.25 rgb <.3,.3,.3>] [.3 rgb <.3,.3,.3>] [.4 rgb <.25,.26,.25>] [.8 rgb <.1,.12,.0>] [1 rgb <.0,.005,0>] } warp { turbulence .7 octaves 8 lambda 4 omega .6 } scale .3 } } // ---------------------------------------- Camera & Lights camera { ultra_wide_angle location <-.27, 2.63, -.27> //location light_pos + x*.1 look_at light_pos //location <-0.5, 0.2, -2> //+ y*2 //location <-.25,1.65,3.8> //look_at <-.25,1.65,0> //look_at light_pos - y*1//*2 look_at <1,-3,1> angle 130 } light_source { light_pos // light's position color rgb light_col looks_like { sphere_sweep { linear_spline // linear curve //cubic_spline // alternative spline curves //b_spline 4, // number of specified sphere positions <-.03, 0, .03>, .001 // position, radius <-.01, -.003, -.002>, .001 // ... <.01, .003, .002>, .001 <.03, 0, -.03>, .001 tolerance 0.0001 // optional pigment {rgb light_col} finish {ambient 1 diffuse 0} no_shadow } } #if (usearealight) area_light x*.08,y*.08, #if (usehighqualityarealight) 17,17 adaptive 2 #else 5,5 adaptive 1 #end circular orient #end fade_distance 1.8 fade_power 7 // corners hardly lit, walls lit well enough to see; creates a nice atmosphere } // ---------------------------------------- Floor box { <-10, .05, -10> // one corner position < 10, -40, 10> // other corner position texture { pigment { bozo color_map { [0 rgb <.2,.3,.2>] [.33 rgb <.12,.12,.12>] [.67 rgb <.15,.17,.15>] [1 rgb <.25,.25,.25>] } warp { turbulence .4 octaves 3 lambda 3 omega .7 } scale .3 } normal { dents 1 scale .3 } /*finish { reflection 1 }*/ } } // ---------------------------------------- Ceiling box { <-3, 3, -5> // one corner position < 3, 4, 5> // other corner position pigment {rgb <.8,.9,.8>} /*texture { pigment {color rgb <0.9, 0.9, 0.9>} finish{ ambient 0 } scale 3 } */ } // ---------------------------------------- Bulb #declare bulb = difference { union { sphere { <0, 0, 0>, .08 } cone { <0, 1.4553, 0>/3*.08, 2.6234/3*.08, <0, 3.3, 0>/3*.08, 1.6/3*.08 } cylinder { <0, 3.3, 0>/3*.08, <0, 4.6, 0>/3*.08, 1.6/3*.08 } } union { sphere { <0, 0, 0>, .075 } cone { <0, 1.4553, 0>/3*.075, 2.6234/3*.075, <0, 3.3, 0>/3*.075, 1.6/3*.075 } cylinder { <0, 3.3, 0>/3*.075, <0, 4.6, 0>/3, 1.6/3*.075 } } rotate -4*x } object { bulb pigment {rgb light_col filter .5 transmit .5} finish { reflection .1 specular .3 roughness .003 } interior { ior 1.5 } no_shadow translate light_pos } union { cylinder { // top of bulb holder <0,.15,0>,<0,.17,0>,.08 } #declare cagebar = sphere_sweep { cubic_spline 6, <.068,.17,0>,.005, <.068,.15,0>,.005, <.09,.07,0>,.005, <.09,-.07,0>,.005, <0,-.15,0>,.005, <-.02,-.15,0>,.005 //#if (!usearealight) no_shadow #end no_shadow } object { cagebar } object { cagebar rotate 60*y } object { cagebar rotate 120*y } object { cagebar rotate 180*y } object { cagebar rotate 240*y } object { cagebar rotate 300*y } torus { .105,.005 //#if (!usearealight) no_shadow #end no_shadow } rotate 27*y rotate -4*x translate light_pos pigment {rgb .25} } sphere_sweep { //linear_spline // linear curve cubic_spline // alternative spline curves //b_spline 6, // number of specified sphere positions light_pos+<-.03, 0, .03>, .001 // position, radius light_pos+<-.03, 0, .03>, .001 // position, radius <-.001,2.26,.01>, .001 // ... <.001,2.26,-.01>, .001 light_pos+<.03, 0, -.03>, .001 light_pos+<.03, 0, -.03>, .001 //tolerance 0.00000001 // optional pigment {rgb 1} //no_shadow // so small that shadow should be inconsequential } // ---------------------------------------- Cable sphere_sweep { cubic_spline 6, <.01,3.4,-.03>, .01, <0,3,0>, .01, <-.01,2.75,.04>, .01 <.06,2.5,-.005>, .01 <0,2.26,0>, .01 <0,2.1,.03>, .01 no_shadow } /*#declare cordshadow = disc { // fake blurred shadow from cord 0,y,1 pigment { spherical color_map { [0 rgbt <0,0,0,1>] [1 rgbt <0,0,0,.35>] } cubic_wave warp { turbulence .2 octaves 4 omega .4 lambda 3 } scale .5 } hollow no_shadow } // transparent objects in fog cause shadows. It's a bug. So i turn off their shadows and use the actual objects real close to the ceiling. object { cordshadow scale 3 translate 2.998*y } object { cordshadow scale .7 translate 2.999*y }*/ // ---------------------------------------- Door union { difference { //This Door has spacing between the door and walls. It was causing artifacts. /*box {<-.7495,-.0495,2.5>,<.2495,1.9995,2.75>} box {<-.6495,1.2005,2.55>,<.1495,1.8995,0>} box {<-.6495,.1595,2.55>,<.1495,1.1005,0>} box {<-.5,1.6,-5>,<0,1.5,5>}*/ //This door is flush with the walls and floor but artifact free :) box {<-.75,-.05,2.5>,<.25,2.01,2.75>} box {<-.65,1.2,2.55>,<.15,1.9,0>} box {<-.65,.16,2.55>,<.15,1.1,0>} box {<-.5,1.6,-5>,<0,1.5,5>} texture { bozo //this is the PATTERN_TYPE texture_map { [0 pigment{rgb <.15,.17,.15>} finish { phong 0.9 phong_size 100 } normal{bozo .2 scale .08}] [.759 pigment{rgb <.15,.17,.15>} finish { phong 0.9 phong_size 100 } normal{bozo .2 scale .08}] [.76 pigment{rgb <.005,.0025,0>} normal{bozo .5 scale .005}] [1 pigment{rgb <.005,.0025,0>} normal{bozo .5 scale .005}] } warp { turbulence .4 octaves 6 lambda 2 omega .5 } scale <.05,.1,.05> } } cylinder { // not sure what these are, but they blocked my light source so i moved them =) // They're supposed to be window bars. I think I fixed 'em. <-.25,1.7,2.65>, <-.25,1.4,2.65>, .015 pigment {color Black} } cylinder { <-.375,1.7,2.65>, <-.375,1.4,2.65>, .015 pigment {color Black} } cylinder { <-.125,1.7,2.65>, <-.125,1.4,2.65>, .015 pigment {color Black} } } // ---------------------------------------- Outside light and beam of light #declare beamstartpos = <-1.1,2,5>; // moving this may require adjusting the beamcorners, which are not the exact corners of the window in the door. //#declare beamcolor = <1,.955,.93>*3;//decided to go with a cooler inside color and a warmer outside color to fit with the lonliness theme. #declare beamcolor = <1,1,.8>*3; #declare beamcorner1 = <-.44,1.5,2.5>; #declare beamcorner2 = <-.44,1.565,2.5>; #declare beamcorner3 = <0,1.565,2.5>; #declare beamcorner4 = <0,1.5,2.5>; #declare beamdist = 8; light_source { beamstartpos rgb beamcolor } #if (usebeammedia) mesh { #macro makebeamside(start,p1,p2,d) triangle { vnormalize(p1-start)*d+start, vnormalize(p2-start)*d+start, start } #end makebeamside(beamstartpos,beamcorner1,beamcorner2,beamdist) makebeamside(beamstartpos,beamcorner2,beamcorner3,beamdist) makebeamside(beamstartpos,beamcorner3,beamcorner4,beamdist) makebeamside(beamstartpos,beamcorner4,beamcorner1,beamdist) pigment {//rgbt 1} rgb beamcolor/3 transmit 1} interior { media { emission .05* beamcolor density { spherical color_map { [0 rgb 0] [.7 rgb 1] } cubic_wave scale beamdist translate beamstartpos } } } hollow no_shadow } #end // ---------------------------------------- Back Wall difference { object {Wall translate <-2.5,-2.25,3>} box {<-.75,-.05,-5>,<.25,2,5>} } // ---------------------------------------- Left Wall object {Wall rotate y*90 translate <-2.5,-2.25, 3.25>} // ---------------------------------------- Right Wall object {Wall rotate y*90 translate < 2.5,-2.25, 3.25>} // ---------------------------------------- Front Wall (behind camera) object {Wall translate <-2.5,-2.25, -3>} // ---------------------------------------- Mattress superellipsoid { <.2, .2> texture { pigment {checker White, <.4,.4,1> scale <100,100,.04> translate <5,50,5.02> } } texture { pigment { bozo color_map { [0 rgbf <.5,.4,.4,1>] [.3 rgbf <.3,.2,.1,1>] [.6 rgbf <.3,.2,0,.8>] [1 rgbf <.2,.1,0,0>] } warp { turbulence .4 octaves 8 lambda 5 omega .7 } scale .3 } } scale <1, .19, .52> translate <.65,.049,-1.6> rotate y*-12 } // ---------------------------------------- Light emission #if (usemedia) intersection { #declare scaleamnt = .6; sphere { 0,1 scale scaleamnt } plane { y,(3-light_pos.y)-.002 // avoids sphere intersection with ceiling, which appears to be buggy causing a shadow because of the absorption, regardless of the no_shadow. } cone { // cuts out the part that is in shadow of the top of the light's cage .15*y,.08, scaleamnt*y,.08/.15*scaleamnt rotate -5*x inverse } pigment {rgbt 1} interior { media { // simulate scattering media by using emission and black fog #declare meddensity = .2; emission meddensity * light_col method 3 samples 100,100 density { spherical cubic_wave } density { #declare basespherefunc = function (x,y,z,a) {f_noise3d(x*a,y*a,z*a)}; function {basespherefunc(x,y,z,4/sqrt(x*x+y*y+z*z))} cubic_wave } /*density { bozo color_map {[.2 rgb 0][1 rgb 1]} scale .4 }*/ scale scaleamnt } } hollow no_shadow translate light_pos } #end #if (usefog) fog { distance 2 color rgb 0 } #end