POV-Ray Object Collection
|
|
To add a road sign to your scene file you include the "roadsigns.inc" file and call the 'Roadsigns_Panel' macro.
Various examples are provided in the file 'roadsigns.pov'. Dimensions are specified in metres. The ScaleConvert macro from the POV-Ray Object Collection can be used to convert between different units of measure.
The following pre-defined symbols are provided. Note. Although the symbols in the table below are categorised by the 'type' of sign they normally appear on, you can use any symbol with any sign type. Just specify the sign type ("Warning", "Regulatory", "Compulsory", "Hazard" etc.) as the first parameter to the 'Roadsigns_Panel' macro and the symbol name ("HumpBridge", "Fire" etc.) as the second parameter:
|
#case (strcmp(SymbolName,"Hedgehog"))
#local Roadsigns_SymbolOffset = <-0.1 ,-0.55,0>; // Hedgehog #local Roadsigns_ThisSymbolTexture = texture { Roadsigns_PrismToTexture(Roadsigns_Hedgehog,<1,1,1,1>,Roadsigns_SymbolColor) } #break |
A 'case' clause is added into the 'select' statement within the 'Roadsigns_UKSymbolTexture' macro. This macro consists almost entirely of different case statements for each of the different symbols. This example implements a 'case' clause to handle the symbol named "Hedgehog".
The piece of code that adds the symbol to the sign initialy centres it within the sign. If the symbol is asymmetrical it may then need to be moved left or right (e.g. -0.1 in 'x'). It may also need moving up or down to get it looking right for the shape of the sign you wish to use it with (e.g. -0.55 in 'y'). The unit of measure used for the offset is the width of the border around the edge of the sign, i.e. 1 unit = 1 border width. The parameters to the 'Roadsigns_PrismToTexture' macro are explained below. The variable 'Roadsigns_SymbolColor' defaults to the standard symbol color for the sign being used (e.g. black for "Warning" signs, white for "Compulsory" signs.). The background color is usually completely transparent. |
Having done that (so long as you get the scaling of the prism in the include file and the offset defined in this macro right) you should be able to add a Hedgehog warning sign to your scene file:
Alternatively, if you want to keep your own symbols separate or if you wish to build a file containing a distinct set of symbols that can be incorporated back into this collection, you can create a separate file and specify the file name using the 'Roadsigns_SymbolFile' variable before calling the 'Roadsigns_Panel' macro.
Note. If you get the file name wrong, or if the file is not located within the POV-Ray include path, the default file will be used. If the symbol is not found the symbol name will be displayed as text on the panel, so if your symbol name appeara on the sign instead of the graphical symbol you should check the file name and path.
Within the 'Roadsigns_UKSymbolTexture' macro in the 'roadsigns.inc' file you'll find some examples of building up more complex objects, for example objects using multiple symbols and text and using multiple coloured objects, such as in the "TrafficSignals" symbol.
You'll notice that the symbol name (e.g. 'Hedgehog') is different from the name of the object used to create the symbol (e.g. 'Roadsigns_Hedgehog'). In fact you can have multiple symbol names that use the same object definition. For example, you may wish to change the offset to align your hedgehog for a different style of sign or you may want to change the colour of the symbol for display on a different coloured background. Also you can use multiple symbol objects to build a single road sign. For example, the "NoExplosives" symbol uses two separate prism objects, one for the car and one for the explosion erupting out of the roof.
To change the colour of the symbol displayed (default <0,0,0>=Black) simply adjust the second parameter on the 'Roadsigns_PrismToTexture' macro call.
| roadsigns.inc | The main include file for the Roadsigns object containing the 'Roadsigns_Panel' macro. | |
|---|---|---|
| roadsigns.pov | A sample scene file illustrating the use of the Roadsigns macro to generate the signs shown in the image at the top of this page. | |
| roadsigns.html | This document. | |
| roadsigns_documentimages.pov | A scene file that generated most of the images used in this document. Images can be generated one at a time or by using the animation settings that are documented in comments at the top of that scene file. | |
| roadsigns_uksymbols.inc | The default symbol file containing prism objects to represent a selection of UK road sign symbols. | |
| roadsigns_hazardsymbols.inc | A symbol file containing prism objects to represent a selection of hazard sign symbols. To use symbols from this file, set the 'Roadsigns_SymbolFile' variable to "roadsigns_hazardsymbols.inc" before calling the 'Roadsigns_Panel' macro. | |
Most of the files included with the Roadsigns macros are sample images and documentation files. If you don't wish to distribute all of these files you only need to include a copy of the file 'roadsigns.inc' and an include file containing the symbols you want to use e.g. the 'roadsigns_uksymbols.inc' file or a cut-down version of it.
If you plan to submit your object to the POV-Ray Object Collection at http://lib.povray.org/ you will need to rename the files to conform to the naming standards (All files from your submission will need the same unique prefix). Remember to update the renamed 'roadsigns.inc' file to point to the renamed symbols file.
| Roadsigns_Panel macro | |||||||
|---|---|---|---|---|---|---|---|
The Roadsigns_Panel macro may well be the only macro you ever need to call. It defines a panel whose shape is determined based on the first parameter and adds the symbol named in the second parameter (or text if it doesn't find a symbol of that name).
| |||||||
| Roadsigns_PrismToTexture macro | |||||||
|
This utility macro takes an object that is passed to it and returns a pigment
It also centres the object at the origin and turns it through -90 degrees around the x axis. It requires 3 parameters:
| |||||||
| Roadsigns_UKSymbolTexture macro | |||||||
|
This macro tries to find the specified symbol in the uk symbols file and returns a texture using the symbol as an
object pattern. If it's not in the list it simply returns it as a piece of text converted to a texture.
This macro requires one parameter: It also centres the object at the origin and turns it through -90 degrees around the x axis.
| |||||||
| Roadsigns_DefaultSettings macro | |||||||
| This macro assigns default values to any key control variables that are not yet set. | |||||||
| Roadsigns_Undef macro | |||||||
| This macro resets key control variables so that they can revert to default values. | |||||||
| Variable | Description |
|---|---|
| Roadsigns_SymbolFile | The file containing the definition of the symbols to be used to make the sign. This defaults to "roadsigns_uksymbols.inc" but can be set to "roadsigns_hazardsymbols.inc" for the Hazards symbols shown above or to a file of your own making. |
| Roadsigns_Thickness | The thickness of the material used to make the sign. |
| Roadsigns_Diameter | The diameter of a circular sign (e.g. a "Regulatory" sign). |
| Roadsigns_FaceHeight | The height of a non-circular sign (e.g. a "Warning" sign). |
| Roadsigns_FaceWidth | The width of a rectangular sign, such as the "RoundedRectangle" and "SupplementaryInformation" signs. The width of most other shapes is determined automatically to maintain the correct proportions of the sign. |
| Roadsigns_CornerRadius | The corner radius of a rectangular sign, such as the "RoundedRectangle" and "SupplementaryInformation" signs or a triangular sign such as the "Warning" sign. This is normally defined automatically, but you can set it in your scene file. |
| Roadsigns_SymbolText |
Certain road signs contain text within the symbols. Where this text is configurable you can set this variable to the required text. For example, the maximum lorry length for the "MaxTruckLength" symbol can be set using:
#declare Roadsigns_SymbolText = "Max 12m";
before calling the 'Roadsigns_Panel' macro.
This variable can be used with the "SteepHillDownwards" symbol and the "SteepHillDownwards" symbol to specify the gradient you wish to be displayed. It can be used with the "EndMinimumSpeed" to specify the speed and optionally with the "Parking" sign to indicate the distance to the parking area. |
| Roadsigns_TextArray |
This array is intended to be used with the "TextArray" symbol which retrieves the elements of text and builds a symbol that consists of those lines of text, centrally justified and scaled to fit within the height of the sign. This is most frequently used with rectangular signs, such as the "RoundedRectangle" and "SupplementaryInformation" signs. For example:
#declare Roadsigns_TextArray = array [2]{"GIVE WAY","50 yds"};
can be used to generate a panel to go beneath an empty inverted red bordered triangle to give advanced warning of the distance to a Give Way line.
object {Roadsigns_Panel("SupplementaryInformation", "TextArray")} |
| Roadsigns_SymbolColor | The color of the main part of the symbol is usually determined by the type of sign, so "Compulsory" signs use white symbols and "Regulatory" signs use black symbols. If you need to override this setting you can specify the color of your choice using this variable before calling the 'Roadsigns_Panel' macro. |
| Roadsigns_Normal | You can add a surface normal definition to the texture used for the front surface of the sign by setting this value. |
| Roadsigns_Finish | You can add a surface finish definition to the texture used for the front surface of the sign by setting this value. |
| Roadsigns_DirtTexture | You can add a layer of texture on top of the other textures that are used to make up the road sign. Although this can be used for a variety of purposes, the main intention is to enable a layer of dirt to be added to obscure the surface. This is a full texture definition and can include a pigment, a normal and a finish. Note. The pigment has to be partially transparent or it will totally obscure the surface of the road sign. The default setting is completely transparent. |
| Roadsigns_SignalRed | A colour vector defining the colour 'Signal Red' as used on UK road signs. You can change this setting in your scene file to substitute an alternative colour. |
| Roadsigns_MiddleBlue | A colour vector defining the colour 'Middle Blue' as used on UK road signs. You can change this setting in your scene file to substitute an alternative colour. |
| Roadsigns_Green | A colour vector defining the colour 'Green' as used on UK road signs (Mainly the 'GO' sign). You can change this setting in your scene file to substitute an alternative colour. |
| Roadsigns_Orange | A colour vector defining the orange colour used for the hazard signs. You can change this setting in your scene file to substitute an alternative colour. |
| Roadsigns_White | A colour vector defining the white parts of a sign. You can change this setting in your scene file to substitute an alternative colour. |
| Roadsigns_GreyBack | A colour vector defining the grey parts of a sign. You can change this setting in your scene file to substitute an alternative colour. |
| Roadsigns_BorderWidth | The width of the border around the edge of the "Warning" and "Regulatory" signs. This width is normally defined automatically, but you can set it in your scene file, although a number of dimensions are calculated based upon this value, such as the amount by which symbols are offset from their geometrical centre to 'centre' them on the road sign. |
| Roadsigns_Delta | When constructing the road sign object, certain dimensions need to be adjusted by a small amount to avoid coincident surfaces. This variable controls that amount and is usually set to 0.0000001. This should not normally need to be changed. |