POV-Ray : Newsgroups : povray.binaries.images : Spiral stairs Server Time
19 Nov 2024 02:28:00 EST (-0500)
  Spiral stairs (Message 1 to 3 of 3)  
From: PM 2Ring
Subject: Spiral stairs
Date: 30 Apr 2005 03:05:01
Message: <web.42732bc8d4c71a05e1f4d92c0@news.povray.org>
Here's a scene I developed over the last week after being inspired by Chris
B's example in newusers thread "Stairs":
 <425fd05d$1@news.povray.org>

// Persistence of Vision Ray Tracer Scene Description File
// File: SpiralStairG.pov
// Vers: 3.6
// Desc: Spiral Staircase
// Date: 15 Apr 2005 14:31:57
// Auth:  PM 2Ring, from an example by Chris B in
// <425fd05d$1@news.povray.org>
//
// -f -A0.5 +AM2 +R1
// -d +A0.05 +AM2 +R3
// -d +A0.4 +AM2 +R2 -J0 +KC +KFF180 +OAnim/SpiralStair
//

#declare Radio = 0;
#declare Do_Rails=1;
#declare Do_Pillar=1;
#declare Use_Normal=0;
#declare View_Upstairs=0;

#version 3.6;

global_settings {
  assumed_gamma 2 //1.6
  max_trace_level 10

#if(Radio)
  radiosity {
    pretrace_end .02
    //count 60

    //gray_threshold .1 //.125
    low_error_factor 0.8

    adc_bailout 0.01/2
    always_sample off
  }
  ambient_light 0
#end
}

//#include "colors.inc"

//--- Parameters ---------------------------------------------

#declare StepArc       = 20;         //10

#declare NumberOfSteps = (3+0/3) * 360/StepArc;
#declare StepRise      = 0.1875;
#declare StepHeight    = StepRise;
#declare StepWidth     = 2.25;  //*2.5

//#declare PostInset1 = 1.745;
#declare PostInset1 = 2.18;
#declare PostInset0 = 0.439;
#declare PostHeight = 0.875;
#declare PostRad = 0.0225;
#declare RailRad = PostRad * 1.3;

#declare PillarHeight = StepRise*NumberOfSteps + PostHeight*.75*0;
#declare FloorScale = 1.5/4;

//--- Textures --------------------------------------------------------

#declare Cream = colour rgb <1 1 .825>;
#declare Pink = colour rgb <1 .6 .7>*.875;
#declare LightBlue = colour rgb <.5 .75 1>*.875;

#declare CM_Pink = colour_map{
  [0.02 Cream*1.8][.45 Pink*1.65][.55 Pink*1.65][.98 Cream*1.8]
}

#declare CM_Blue = colour_map{
  [0.02 Cream*1.8][.45 LightBlue*1.65][.55 LightBlue*1.65][.98 Cream*1.8]
}

#declare PFloor0 = pigment{checker Cream, LightBlue}
#declare PFloor1 = pigment{checker Cream, Pink}

#declare FFloor =
finish{
  ambient 0.15 diffuse .95
  phong .5 phong_size 280
  reflection 0.125
}

#declare NFloor = normal{
  quilted .15 control0 0 control1 0.5
  //checker .1
}

#declare TFloor0 =
texture{
  pigment{PFloor0}
  finish{FFloor}
  #if(Use_Normal) normal{NFloor} #end

  rotate 45*y
  scale FloorScale
  translate FloorScale*<1,0,1>*sqrt(.5)
}

#declare TFloor1 =
texture{
  pigment{PFloor1}
  finish{FFloor}
  #if(Use_Normal) normal{NFloor} #end

  rotate 45*y
  scale FloorScale
  translate FloorScale*<1,0,1>*sqrt(.5)
}

#declare TRoom =
texture{
  pigment{rgb 1}
  finish{
    ambient 0.15 diffuse .95
    reflection 0.05
  }
}
#declare TRail = texture {
  pigment  {rgb .6}
  finish{
    ambient 0.035 diffuse 0.475
    specular 0.75 roughness 1e-4 metallic
    reflection {0.75 metallic}
  }
}

#declare Phase = 0.5;
#declare PRadial0 = pigment{
  radial phase Phase
  colour_map{CM_Blue}
}

#declare PRadial1 = pigment{
  radial phase Phase + 0
  colour_map{CM_Pink}
}

#declare TStep = texture {
  pigment{
    gradient y
    scale <1 PillarHeight*1.0001 1>
    pigment_map{
      [0 PRadial0]
      [1 PRadial1]
    }
  }

  finish{phong .5 phong_size 180 reflection 0.05}
  //normal{crackle .15 scale .15}
}

//#declare TStep = texture{pigment{rgbf .85}}

//--- Macros ----------------------------------------------

//Step transform
#macro TranSpiral(i)
  transform{
    rotate i*StepArc*y
    translate min(i,NumberOfSteps-1)*StepRise*y
  }
#end

//from transforms.inc
#macro vtransform(vec, trans)
   #local fn = function { transform { trans } }
   #local result = (fn(vec.x, vec.y, vec.z));
   result
#end

#macro VTranSpiral(vec, i) vtransform(vec, TranSpiral(i))#end

//Handrail
#macro Rail(A0, A1) cylinder{A0, A1, RailRad texture{TRail}}#end

//Simple fence
#macro Fence(Start, Delta, Num)
  #local i=0;
  #while (i<Num)
    #local Pos = Start+i*Delta;
    object {Post translate Pos texture{TRail}}
    Rail(Pos+PostHeight*y, Pos+PostHeight*y+Delta)

    #local i = i + 1;
  #end
