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 8<br />

INTRODUCTION TO THE SHADING LANGUAGE<br />

Remarkably realistic images can be produced with a few fairly simple shapes made from<br />

interesting materials and lighted in a natural way. Creating a photorealistic image requires<br />

the specification of these material and lighting properties. This part of the document describes<br />

the Shading Language, which is used to write custom shading and lighting procedures<br />

called shaders. Providing a language allows a user to extend shading models or to<br />

create totally new ones. Models of light sources with special lenses, concentrators, flaps or<br />

diffusers can be created. <strong>The</strong> physics of materials can be simulated or special materials can<br />

be created. This is done by modeling the interaction of light at the surface and in the interior<br />

of a region of space. Material types can also be combined, simulating the many coats of<br />

paint or finish applied to a surface. Providing a shading language also allows many of the<br />

tricks and shortcuts commonly performed during production rendering to be accommodated<br />

without destroying the conceptual integrity of the shading calculations. Visualizing<br />

the results of scientific simulations is also easier because shaders can be written that produce<br />

a surface color that is based directly on the results of a computation. For example, it<br />

is possible to write a shader that sets the surface color based on temperature and surface<br />

curvature. Shaders can also be used to modify the final pixel values before they are written<br />

to the display.<br />

<strong>The</strong> Shading Language is a C-like language with extensions for handling color and point<br />

data types. A large number of trigonometric and mathematical functions, including interpolation<br />

and noise functions, are provided. Color operators are provided that simulate the<br />

mixing and filtering of light. Point and vector operators perform common geometric operations<br />

such as dot and cross product. A collection of commonly used geometric functions<br />

is also provided. <strong>The</strong>se include functions to transform points to specific coordinate systems.<br />

Common lighting and shading formulas, such as ambient, diffuse, specular, or phong,<br />

are available as built-in functions. Built-in texture access functions return values from images<br />

representing texture maps, environment maps, and shadow depth maps. <strong>The</strong> texture<br />

coordinates given to these functions can be either the presupplied texture coordinates or<br />

values computed in the Shading Language. Since texture map values are just like any other<br />

value in the language, they can be used to control any aspect of the shading calculation.<br />

<strong>The</strong>re is in principle no limit to the number of texture maps per surface.<br />

<strong>The</strong> Shading Language can be used for specifying surface displacement functions such as<br />

ripples or nubs. Shading Language functions are also used for pixel operations. This type<br />

of shader is referred to as an imager. Imagers are used to do special effects processing, to<br />

compensate for non-linearities in display media, and to convert to device dependent color<br />

107

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

Saved successfully!

Ooh no, something went wrong!