The RenderMan Interface - Paul Bourke
The RenderMan Interface - Paul Bourke
The RenderMan Interface - Paul Bourke
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Return surface normal given a point on the surface. This function is normally called<br />
after a displacement. For example:<br />
P += displacement * N;<br />
N = calculatenormal( P );<br />
15.3 Color Functions<br />
Several functions exist which operate on colors.<br />
float comp ( color c; float index )<br />
void setcomp ( output color c; float index, value )<br />
<strong>The</strong>se functions get and set individual color components. <strong>The</strong> index values are 0-<br />
based (e.g., the green channel of an RGB triple is component 1).<br />
color mix( color color0, color1; float value )<br />
{<br />
return (1-value)*color0 + value*color1;<br />
}<br />
Return an interpolated color value.<br />
color ctransform ( string tospace; color C )<br />
color ctransform ( string fromspace, tospace; color C )<br />
Transform the color C from the color representation fromspace to the color representation<br />
tospace. If fromspace is absent, it is assumed to be ”rgb”.<br />
15.4 Matrix Functions<br />
float comp ( matrix m; float row, column )<br />
void setcomp ( output matrix m; float row, column, value )<br />
<strong>The</strong>se functions get and set individual components of a matrix. Strict runtime bounds<br />
checking will be performed on row and column to ensure that they fall into the range<br />
0...3.<br />
float determinant ( matrix m )<br />
Returns the determinant of matrix m.<br />
matrix translate ( matrix m; vector t )<br />
matrix rotate ( matrix m; float angle; vector axis )<br />
matrix scale ( matrix m; point s )<br />
Postconcatenates simple transformations onto the matrix m. <strong>The</strong>se functions are similar<br />
to the RI functions RiTranslate, RiRotate and RiScale, except that the rotation<br />
angle in rotate() is in radians, not in degrees as with RiRotate.<br />
140