Surface Specification

<#640#><#2011#>Rayshade<#2011#><#640#> provides a number of ways to define surfaces and to bind these surfaces to objects. The most straight-forward method of surface specification is to simply list the surface properties to be used. Alternatively, one may associate a name with a given surface. This name may subsequently be used to refer to that surface.

<#4971#><#4971#>
<#1468#>surface<#1468#> <#1469#>name<#1469#> ;SPMlt;<#1470#>Surface Definition<#1470#>;SPMgt;
Associate the given collection of surface attributes with the given name.

The binding of a collection of surface properties to a given object is accomplished in a bottom-up manner; the surface that ``closest'' in the modeling tree to the primitive being rendered is the one that is used to give the primitive its appearance.

An object that has no surface bound to it is assigned a default surface that gives the appearance of white plastic.

The most direct way to bind a surface to a primitive is to specify the surface when the the primitive instantiated. This is accomplished by inserting a list of surface attributes or a surface name after the primitive's type keyword and before the actual primitive data.

verbatim42#

Here, we define a red surface named ``mud''. We then instantiate a sphere, which has a diffuse white surface bound to it. The next line instantiates a sphere with the defined ``mud'' surface bound to it. The last line instantiates a sphere with no surface bound to it; it is assigned the default surface by <#648#><#2013#>rayshade<#2013#><#648#>.

The <#649#>applysurf<#649#> keyword may be used to set the default surface characteristics for the aggregate object currently being defined.

<#4974#><#4974#>
<#1473#>applysurf<#1473#> ;SPMlt;<#1474#>Surface Specification<#1474#>;SPMgt;
The specified surface is applied to all following instantiated objects that do not have surfaces associated with them. The scope of this keyword is limited to the aggregate currently being defined.

verbatim43#

For convenience, the name <#656#>cursurf<#656#> may be used to refer to the current default surface.

The utility of bottom-up binding of surfaces lies in the fact that one may be as adamant or as noncommittal about surface binding as one sees fit when defining objects. For example, one could define a king chess piece consisting of triangles that have no surface bound to them, save for the cross on top, which has a gold-colored surface associated with it. One may then instantiate the king twice, once applying a black surface, and once applying a white surface. The result: a black king and a white king, each adorned with a golden cross.

verbatim44#
#center4977#