#end

#macro Bannister(i, di, PostInset)
  object {Post
    translate <PostInset,StepRise,0>
    TranSpiral(i-di)
    texture{TRail}
  }

  //Handrail
  #if(i<NumberOfSteps)
    Rail(VTranSpiral(<PostInset,StepRise+PostHeight,0>, i-di),
      VTranSpiral(<PostInset,StepRise+PostHeight,0>, i))
  #end
#end

//--- Objects ---------------------------------------------------------

#declare Step = difference {
  cylinder {0,StepHeight*y,StepWidth}
  plane {-z,0 rotate -StepArc*y*1.5}
  plane { z,0 rotate StepArc*y*1.5}
}

#declare Post = union {
  cylinder {0,y*PostHeight, PostRad }
  sphere   {y*PostHeight, RailRad * 1.25}
}

//Stair positioning
#declare TranStair = transform{rotate (90+120)*y translate
<.65-sqrt(.5)/2,0,-.25>}

//Spiral Staircase
#declare Stairs = union{
#declare i=0;
#while (i<NumberOfSteps)
  object {Step
    TranSpiral(i)
    texture {TStep rotate 2*i*StepArc*y}
  }

  #if(Do_Rails) Bannister(i, 1, PostInset0) #end

  #declare i = i + 1;
#end

#if(Do_Rails)
  Bannister(i, 1, PostInset0)

  #declare i=-1;
  #while (i<NumberOfSteps-2/3)
    Bannister(i, 1/3, PostInset1)

    #declare i = i + 1/3;
  #end
#end

//Central pillar
#if(Do_Pillar)
  cylinder{
    0, y*PillarHeight, .3
    texture {
      TStep //rotate 180*y
      //TRail
    }
  }
#end

  transform{TranStair}
}

#if(Do_Rails)
#declare Railing =
union{
  //Left fence
  Fence(vtransform(<PostInset1,StepRise,0>,
    transform{TranSpiral(NumberOfSteps-1) TranStair}),
-x*FloorScale*sqrt(.5), 30)

  //Right fence
  Fence(vtransform(<PostInset0,StepRise,0>,
    transform{TranSpiral(NumberOfSteps+1) TranStair}),
x*FloorScale*sqrt(.5), 15)

  //Connect inner rail to right fence
  object{
    Rail(VTranSpiral(<PostInset0,StepRise+PostHeight,0>, NumberOfSteps-1),
      VTranSpiral(<PostInset0,StepRise+PostHeight,0>, NumberOfSteps+1))
    transform{TranStair}
  }
}
#end

#declare WW = 18*sqrt(2)*FloorScale;
#declare Room = box{
  <-WW, -StepHeight, -WW>, <WW, PillarHeight*2, WW>hollow texture{TRoom}
}
#declare Floor = box{<-WW, -StepHeight, -WW>, <WW, 0, WW>}

//--- The scene ------------------------------------------------------------

object{Room}
object{Floor texture{TFloor0}}
object{Floor pigment{rgb .75} translate y*PillarHeight*2}
object{Floor texture{TFloor1} translate<0, StepHeight*(NumberOfSteps)+1e-5,
WW>}
object{Stairs}
#if(Do_Rails)object{Railing}#end

camera {
#if(View_Upstairs)        //0=downstairs, 1=upstairs
  #declare Eye = <-1.15, 4.14, -1.65> * 4.725 * 0.88 ; //* 1.75
  //#declare Eye = <-1.75, 6.5, -1.5> * 4.31 * .55; //* 1.35
  look_at y*6.55
#else
  //#declare Eye = <-2, 1.25, -6.5>;
  //look_at <.75, .85, 1>

  #declare Eye = vtransform(<StepWidth*.75, PostHeight*1.9, 0>,
   transform{TranSpiral(NumberOfSteps*clock-2) TranStair});
  look_at vtransform(<StepWidth*.95, PostHeight*1.0, 0>,
   transform{TranSpiral(NumberOfSteps*clock+4) TranStair})
#end
  location Eye

  right x*image_width/image_height up y
  direction z
  //angle 43
  angle 90

  #if(Use_Stereo)
   window_distance 8 // 15 * 1.35 // 8
    cross_eyed
 #end
}

#declare Brite = #if(Radio) .85; #else 1.5; #end
#declare Brite = Brite*3.2 * .4; // * .35;

//light_source {<-4.15, PillarHeight*1.75, -6.5>  rgb .20*Brite}
//light_source {<1, PillarHeight*.75, 12>  rgb .20*Brite}

light_source {Eye-<1 1 1>*.25*0 rgb .45*Brite}

background{rgb .5}

//--------------------------------------------------------------------------


Post a reply to this message


Attachments:
Download 'spiralstairh2.jpg' (96 KB)

Preview of image 'spiralstairh2.jpg'
spiralstairh2.jpg


 

From: PM 2Ring
Subject: Re: Spiral stairs
Date: 30 Apr 2005 03:25:01
Message: <web.427331cca9a335fae1f4d92c0@news.povray.org>
Here's the downstairs view. I have an animated walkup (180 frames, 1.6M
...avi, .wmv codec). I'll try to use VirtualDub to shrink it below the 700k
limit & post it in p.b.a if it still looks ok.


Post a reply to this message


Attachments:
Download 'spiralstairh1.jpg' (54 KB)

Preview of image 'spiralstairh1.jpg'
spiralstairh1.jpg


 

From: Emerald Orchid
Subject: Re: Spiral stairs
Date: 30 Apr 2005 04:53:41
Message: <42734795$1@news.povray.org>
That's really rather pretty...


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.