26.01.2015 Views

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 11<br />

TYPES<br />

<strong>The</strong> Shading Language is strongly typed and supports the following basic types:<br />

11.1 Floats<br />

Floats are used for all scalar calculations. <strong>The</strong>y are also used for integer calculations.<br />

Floating-point variables are defined as follows:<br />

float a, b=1;<br />

<strong>The</strong> initialization value may be any scalar expression.<br />

11.2 Colors<br />

<strong>The</strong> Shading Language implements color as an abstract data type independent of the number<br />

of samples and the color space. <strong>The</strong> major operations involving color are color addition<br />

(‘+’ operator) corresponding to the mixing of two light sources, and color filtering (‘*’ operator)<br />

corresponding to the absorption of light by a material. In each case these color<br />

operations proceed on a component by component basis.<br />

<strong>The</strong> number of color samples used in the rendering program is set through the <strong>RenderMan</strong><br />

<strong>Interface</strong>. Once the number of color samples has been specified, colors with the appropriate<br />

number of samples must be passed to a shader. When setting the number of samples, the<br />

user can also specify a transformation from RGB space to this n sample color space. This<br />

allows a shader to convert color constants to the specified color space.<br />

Color component values of 0 correspond to minimum intensity, while values of 1 correspond<br />

to maximum intensity. A color constant of 0 is equivalent to black, and of 1 is<br />

equivalent to white. However, values outside that range are allowed (values less than<br />

zero decrement intensity from other sources). Note that if you are using a color variable to<br />

represent reflectivity, only component values between 0 and 1 are physically meaningful,<br />

whereas color variables that represent radiance may be unbounded.<br />

Color variables may be declared with:<br />

114

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!