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.

path of the ray.<br />

<strong>The</strong> input Ci and Oi are the colors and opacities at the point P. <strong>The</strong> volume shader should<br />

set the color and opacity that result at the point P-I.<br />

16.4 Displacement Shaders<br />

Displacement shaders move the position P of a surface. After a point of the surface is<br />

moved, the normals should be recalculated with calculatenormal unless the new normals<br />

can be computed as part of the displacement.<br />

<strong>The</strong> following shader places a sinusoidal bump on a surface.<br />

displacement<br />

ripple( float amplitude = 1.0, float wavelength = 0.25 )<br />

{<br />

P += N * amplitude * sin( 2*PI*(s / wavelength) );<br />

N = calculatenormal(P);<br />

}<br />

16.5 Imager Shaders<br />

Imager shaders change the value of Ci and Oi. <strong>The</strong> exposure and quantization process<br />

specified in the section on Displays in Part I could be specified as the following imager:<br />

imager<br />

exposure( float gain=1.0, gamma=1.0, one = 255, min = 0, max = 255 )<br />

{<br />

Ci = pow( gain * Ci, 1/gamma );<br />

Ci = clamp( round( one * Ci ), min, max );<br />

Oi = clamp( round( one * Oi ), min, max );<br />

}<br />

154

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

Saved successfully!

Ooh no, something went wrong!