// various metal colors, finishes and textures // brass, copper, chrome, silver #include "metals.inc" #include "colors.inc" #include "functions.inc" #declare N1 = normal { bumps .3 scale <50000, 0.0002, 50000> rotate <11,2,11> turbulence .05 } #declare N2 = normal { bumps .3 scale <55000, 0.0002, 55000> rotate <-11,2,-11> turbulence .05 } #declare N3 = normal { bumps .3 scale <40000, 0.0002, 40000> rotate <1,2,1> turbulence .05 } #declare Brushed_aluminum = texture { //average //texture_map { [0 BA1][1 BA2]} //BA1 normal { average normal_map { [1 N1 ]//rotate <30,0,30>] [1 N2 ]//rotate <30,0,30>] [1 N3 ]//rotate <30,0,30>] [1 N1 rotate -90*y] [1 N2 rotate -95*y] [1 N3 rotate -80*y] } } pigment { color rgb .6*<.8, .85, .89> } finish { reflection .2 } finish { metallic ambient 0.0 diffuse 0.6 specular 0.9 roughness 0.02 } } #declare GreenGlass = texture { // green glass pigment { rgbf <0.70, .82, 0.74, 0.95> } finish { ambient 0.1 diffuse 0.1 reflection 0.2 refraction 0.9 ior 1.8 specular 0.8 roughness 0.0003 //phong 1 //phong_size 400 } }//end texture #declare IsoFinish = finish { ambient 0 diffuse 1 specular 1 roughness 0.02 brilliance 2 } #declare StHeight = 10; // Height of Spiral #declare StRadius = 3; // stair Radius #declare SpHeight = 1; // Height of Rectangle that is swept along spiral #declare SpThick = 0.2; // Thickness of Rectangle that is swept along spiral #declare SpExtra = 1/2; // Extra distance flattened at top and bottom of spiral #declare CoRadius = 0.4; // Central column radius #declare HrRadius = 0.12; // HandRail Radius #declare HrHeight = 3.5; // Handrail height above spiral #declare HrExtend = 0.5; // Handrail Extensions at top and bottom #declare HsCount = 13; // Number of Handrail Supports #declare HsRadius = 0.09; // Handrail Support Radius #declare StepCount = 14; // Number of Steps #declare StepHeight = .12; // Thickness of steps #declare StepDepth = .6; // Width of step at spiral (shrinks to 0 at <0,0> #declare StepLights = on; // Lights built into each step #declare BuildTopStep = off;// Whether or not the top step is included #declare SafeW = StRadius+2; // Safe width - used for bouding boxes, etc. #declare SpiralStaircase = union { // Spiral Staircase union { intersection { // bound main spiral to cut ends off vertically isosurface { function { f_helix1(x,y,z, 1, // number of helices pi/(StHeight/2), // (period/pi) / unit height SpThick/2, // minor radius (2 inch -> 1/12 * 1/2) StRadius, // major radius SpHeight/SpThick, // stretch shape *y (2*minor radius* this) 0, // cross section type - 0 = square 0 // cross section rotation angle )} threshold 0 contained_by { box {<-SafeW, -1/2, -SafeW>,}} translate <0, 1/2, 0> rotate <0, -90, 0> } union { box {<-SafeW, 0, -SafeW>, } box {<-SafeW, .2*StHeight, -SafeW>, } box {<-SpExtra, .5*StHeight, -SafeW>, } } // end union } // end intersection // Handrail intersection { // bound main spiral to cut ends off vertically isosurface { function { f_helix1(x,y,z, 1, // number of helices pi/(StHeight/2), // (period/pi) / unit height HrRadius, // minor radius StRadius, // major radius 1, // stretch shape *y (2*minor radius* this) 1, // cross section type - 0 = square 0 // cross section rotation angle )} threshold 0 contained_by { box {<-SafeW, -2, -SafeW>,}} translate <0, HrHeight, 0> rotate <0, -90, 0> } // end isosurface - handrail union { box {<-SafeW, -0.1*StHeight, -SafeW>, <0, 0.5*StHeight, SafeW>} // 0.0 - 0.5 height : cut-off +x box {<-SafeW, 0.2*StHeight, -SafeW>, } // 0.2 - 0.8 height : no cut-off box {< 0, 0.5*StHeight, -SafeW>, } // 0.5 - 1.1 height : cut-off -x translate <0, HrHeight, 0> } // end union } // end intersection cylinder { // center column <0,0,0>, <0, StHeight+0.5, 0> CoRadius } cylinder { // extend hand rail - top <0, StHeight+HrHeight, -StRadius>, <-HrExtend, StHeight+HrHeight, -StRadius>, HrRadius } /* sphere { // ball to fill in gap between iso-rail and cylinder - top <0, StHeight+HrHeight, -StRadius>, HrRadius }*/ sphere { // ball to end cylinder - top <-6/12, StHeight+HrHeight, -StRadius>, HrRadius } cylinder { // extend hand rail - bottom <0, HrHeight, -StRadius>, , HrRadius } /* sphere { // ball to fill in gap between iso-rail and cylinder - bottom <0, HrHeight, -StRadius>, HrRadius }*/ sphere { // ball to end cylinder - bottom , HrRadius } #declare HandrailSupport = cylinder { <0, 0.5*SpHeight, 0> <0, HrHeight, 0> HsRadius } // Handrail Supports #declare I = 0; #while (I <= (HsCount-1)) object {HandrailSupport translate <0, StHeight-StHeight*(I/(HsCount-1)), -StRadius> rotate <0, 360-360*(I/(HsCount-1)), 0> #declare I=I+1; } #end texture { //pigment {color Red} //finish {IsoFinish} //T_Chrome_1A Brushed_aluminum } } // end union - everything but steps union { // steps #declare Step = union { // metal frames, plus glas step intersection { // Metal steps clipped by box difference { // cut out center of step prism { linear_spline conic_sweep 0.1, // Height1 - Start just outside of center, will be shifted // back to just within the opposite side StRadius+CoRadius, // Height2 - Out to spiral accounting for shift back. 5, // # of points <-(1/StRadius)*StepDepth, -20*StepHeight>, <-(1/StRadius)*StepDepth, 20*StepHeight>, < (1/StRadius)*StepDepth, 20*StepHeight>, < (1/StRadius)*StepDepth, -20*StepHeight>, <-(1/StRadius)*StepDepth, -20*StepHeight> } // end first prism prism { linear_spline conic_sweep 2*CoRadius+(StRadius*0.08), StRadius+CoRadius-(StRadius*0.08), 9, // # of points <-(1/StRadius)*StepDepth+(StepDepth/StRadius*0.08), 22*StepHeight>, // 1 < (1/StRadius)*StepDepth-(StepDepth/StRadius*0.08), 22*StepHeight>, // 2 < (1/StRadius)*StepDepth-(StepDepth/StRadius*0.08), 0>, // 3 < (1/StRadius)*StepDepth-(StepDepth/StRadius*0.25), 0>, // 4 < (1/StRadius)*StepDepth-(StepDepth/StRadius*0.25), -22*StepHeight>, // 5 <-(1/StRadius)*StepDepth+(StepDepth/StRadius*0.25), -22*StepHeight>, // 6 <-(1/StRadius)*StepDepth+(StepDepth/StRadius*0.25), 0>, // 7 <-(1/StRadius)*StepDepth+(StepDepth/StRadius*0.08), 0>, // 8 <-(1/StRadius)*StepDepth+(StepDepth/StRadius*0.08), 22*StepHeight> // 9=1 } // end second prism } // end difference // need box to clip step height, otherwise conic affects // the thickness of the step too box {<-(StepDepth+2), 0, -0.5*StepHeight>, < (StepDepth+2), StRadius+2, 0.5*StepHeight>} texture {Brushed_aluminum /*pigment {color Blue}*/} }// end intersection // glass step intersection { prism { linear_spline conic_sweep 2*CoRadius+(StRadius*0.08), StRadius+CoRadius-(StRadius*0.08), 5, // # of points <-(1/StRadius)*StepDepth+(StepDepth/StRadius*0.09), 21*StepHeight>, // 1 < (1/StRadius)*StepDepth-(StepDepth/StRadius*0.09), 21*StepHeight>, // 2 < (1/StRadius)*StepDepth-(StepDepth/StRadius*0.09), 0>, // 3 <-(1/StRadius)*StepDepth+(StepDepth/StRadius*0.09), 0>, // 4 <-(1/StRadius)*StepDepth+(StepDepth/StRadius*0.09), 21*StepHeight> // 5=1 } // end glass prism box {<-(StepDepth+2), 0, 0>, < (StepDepth+2), StRadius+CoRadius+2, 0.5*StepHeight+0.01>} texture { GreenGlass } } // end intersection (glass) light_source { <0, 2*CoRadius+(StRadius*0.12), 0.01> .04 } //rotate y*180 rotate -x*90 }// end union - Step // steps #declare I = 0; #if(BuildTopStep) #declare MaxStep = (StepCount-1); #else #declare MaxStep = (StepCount-2); #end #while (I <= (StepCount-1)) object {Step translate <0, (StHeight-StHeight*(I/(StepCount-1)) + 0.5*SpHeight), CoRadius> rotate <0, 360-360*(I/(StepCount-1)), 0> #declare I=I+1; } #end } // end union - steps }; // end union - Spiral Staircase /* Helix Parameters (7): 1. Number of helixes - e.g. 2 for a double helix 2. Period - is related to the number of turns per unit length 3. Minor radius 4. Major radius 5. Shape parameter. If this is greater than 1 then the tube becomes fatter in the y direction 6. Cross section type. 7. Cross section rotation angle (degrees). E.g. if you choose a square cross section and rotate it by 45 degrees you get a diamond cross section. */