## Main Control Variables

### 2.1.1 SCPostPositions

The SCPostPositions array holds a sequence of coordinates defined as 3D vectors. Each coordinate vector defines the position of a newel post and the sequence of posts defines the path that will be followed by one side of the staircase. The StairCase macro adds newel posts at these positions and adds corresponding newel posts on the opposite side of the staircase. It also optionally adds stairs, landings and banister rails to connect the newel posts together. This is therefore most important control variable for POV-Sairs as it effectively defines the path of the entire staircase.

It is anticipated that, other than for simple testing purposes you will always override the default values assigned to this array. This is a standard POV-Ray array and as such can be declared in a number of different ways as detailed in the POV-Ray documentation. Two common ways of declaring this variable are shown below. The first declares the array and assigns its values in a single statement.

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

- array [6] tells POV-Ray that this variable is an array with 6 elements.
- 6 sets of 3D <x,y,z> coordinates are then specified within the curly brackets and separated by commas.
- The variable declaration is terminated with a semicolon (';').

The following example declares and dimensions the array identifier in the first statement, then assigns its 6 values in separate statements.

#declare SCPostPositions = array [6];
#declare SCPostPositions[0] = <-3, 0,0>;
#declare SCPostPositions[1] = <-2, 0,0>;
#declare SCPostPositions[2] = <-1,-1,0>;
#declare SCPostPositions[3] = < 1,-1,0>;
#declare SCPostPositions[4] = < 2, 0,0>;
#declare SCPostPositions[5] = < 3, 0,0>;

- A 6 element array is declared.
- A set of 3D <x,y,z> coordinates is assigned to each array element, starting from element 0 and ending at element 5.
- Each declaration is terminated with a semicolon (';').

Note that all of the SCPostPositions array elements needs to be assigned a valid 3D vector, otherwise the StairCase macro will return an error.

Numerous examples illustrating the use of this control variable are included in the quick start section of this documentation.

### 2.1.2 SCStairWidth

This variable is used to define the width of the risers and treads (the steps of the stair case). If the SCStairHandedness control variable is set to '1' or '-1' then the SCStairWidth control variable also defines the centre to centre distance from one banister rail to the opposite banister rail. However, the SCStairHandedness can also be set to a non whole number, in which case the risers and treads can protrude beyond the line of the banister rails. By default it is set to '1' (1 metre). To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCStairWidth = 4; StairCase() This example sets the stair width to 4 units. |

### 2.1.3 SCStairCarpetWidth

This variable is used to define the width of the carpet. By default it is set to be the same as the stair width as defined using the SCStairWidth control variable. Reducing this width leaves an uncarpeted gap at the edges of the stairs. To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCStairCarpetWidth = 0.5; StairCase() This example sets the stair carpet width to 0.5 POV-Ray units. As shown in the image on the right, the stair width (as defined using the SCStairWidth variable) has defaulted to a value of 1, making the stairs 1 POV-Ray unit wide. The carpet does not therefore cover the whole stair width, leaving bare sections of riser and tread on either side of the carpet. |

### 2.1.4 SCStairHandedness

This variable is used to tell the StairCase macro whether the left hand or the right hand newel post positions have been specified in the SCPostPositions array. If set to '1' then these newel posts will be on the left of the staircase and if set to '-1' the newel posts will be to the right of the staircase. A non-whole number can be specified to move the posts and the banister rails in from the end of the stairs. By default this value is set to '1'. To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCStairHandedness = -1; #declare SCPostPositions = array [3] {<1,0,0>,<1,1,1.25>,<2.25,2,1.25>}; StairCase() Note that it is your responsibility to define newel post positions, a stair width and a stair handedness that provide enough space for stairs to be constructed without overlapping. If you SCStairHandedness were to be assigned a value of '1' with the post positions that were used in the exampel above, then the right turn made by the handrail would cause the start of the second flight of stairs to overlap the end of the first flight of stairs. The StairCase macro will not report this as an error, but the staircase you end up with will look a mess. |

### 2.1.5 SCHandRailHeight

This variable is used to define the height of the hand rail above the floor level of the newel posts. By default it is set to '0.920' (92cm). To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCHandRailHeight = 0.925; StairCase() |

