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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Type<br />

Light sources<br />

Surfaces<br />

Atmosphere<br />

Displacement<br />

Imager<br />

Shader<br />

ambientlight<br />

distantlight<br />

pointlight<br />

spotlight<br />

constant<br />

matte<br />

metal<br />

shinymetal<br />

plastic<br />

paintedplastic<br />

fog<br />

depthcue<br />

bumpy<br />

background<br />

Table 10.1: Standard Shaders<br />

Shaders contain instance variables that customize a particular shader of that type. For a<br />

surface shader these variables may denote material properties; for a light source shader<br />

these variables may control its intensity or directional properties. All instance variables<br />

have default values that are specified in the definition of the shader. When a shader is<br />

added to the graphics state, these default values may be overridden by user-supplied values.<br />

This is done by giving a parameter list consisting of name-value pairs. <strong>The</strong> names in<br />

this list are the same as the names of the instance variables in the shader definition. Note<br />

that many different versions of the same shader can be instanced by giving different values<br />

for its instance variables. <strong>The</strong> instance variables associated with a shader effectively<br />

enlarge the current graphics state to include new appearance attributes. Because the attributes<br />

in the graphics state are so easily extended in this way, the number of “built-in” or<br />

“predefined” shading-related variables in the graphics state has been kept to a minimum.<br />

<strong>The</strong>re are several steps involved in using a shader defined in the Shading Language. First,<br />

a text file containing the source for the shader is created and edited. Second, this file is<br />

then compiled using the Shading Language compiler to create an object file. Third, the<br />

object file is placed in a standard place to make it available to the renderer. At this point, a<br />

shader programmed in the Shading Language is equivalent to any other shader used by the<br />

system. When a <strong>RenderMan</strong> <strong>Interface</strong> command involving a programmed shader (that is,<br />

one that is not built-in) is invoked, the shader is looked up by name in the table of available<br />

shaders, read into the rendering program, and initialized. This shader is then instanced<br />

using the instance variables supplied in the <strong>RenderMan</strong> <strong>Interface</strong> procedure. Finally, when<br />

a geometric primitive is being shaded, the shaders associated with it are executed.<br />

113

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

Saved successfully!

Ooh no, something went wrong!