Downloading POV-Stairs

POV-Ray is a free raytracing software that can be used to create photo-realistic images. It can be downloaded from the POV-Ray website at http://www.povray.org. It is well supported on the newsgroups at http://news.povray.org/groups/

consists of a free 'include' file that incorporates

POV-Stairs 1.0 has been written using POV-Ray 3.5 and POV-Ray 3.6, but should also be compatible with more recent versions.

A zip file containing the include file and numerous examples along with a second zip file containing this documentation can be downloaded from the home page. You should unzip these files to a location of your choice.

To test POV-Stairs, open one of the 'StairCaseExample' scene files in POV-Ray and render it. You should see a simple example of a staircase, though StairCaseExample3.pov is a little more complex as it contains a complete scene definition for the lobby of a hotel and therefore may take a couple of minutes to render.

To make the POV-Stairs include file available to any scene file you render using POV-Ray, copy the include file into your standard POV-Ray include directory (alternatively you can simply add a copy into the directory containing your scene). You are permitted to include POV-Stairs within code that you subsequently re-distribute in original or modified form in accordance with the POV-Stairs license.

Adding a staircase to your scene

With POV-Ray you create scene files that describe the scene you want to render. To add a POV-Stairs staircase to your scene you need to add at least two lines to your POV-Ray scene file. For example:
#include "staircase.inc"
StairCase()
By wrapping the StairCase macro call in an 'object' definition you can treat it as a standard POV-Ray object. The following example adds a staircase to the scene and translates it 5 units along the x-axis.
object {StairCase() translate x*5}

To control where the staircase goes, you need to specify the 3D coordinates that define the positions of the newel posts (the posts supporting the corners of the handrail) and the width of the stairs. POV-Stairs draws newel posts at the positions you specify, joins them together with banister rails and a stringers and draws treads and risers off at right angles to the banister rails. It adds a parallelogram shaped landings to transition the flooring around the corners and, optionally adds a second banister rail on the opposite side of the stairs. Finally you can decide whether to carpet the stairs and whether the carpet should span the full width of the stairs or leave the edges bare.

There are about 50 different control variables that you can set to tailor the stairs to your needs, but that shouldn't put you off because all of them have sensible defaults, so that you can generate a staircase straight away. If you run the StairCase macro without changing anything, you get a staircase with three flights of stairs starting at the origin and rising up a total of about 3 POV-ray units at a scale where 1 POV-Ray unit = 1 Metre. You can assign the output of POV-Stairs to a variable or wrap it in an object definition so that you can transform it to be any scale you want.

POV-Stairs control variables are all specified with units of 1 POV-Ray unit = 1 Metre.

All POV-Stairs control variable and macro names start with the prefix 'SC' so as to reduce the likelihood that these names will conflict with variable names that you have used elsewhere in your scene file.

The most important control variable uses an array to specify a sequence of coordinates for the positions of the newel posts. This is the 'SCPostPositions' variable.
#include "staircase.inc"
#declare SCPostPositions = array [3] {<0,0,0>,<0,2,2.5>,<-2.5,4,2.5>};
StairCase()
The SCPositions variable is defined as an array containing 3 coordinates:
  • The 'floor level' of the first newel post will be located at the origin.
  • The second newel post will be raised up by 2 metres and will be 2.5 metres along in the direction of the positive 'z' axis.
  • The third will be 2.5 metres away to the left of the line from the first to the second and will be raised to a height of 4 metres.
This gives two flights of stairs at right angles to one another and will, by default include a little landing joining the two flights. By default the stairs are drawn to the right of the newel posts as you look along the lines joining them in the sequence that they are defined. This 'handedness' can be changed by setting the 'SCStairHandedness' control variable to '-1'.
Click to see full larger image