### 2.1.6 SCMaxBalusterSpacing

This variable is used to define the maximum spacing for the balusters. The smallest number of balusters that will span the gap between two Newel Posts without leaving a gap larger than this value will be generated. By default it is set to '0.135' (13.5cm). To override the default setting and specify a maximum you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCMaxBalusterSpacing = 0.008; StairCase() Note that there is nothing stopping you specifying a very small baluster spacing that will cause the balusters to overlap. |

### 2.1.7 SCMaxRiserHeight

This variable is used to define the maximum height of a riser. The smallest number of risers that will rise the height between two Newel Posts without an individual riser being higher than this value will be generated. By default it is set to '0.190' (19cm). To override the default setting and specify a maximum riser height you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCMaxRiserHeight = 0.10; StairCase() The example illustrated in the image to the right specifies a very small riser height, creating a flight of stairs that is not particularly practical. You can also specify the proportion of the riser that will be included in the staircase, to give an open effect. See SCRiserCoverage |

### 2.1.8 SCLandingThreshold

This variable is used to define an angle that serves as a threshold above which an extra Newel Post will be added by the StairCase macro when creating a landing. By default it is set to '50' (50 degrees). If successive sections of staircase turn by more than this amount, an extra Newel Post will be added to assist with the turn between flights of stairs. To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCLandingThreshold = 30; #declare SCPostPositions = array [3] {<0,0,0>,<0,1,1.25>,<-0.75,2,2.5>}; StairCase() When the post positions create a landing that turns through an angle that exceeds the threshold an extra newel post is added. |
#include "StairCase.inc" #declare SCLandingThreshold = 40; #declare SCPostPositions = array [3] {<0,0,0>,<0,1,1.25>,<-0.75,2,2.5>}; StairCase() When the post positions create a landing that turns through an angle that is less than the threshold the last newel post from one flight of stairs is connected to the first newel post from the next flight. |

### 2.1.9 SCRiserCoverage

This variable is used to define the proportion of the riser that is present. If set to 1 then the whole riser will be present giving a staircase with no open gaps between the treads. A value of 0.5 will fill the upper half of the riser leaving a gap between the base of each riser and the top of the next tread down. By default this value is set to '1'. To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCRiserCoverage = 0.5; #declare SCStairCarpetOn = 0; StairCase() This tells POV-Stairs to only use half height risers to support the treads, giving an open style of staircase. The rise from one tread to the next is controlled using the SCMaxRiserHeight control variable. |

## Control Switches

### 2.2.1 SCStairsOn

This variable is used to indicate whether the StairCase macro should define stairs or just the banister rails. By default it is set to '1' to define a complete stair case. To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCStairsOn = 0; StairCase() This example suppresses the generation of stairs as shown in the image on the right. Notice that this also suppresses the generation of landings, which, for the purposes of this setting are considered to be part of the stair assembly. |

### 2.2.2 SCLandingsOn

This variable is used to indicate whether the StairCase macro should define landings to join the various flight of stairs together. By default it is set to '1' to define a complete stair case. To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCLandingsOn = 0; StairCase() This example suppresses the generation of landings as shown in the image on the right. |

### 2.2.3 SCStairCarpetOn

This variable is used to indicate whether the StairCase macro should carpet the stairs. By default it is set to '1' to define a complete stair case. To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCStairCarpetOn = 0; StairCase() This example suppresses the stair carpet as shown in the image on the right. |

### 2.2.4 SCMainBanisterOn

This variable is used to indicate whether the StairCase macro should include the main banisters. This is the banister whose position is defined by the positions of the Newel Posts specified using the SCPostPositions array. By default this variable is set to '1' to define a stair case with a banister rail. If set to zero, the Newel Posts whose positions are specified are not included in the generated staircase. This may seem unusual, but can be useful when constructing a staircase against a wall, because it may be easier to specify the positions against the wall than to calculate the positions of the corresponding banisters on the opposite side of the staircase. To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCMainBanisterOn = 0; StairCase() This example suppresses the main banister as shown in the image on the right. Note that the banister rail referred to as the main banister rail is dependant upon the handedness of the stairs. In this example the setting for the SCStairHandedness variable defaults to '1' which indicates that the stairs are drawn to the right of the specified newel posts as one looks at the first flight of stairs from the starting point. |

