###### Descriptions and Examples for the POV-Ray Raytracerby Friedrich A. Lohmüller     POV-Ray Examples - How To Make Objects for POV-Ray
Italiano
Français
Deutsch

Home
- POV-Ray Tutorial
- POV-Ray Examples
Index of Content
- Geometry
- Architecture
- House
- Roof
- Tower
- Castle
- Window + Door
- Stairs
- Pyramid
- Columns
- Arch
- Fences
- Furnitur
- Household
- Engineering

# Pyramid

###### This How To shows the construction of a stepped pyramid Here the outer dimensions are definde first: Half widht, total height and number of steps. The size of the height and deepth of the steps will be caculated from these valuse. An include file to use this object as a read-made object you can find at my POV-Ray Objects page.
The Construction:
###### First we define the outer dimensions:
```#declare Top___Width = 1.00;   // half width at the top
#declare Base___Width = 3.00;  // half width at the base
#declare Total___Height = 3.00; // total height of the pyramid
#declare Number_of___Steps = 8; // number of steps
//-------------------------------------------------------------- ```
###### From this valuse we calculate the height and deepth of the steps:
```#local D = 0.00001;
#local Step___Height = Total___Height/Number_of___Steps;
#local Step___Width  = (Base___Width-Top___Width)/(Number_of___Steps-1);
//-------------------------------------------------------------- ```
###### Zusammenbau mittel While-Schleife:
```union{
#local Nr = 0;     // start
#local EndNr = Number_of___Steps; // end
#while (Nr< EndNr)
#local P___Width = Base___Width-Step___Width*Nr;
#local P___Height = Step___Height;

box{ <-P___Width, 0.00, -P___Width>,< P___Width, P___Height, P___Width>

translate<0,Total___Height-(EndNr-Nr)*Step___Height,0>

texture{ pigment{ color rgb <1.00, 0.87, 0.73>} // ~ LightWood
finish { diffuse 0.9 phong 1 reflection 0.00}
} // end of texture

} // end of box

#local Nr = Nr + 1;  // next Nr
#end // --------------- end of loop
rotate<0,0,0>
translate<0,0,0>} // end of union
//----------------------------------------------------------------------------- ```

###### If we build a pyramis by single boxes with a continuous texture, in shadow parts with only ambient light the objects appear without any structure. To avoid this we can make each step out of two different boxes with slightly different textures:
```
union{ // inner union
//---------------------------------------------------------- visible in x and z
box{<-P___Width, 0.00+D, -P___Width>,< P___Width, P___Height-D, P___Width>
texture{ pigment{ color rgb <1.00, 0.87, 0.73>} // LightWood}// rgb<1,1,1>}
finish { diffuse 0.8  phong 1 reflection 0.00}
} // end of texture
} // end of box
//----------------------------------------------------------------- visible in y
box{<-P___Width+D, 0.00, -P___Width+D>,< P___Width-D, P___Height, P___Width-D>
texture{ pigment{ color rgb <1.00, 0.87, 0.73>} // ~ LightWood light
finish { diffuse 0.9 phong 1 reflection 0.00}
} // end of texture
} // end of box
//------------------------------------------------------------------------------

translate<0,Total___Height-(EndNr-Nr)*Step___Height,0>
} // end of inner union ```

About realistic textures for walls see Tower with Battlements

##### Ready-made POV-Ray objects as include files and example files you'll find at the POV-Ray Objects Page
top

 © Friedrich A. Lohmüller, 2006 www.f-lohmueller.de