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.

statements are assumed to be non-directional, or ambient. <strong>The</strong> total amount of ambient<br />

light incident on a surface is normally returned to a surface shader through ambient. A solar<br />

statement indicates that the light source is a directional light source, while an illuminate<br />

statement indicates that the light source is a local light source. Local light sources have a<br />

position. <strong>The</strong> position can be a property of the shader or can be inherited from a surface. If<br />

the light source is attached to a geometric primitive the light source is an area light source.<br />

Light sources set Cl inside a solar or illuminate block unless they are defining an ambient<br />

light. Inside these blocks the direction L points towards the surface. This variable is<br />

available so that light source output intensities can be directional. If the light source has a<br />

position, the length of L is the distance from the light source to the surface being shaded.<br />

For example, consider the following light source:<br />

light<br />

phong(<br />

float intensity = 1.0;<br />

color color = 1;<br />

float size = 2.0;<br />

point from = point ”shader” (0,0,0);<br />

point to = point ”shader” (0,0,1); )<br />

{<br />

uniform vector R = normalize(to-from);<br />

}<br />

solar( R, PI/2 )<br />

Cl = intensity * color * pow( R.L/length(L), size );<br />

<strong>The</strong> Phong shading model can be interpreted to be a procedural directional light source.<br />

<strong>The</strong> light source has a direction R and a size parameter that controls its fall-off. <strong>The</strong> solar<br />

statement specifies that the light source casts light in the forward facing hemisphere.<br />

An environment background light source would be specified as follows:<br />

light<br />

reflection( string texturename = ””; float intensity = 1.0 )<br />

{<br />

solar()<br />

Cl = intensity * color environment( texturename, -L );<br />

}<br />

<strong>The</strong> solar statement implies the light is cast from infinity in all directions. <strong>The</strong> color of the<br />

light is given by the environment map.<br />

16.3 Volume Shader<br />

Volume shaders change Ci and Oi due to volumetric scattering, self-luminosity, and attenuation.<br />

A volume shader is called once per ray so it should explicitly integrate along the<br />

153

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

Saved successfully!

Ooh no, something went wrong!