### 2.2.5 SCPairedBanisterOn

This variable is used to indicate whether the StairCase macro should include the 'paired' banisters. That is to say the banisters on the opposite side of the staircase to the banisters whose positions are defined by the positions of the Newel Posts specified using the SCPostPositions array. By default it is set to '1' to define a complete stair case. To override the default setting you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCPairedBanisterOn = 0; StairCase() This example suppresses the paired banister as shown in the image on the right. Note that the banister rail referred to as the paired banister rail is dependant upon the handedness of the stairs. In this example the setting for the SCStairHandedness variable defaults to '1' which indicates that the stairs are drawn to the right of the specified newel posts as one looks at the first flight of stairs from the starting point. Setting SCPairedBanisterOn to '0' therefore suppresses the banister rail to the right of those stairs. |

## Object Definitions

### 2.3.1 SCNewelPost

| This object represents a Newel Post. A pair of Newel Posts are used to support the ends of a length of handrail. The Newel Post is defined as being about 1 POV-Ray unit in height. The edge that will end up pointing towards the start of the flight of stairs needs to be initially defined pointing in the +z direction. The StairCase macro applies a texture based upon the setting of the SCNewelTexture variable. It then rotates and translates each Newel Post into position as necessary. If not set, this object will default to the shape shown on the left which consists of a lathe cut shape. To override the default setting you can declare this object in your scene file before calling the StairCase macro. For example: |
#include "StairCase.inc" #declare SCNewelPost = intersection { box {<-0.042,-1,-0.042><0.042,1.02,0.042>} plane {<0,1,1>,0 translate 1.05*y} plane {<0,1,1>,0 translate 1.05*y rotate 90*y} plane {<0,1,1>,0 translate 1.05*y rotate 180*y} plane {<0,1,1>,0 translate 1.05*y rotate 270*y} } StairCase()
This example defines a simple box shape for the post then bevels off the four top edges by intersecting the post with four appropriately positioned planes.

Box - Bevelled - Chamfer - Notched - Turned - Fluted | A number of sample newel post shapes are included in the 'sample.inc' include file. The definitions are stored inside the SCNewelShape macro, so to use these shapes you need to include the file and run the macro, assigning the result to the 'SCNewelPost' variable before calling the StairCase macro. The following example illustrates this: #include "SCSamples.inc" #include "StairCase.inc" #declare SCNewelPost = SCNewelShape ("Fluted") StairCase() This example would generate a staircase using the 'Notched' newel post shape shown in the image to the left.

### 2.3.2 SCBaluster

| This object represents a Baluster. A set of Balusters are used to support the handrail between pairs of Newel Posts. It is defined as being a little over 1 POV-Ray unit in height. The StairCase macro trims the top and bottom to match the setting of the SCHandRailHeight variable. The edge that will end up pointing towards the start of the flight of stairs is defined pointing towards the +z direction. The StairCase macro will apply a texture based upon the setting of the SCBalusterTexture variable. It then rotates and translates each Baluster into position as necessary. If not set, this object will default to the shape shown on the left which consists of a lathe cut shape. To override the default setting you can declare this object in your scene file before calling the StairCase macro. For example: |
#include "StairCase.inc" #declare SCBaluster = box {<-0.015,-0.03,-0.015><0.015,1,0.015>}; StairCase()
This gives a simple square section baluster as shown in the image to the right.

Fluted - Turned - Notched - Chamfer - Bevelled - Box | A number of sample baluster shapes are included in the 'sample.inc' include file. The definitions are stored inside the SCBalusterShape macro, so to use these shapes you need to include the file and run the macro, assigning the result to the 'SCBaluster' variable before calling the StairCase macro. The following example illustrates this: #include "SCSamples.inc" #include "StairCase.inc" #declare SCBaluster = SCBalusterShape ("Notched") StairCase() This example would generate a staircase using the 'Notched' baluster shape shown in the image to the left.

