The Input File

The scene description read by <#80#><#1753#>rayshade<#1753#><#80#> consists of a number of keywords, each followed by a set of arguments. These keywords can be thought of as commands that direct <#81#><#1755#>rayshade<#1755#><#81#> to do various things, such as create objects, set the eye's position, and change an object's appearance.

Many of the keywords have related command-line options for turning on special features and setting values. These options override the values given in the input file, and are explained in detail in Appendix A.

<#82#><#1757#>Rayshade<#1757#><#82#> is ``case sensitive,'' which means that typing <#83#>SPHERE<#83#> or <#84#>Sphere<#84#> instead of <#85#>sphere<#85#> won't work. <#86#><#1759#>Rayshade<#1759#><#86#> keywords are all lower-case. Many people choose to capitalize the first letter of names that they give to objects or surfaces in order to make then ``stand out'' in an input file.

Keywords, numbers and strings in the input file are separated by spaces, tabs, or new lines (carriage returns). These ``whitespace'' characters are handled identically by <#87#><#1761#>rayshade<#1761#><#87#>, which means that you can separate keywords from keywords, key words from arguments, and arguments from arguments using any combination of whitespace characters that you choose.


<#4612#>Table<#4612#>: <#4613#>Operators, in order of decreasing precedence.<#4613#>
Operator Use Operation
1 2 Exponentiation
3 4 Negation
5 6 Multiplication
7 8 Division
10 11 Remainder
12 13 Addition
14 15 Subtraction


Numbers may be entered directly as reals or as parenthesized expressions. Reals may be written in exponential notation if you wish, and integers may be written with or without a trailing decimal point. When an integer value is called for and a real is given, the real value is truncated and the resulting integer is used. Table #tab:operators#95> lists the available operators available for use in expressions, in order of decreasing precedence.

The upshot of all this is that the strings <#96#>42<#96#>, <#97#>42.<#97#>, <#98#>(20 + 22)<#98#>, and <#99#>(7162 - 7)<#99#> mean the same thing to <#100#><#1763#>rayshade<#1763#><#100#>.

Variables may also be defined and used in expressions. Several built-in functions are also provided. See Appendix B for further details.

<#101#><#1765#>Rayshade<#1765#><#101#> will automatically run the input it receives through the C preprocessor if it is available. This allows you to use C preprocessor directives, such as <#102#>#include<#102#>, <#103#>#define<#103#>, and <#104#>#ifdef<#104#> when designing your input files.

Comments may be included in <#105#><#1767#>rayshade<#1767#><#105#> input files by enclosing text between the strings 17 and 18, as in the C programming language.