If you specify adjacent newel post positions that have the same 'y' value, POV-Stairs adds more level sections of landing as in the following example:
camera {location <-6,5.2,2> look_at <0,0,1.2>}
#include "StairCase.inc"
#declare SCStairWidth = 1.5;
#declare SCStairCarpetWidth = 1.2;
#declare SCPostPositions = array [6] {<0,2,0>,<0,1,3>,<-1,1,3>,<-2,0,2>,<-2,0,1>,<-2,-1,-2>};
StairCase()
The SCPositions variable is defined as an array containing 6 coordinates:
  • The second and third newel posts are at the same height. POV-Stairs therefore creates a level section between the newel posts.
  • The fourth and fifth posts are also at the same level, so POV-Stairs adds another level section here.
This still gives three flights of stairs, but creates extended landings between each flight.

This example also illustrates the use of the SCStairWidth and SCStairCarpetWidth control variables to specify a stair width of 1.5 units and a carpet width of 1.2 units, leaving a bare section of timber on either side of the carpet.

Click to see full larger image

Stairs can clearly go up or down. The following example illustrates the definition for a set of stairs that changes direction. It is normal to have a level section between any such changes.
camera {location <0,3,-5> look_at <0,0,0>}
#include "StairCase.inc"
#declare SCPostPositions = array [6] {<-3,0,0>,<-2,0,0>,<-1,-1,0>,<1,-1,0>,<2,0,0>,<3,0,0>};
StairCase()
The SCPositions variable is defined as an array containing 6 coordinates:
  • The first and last two sections are all at the same height
  • The section joining the second and third newel post drops down by 1 unit.
  • A level section joining newel posts 3 and 4 is followed by a rise by 1 unit between newel posts 4 and 5.
Click to see full larger image

Adding separate flights of stairs

There are various ways to provide an opening in the banister rail in the middle. The following example illustrates one approach.
camera {location <0,3,-5> look_at <0,0,0>}
#include "StairCase.inc"
#declare SCPairedBanisterOn = 0;
#declare SCPostPositions = array [6] {<-3,0,0>,<-2,0,0>,<-1,-1,0>,<1,-1,0>,<2,0,0>,<3,0,0>};
StairCase()

#declare SCPairedBanisterOn = 1;
#declare SCMainBanisterOn = 0;
#declare SCStairsOn = 0;
#declare SCPostPositions = array [3] {<-3,0,0>,<-2,0,0>,<-1,-1,0>};
StairCase()

#declare SCPostPositions = array [3] {<1,-1,0>,<2,0,0>,<3,0,0>};
StairCase()

#declare SCMainBanisterOn = 1;
#declare SCStairsOn = 1;
#declare SCStairWidth=2;
#declare SCPostPositions = array [2] {<-1,-1.5,-1.65>,<-1,-1,-1>};
StairCase()

The SCPositions variable is redefined between successive StairCase macro calls:
  • The first call uses a SCPairedBanisterOn variable setting of '0' so that the banister rail nearest to the camera is not created.
  • The second call creates only a banister rail joining the first 3 newel posts.
  • The third call creates a banister rail joining the last 3 newel posts.
  • The final call creates a full flight of stairs leading into the gap we have left in the banister rail.
Click to see full larger image

The following example creates three separate flights of stairs with no landing in between.
#include "staircase.inc"
#declare SCPostPositions = array [2] {<0,0,0>,<0,2,2.5>};
StairCase()
#declare SCPostPositions = array [2] {<0,2,2.5>,<-2.5,4,2.5>};
StairCase()
#declare SCPostPositions = array [2] {<0,2,2.5>,< 2.5,4,2.5>};
StairCase()
Click to see full larger image

The positions specified don't have to define flights of stairs that are at right angles to one another. POV-Stairs calculates the coordinates of the landing in one of two ways depending upon the amount through which the staircase needs to turn at that landing. If it turns through an angle that is greater than the setting of SCLandingThreshold then it adds a fourth newel post and calculates a parallelogram. Otherwise it uses the existing 3 newel posts to define a triangular landing. This works fairly well, but may not provide the level of control that you need. If the automatically generated landings are not satisfactory, simply split the staircase into multiple sections and code landings of your own in your scene file.