### 2.3.3 SCHandRail

| This object represents the hand rail and is defined as being of a 1 POV-Ray unit in length. The StairCase macro will scale this length as necessary to enable the hand rail to span the distance between two Newel Posts. The hand rail is defined starting at the origin and running out along the +z axis. The StairCase macro will scale this section, apply a unique texture based upon the setting of the SCRailTexture variable with a degree of randomness designed to give each hand rail a unique texture. It then rotates and translates each hand rail into position as necessary. If not set, this object will default to the shape shown on the left. To override the default setting you can declare this object in your scene file before calling the StairCase macro. For example: |
#include "StairCase.inc" #declare SCHandRail = cylinder {<0,0.015,0><0,0.015,1>,0.03 clipped_by{plane{-y,0}} scale y*0.6}; StairCase()
This gives a rounded handrail with a flat underside as shown in the image to the right.

### 2.3.4 SCStringer

| This object represents the side edging of the stairs. The risers and the treads are connected into this component which supports the weight of a flight of stairs. If not set, this object will default to the shape shown on the left which consists of a simple rectangular piece topped with a standard shoerail. To override the default setting you can declare this object in your scene file before calling the StairCase macro. For example: |
#include "StairCase.inc" #declare SCStringer = box {<-0.03,-0.14,-0.08><0.03,0.12,1.08>}; StairCase()
This uses a thicker stringer with no Shoerail, as shown in the image to the right.

### 2.3.5 SCTread

| This object represents the tread and is defined as being of a 1 POV-Ray unit width. The StairCase macro will scale this width to match the setting of the SCStairWidth variable. The tread is defined at the origin with its top surface at a height of '0' units. The front edge of the tread points towards the +z direction. The back edge is typically defined as being at 1 POV-Ray back in the -z direction. The StairCase macro will trim this so that it stops when it meets the next riser. The StairCase macro will apply a unique texture based upon the setting of the SCTreadTexture variable with a degree of randomness designed to give each stair a unique texture. It then rotates and translates each tread into position as necessary. If not set, this object will default to the shape shown on the left which consists of a rectangular piece fronted with a rounded edge. To override the default setting you can declare this object in your scene file before calling the StairCase macro. For example: |
#include "StairCase.inc" #declare SCTread = box {<-0.5,-0.042,-1><0.5,0,0.15>}; #declare SCStairCarpetOn = 0; StairCase()
This replaces the rounded tread with a thick straight edged plank as shown in the image to the right.

### 2.3.6 SCRiser

| This object represents the riser that joins the back edge of one stair to the underside of the next. It is defined as being of a 1 POV-Ray unit in width and nearly 1 POV-Ray unit in height. It's top surface stops just short of y=0 to avoid any problems with coincident surfaces. The StairCase macro will scale the riser width to match the setting of the SCStairWidth variable and will scale the height to match the riser height which is calculated based upon the setting of the SCMaxRiserHeight variable. The riser is defined at the origin with its front surface pointing in the +z direction. The StairCase macro will apply a unique texture based upon the setting of the SCRiserTexture variable with a degree of randomness designed to give each stair a unique texture. It then rotates and translates each tread into position as necessary. If not set, this object will default to the shape shown on the left which consists of a simple rectangular box. To override the default setting you can declare this object in your scene file before calling the StairCase macro. For example: |
#include "StairCase.inc" #declare SCRiser = difference { box {<-0.5,-1,0.120><0.5,-0.001,0.128>} box {<-0.05,-0.05,0.119><0.05,0.05,0.129> rotate z*45 scale 2*y translate <-0.25,-0.55,0>} box {<-0.05,-0.05,0.119><0.05,0.05,0.129> rotate z*45 scale 2*y translate < 0 ,-0.55,0>} box {<-0.05,-0.05,0.119><0.05,0.05,0.129> rotate z*45 scale 2*y translate < 0.25,-0.55,0>} } #declare SCStairCarpetOn = 0; StairCase()
This example uses CSG to create a slightly more ornate riser as shown in the image to the right.

### 2.3.7 SCStairCarpet

| This object represents a section of carpet running along the top of a tread and down over a riser. It is defined as being of a 1 POV-Ray unit in width and the StairCase macro scales this width to match the setting of the SCStairCarpetWidth variable. The front edge of the carpet segment points towards the +z direction. The back edge is typically defined as being at 1 POV-Ray back in the -z direction. The StairCase macro will trim this so that it stops when it meets the next riser. The StairCase macro will apply a texture based upon the setting of the SCStairCarpetTexture variable. It then rotates and translates each stair carpet section into position as necessary. If not set, this object will default to the shape shown on the left which consists of a curled shape that wraps around the front of a stair. To override the default setting you can declare this object in your scene file before calling the StairCase macro. For example: |
#include "StairCase.inc" #declare SCStairCarpet = box {<-0.4,0,-0.1><0.4,0.001,0.10>} StairCase()
This represents a rectangular section of carpet embedded into the tread as shown in the image to the right.

## Textures

### 2.4.1 SCNewelTexture

This variable is used to define a texture for the Newel Posts. By default it is set to T_Wood1 from the "woods.inc" include file supplied with POV-ray. To override the default setting and specify a texture for a Newel Post you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCNewelTexture = texture {pigment {color rgb <1,0,0>}}; StairCase() As can be seen in this image, the texture specified for the Newel Post also serves as the default texture for other components such as the Balusters and the Hand Rail. |

### 2.4.2 SCBalusterTexture

This variable is used to define a texture for the Balusters. By default it is set to be the same as the texture defined for the Newel Posts using SCNewelTexture. To override the default setting and specify a texture for the Balusters you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCBalusterTexture = texture {pigment {color rgb <0,1,0>}}; StairCase() |

### 2.4.3 SCStringerTexture

This variable is used to define a texture for the Stringers. By default it is set to T_Wood30 from the "woods.inc" include file supplied with POV-ray. To override the default setting and specify a texture for the Stringers you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #include "textures.inc" #declare SCStringerTexture = texture {Cherry_Wood translate <-1,-1,0> translate -y scale <0.1,0.015,0.1>} StairCase() |

### 2.4.4 SCRailTexture

This variable is used to define a texture for the Banister Rails (the hand rails). By default it is set to be the same as the texture defined for the Newel Posts using SCNewelTexture. To override the default setting and specify a texture for the Banister Rails you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCRailTexture = texture {pigment {color rgb <1,0,1>}}; StairCase() |

### 2.4.5 SCTreadTexture

This variable is used to define a texture for the Treads. By default it is set to be the same as the texture defined for the Newel Posts using SCNewelTexture. To override the default setting and specify a texture for the Treads you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #include "textures.inc" #declare SCTreadTexture = texture {Cherry_Wood translate <-1,-1,0> rotate y*90 translate -y scale <0.1,0.1,0.008>} #declare SCStairCarpetOn=0; StairCase() |

### 2.4.6 SCRiserTexture

This variable is used to define a texture for the Risers. By default it is set to T_Wood30 from the "woods.inc" include file supplied with POV-ray. To override the default setting and specify a texture for the Risers you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #include "textures.inc" #declare SCRiserTexture = texture {Sandalwood scale <0.1,0.005,0.1>} #declare SCStairCarpetOn=0; StairCase() |

### 2.4.7 SCStairCarpetTexture

This variable is used to define a texture for the Carpet. By default it is set to have a pigment as defined using the SCStairCarpetColour control variable and an 'agate' normal scaled to provide a disrupted surface normal. To override the default setting and specify a texture for the Risers you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCStairCarpetTexture = texture {pigment {color rgb <1,1,1>}}; #declare SCStairCarpetWidth = 0.75; StairCase() |

### 2.4.8 SCStairCarpetColour

This variable is used to define a colour for the Carpet. By default it is set to '<1,1,0>' (Yellow). To override the default setting and specify a texture for the Stair Carpet you can declare this variable in your scene file before calling the StairCase macro. For example:

#include "StairCase.inc" #declare SCStairCarpetColour = <0,1,0>; StairCase() |

Note. If you specify a setting for the SCStairCarpetTexture control variable, then the SCStairCarpetColour control variable is ignored.